changeset 2376 | ece7b87f1334 |
parent 2275 | 3f56c99a70f8 |
child 2592 | d86618629e20 |
2375:99f05a01a6a3 | 2376:ece7b87f1334 |
---|---|
25 procedure LoadThemeConfig; |
25 procedure LoadThemeConfig; |
26 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); |
26 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); |
27 procedure AddOnLandObjects(Surface: PSDL_Surface); |
27 procedure AddOnLandObjects(Surface: PSDL_Surface); |
28 |
28 |
29 implementation |
29 implementation |
30 uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, |
30 uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, |
31 {$IFDEF GLES11} |
31 {$IFDEF GLES11} |
32 gles11, |
32 gles11, |
33 {$ELSE} |
33 {$ELSE} |
34 GL, |
34 GL, |
35 {$ENDIF} |
35 {$ENDIF} |
160 y:= topY+150; |
160 y:= topY+150; |
161 repeat |
161 repeat |
162 inc(y, 24); |
162 inc(y, 24); |
163 x1:= gX; |
163 x1:= gX; |
164 x2:= gX; |
164 x2:= gX; |
165 |
165 |
166 while (x1 > Longint(leftX)+150) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2); |
166 while (x1 > Longint(leftX)+150) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2); |
167 |
167 |
168 i:= x1 - 12; |
168 i:= x1 - 12; |
169 repeat |
169 repeat |
170 dec(x1, 2); |
170 dec(x1, 2); |
171 k:= CountNonZeroz(x1, y) |
171 k:= CountNonZeroz(x1, y) |
172 until (x1 < Longint(leftX)+150) or (k = 0) or (k = 16) or (x1 < i); |
172 until (x1 < Longint(leftX)+150) or (k = 0) or (k = 16) or (x1 < i); |
173 |
173 |
174 inc(x1, 2); |
174 inc(x1, 2); |
175 if k = 16 then |
175 if k = 16 then |
176 begin |
176 begin |
177 while (x2 < (rightX-150)) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2); |
177 while (x2 < (rightX-150)) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2); |
178 i:= x2 + 12; |
178 i:= x2 + 12; |
189 if x1 > 0 then |
189 if x1 > 0 then |
190 begin |
190 begin |
191 Result:= true; |
191 Result:= true; |
192 tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Girder', ifTransparent or ifIgnoreCaps); |
192 tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Girder', ifTransparent or ifIgnoreCaps); |
193 if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', ifCritical or ifTransparent or ifIgnoreCaps); |
193 if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', ifCritical or ifTransparent or ifIgnoreCaps); |
194 |
194 |
195 rr.x:= x1; |
195 rr.x:= x1; |
196 while rr.x < x2 do |
196 while rr.x < x2 do |
197 begin |
197 begin |
198 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); |
198 BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); |
199 inc(rr.x, tmpsurf^.w); |
199 inc(rr.x, tmpsurf^.w); |
200 end; |
200 end; |
201 SDL_FreeSurface(tmpsurf); |
201 SDL_FreeSurface(tmpsurf); |
202 |
202 |
203 AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80); |
203 AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80); |
204 end else Result:= false; |
204 end else Result:= false; |
205 |
205 |
206 AddGirder:= Result |
206 AddGirder:= Result |
207 end; |
207 end; |