equal
deleted
inserted
replaced
23 uses SDLh; |
23 uses SDLh; |
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); |
28 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word = 0); |
29 procedure AddOnLandObjects(Surface: PSDL_Surface); |
29 procedure AddOnLandObjects(Surface: PSDL_Surface); |
30 |
30 |
31 implementation |
31 implementation |
32 uses uStore, uConsts, uConsole, uRandom, uSound, GLunit, |
32 uses uStore, uConsts, uConsole, uRandom, uSound, GLunit, |
33 uTypes, uVariables, uUtils, uDebug, sysutils; |
33 uTypes, uVariables, uUtils, uDebug, sysutils; |
64 RectCount: Longword; |
64 RectCount: Longword; |
65 ThemeObjects: TThemeObjects; |
65 ThemeObjects: TThemeObjects; |
66 SprayObjects: TSprayObjects; |
66 SprayObjects: TSprayObjects; |
67 |
67 |
68 |
68 |
69 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); |
69 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word = 0); |
70 var p: PLongwordArray; |
70 var p: PLongwordArray; |
71 x, y: Longword; |
71 x, y: Longword; |
72 bpp: LongInt; |
72 bpp: LongInt; |
73 begin |
73 begin |
74 WriteToConsole('Generating collision info... '); |
74 WriteToConsole('Generating collision info... '); |
94 end |
94 end |
95 else |
95 else |
96 if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then |
96 if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then |
97 LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; |
97 LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; |
98 |
98 |
|
99 |
99 if ((Land[cpY + y, cpX + x] and $FF00) = 0) and ((p^[x] and AMask) <> 0) then |
100 if ((Land[cpY + y, cpX + x] and $FF00) = 0) and ((p^[x] and AMask) <> 0) then |
100 Land[cpY + y, cpX + x]:= lfObject |
101 begin |
|
102 Land[cpY + y, cpX + x]:= lfObject; |
|
103 Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or extraFlags |
|
104 end; |
101 end; |
105 end; |
102 p:= @(p^[Image^.pitch shr 2]) |
106 p:= @(p^[Image^.pitch shr 2]) |
103 end; |
107 end; |
104 |
108 |
105 if SDL_MustLock(Image) then |
109 if SDL_MustLock(Image) then |
202 if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', ifCritical or ifTransparent or ifIgnoreCaps); |
206 if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', ifCritical or ifTransparent or ifIgnoreCaps); |
203 |
207 |
204 rr.x:= x1; |
208 rr.x:= x1; |
205 while rr.x < x2 do |
209 while rr.x < x2 do |
206 begin |
210 begin |
207 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); |
211 // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun |
|
212 if (Theme = 'Snow') or (Theme = 'Christmas') then |
|
213 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf, lfIce) |
|
214 else |
|
215 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); |
208 inc(rr.x, tmpsurf^.w); |
216 inc(rr.x, tmpsurf^.w); |
209 end; |
217 end; |
210 SDL_FreeSurface(tmpsurf); |
218 SDL_FreeSurface(tmpsurf); |
211 |
219 |
212 AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80); |
220 AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80); |