equal
deleted
inserted
replaced
24 |
24 |
25 procedure AddObjects(); |
25 procedure AddObjects(); |
26 procedure FreeLandObjects(); |
26 procedure FreeLandObjects(); |
27 procedure LoadThemeConfig; |
27 procedure LoadThemeConfig; |
28 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; |
28 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; |
29 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word); |
29 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); |
30 procedure BlitImageUsingMask(cpX, cpY: Longword; Image, Mask: PSDL_Surface); |
30 procedure BlitImageUsingMask(cpX, cpY: Longword; Image, Mask: PSDL_Surface); |
31 procedure AddOnLandObjects(Surface: PSDL_Surface); |
31 procedure AddOnLandObjects(Surface: PSDL_Surface); |
32 procedure SetLand(var LandWord: Word; Pixel: LongWord); inline; |
32 procedure SetLand(var LandWord: Word; Pixel: LongWord); inline; |
33 |
33 |
34 implementation |
34 implementation |
92 |
92 |
93 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; |
93 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; |
94 begin |
94 begin |
95 BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, 0); |
95 BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, 0); |
96 end; |
96 end; |
97 |
97 |
98 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word); |
98 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); |
99 var p: PLongwordArray; |
99 var p: PLongwordArray; |
100 x, y: Longword; |
100 x, y: Longword; |
101 bpp: LongInt; |
101 bpp: LongInt; |
102 begin |
102 begin |
103 WriteToConsole('Generating collision info... '); |
103 WriteToConsole('Generating collision info... '); |
126 else |
126 else |
127 if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then |
127 if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then |
128 LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; |
128 LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; |
129 |
129 |
130 if (Land[cpY + y, cpX + x] <= lfAllObjMask) and ((p^[x] and AMask) <> 0) then |
130 if (Land[cpY + y, cpX + x] <= lfAllObjMask) and ((p^[x] and AMask) <> 0) then |
131 begin |
131 Land[cpY + y, cpX + x]:= lfObject or LandFlags |
132 Land[cpY + y, cpX + x]:= lfObject; |
|
133 Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or extraFlags |
|
134 end; |
|
135 end; |
132 end; |
136 p:= @(p^[Image^.pitch shr 2]) |
133 p:= @(p^[Image^.pitch shr 2]) |
137 end; |
134 end; |
138 |
135 |
139 if SDL_MustLock(Image) then |
136 if SDL_MustLock(Image) then |
278 tmpsurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifTransparent or ifIgnoreCaps); |
275 tmpsurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifTransparent or ifIgnoreCaps); |
279 |
276 |
280 rr.x:= x1; |
277 rr.x:= x1; |
281 while rr.x < x2 do |
278 while rr.x < x2 do |
282 begin |
279 begin |
283 // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun |
280 if cIce then |
284 if (Theme = 'Snow') or (Theme = 'Christmas') then |
|
285 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf, lfIce) |
281 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf, lfIce) |
286 else |
282 else |
287 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); |
283 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); |
288 inc(rr.x, tmpsurf^.w); |
284 inc(rr.x, tmpsurf^.w); |
289 end; |
285 end; |
497 end; |
493 end; |
498 |
494 |
499 s:= cPathz[ptCurrTheme] + '/' + cThemeCFGFilename; |
495 s:= cPathz[ptCurrTheme] + '/' + cThemeCFGFilename; |
500 WriteLnToConsole('Reading objects info...'); |
496 WriteLnToConsole('Reading objects info...'); |
501 f:= pfsOpenRead(s); |
497 f:= pfsOpenRead(s); |
502 TryDo(f <> nil, 'Bad data or cannot access file ' + cThemeCFGFilename, true); |
498 TryDo(f <> nil, 'Bad data or cannot access file ' + s, true); |
503 |
499 |
504 ThemeObjects.Count:= 0; |
500 ThemeObjects.Count:= 0; |
505 SprayObjects.Count:= 0; |
501 SprayObjects.Count:= 0; |
506 |
502 |
507 while not pfsEOF(f) do |
503 while not pfsEOF(f) do |
707 end |
703 end |
708 else if key = 'flatten-flakes' then |
704 else if key = 'flatten-flakes' then |
709 cFlattenFlakes:= true |
705 cFlattenFlakes:= true |
710 else if key = 'flatten-clouds' then |
706 else if key = 'flatten-clouds' then |
711 cFlattenClouds:= true |
707 cFlattenClouds:= true |
|
708 else if key = 'ice' then |
|
709 cIce:= true |
|
710 else if key = 'snow' then |
|
711 cSnow:= true |
712 else if key = 'sd-water-top' then |
712 else if key = 'sd-water-top' then |
713 begin |
713 begin |
714 i:= Pos(',', s); |
714 i:= Pos(',', s); |
715 SDWaterColorArray[0].r:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
715 SDWaterColorArray[0].r:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
716 Delete(s, 1, i); |
716 Delete(s, 1, i); |