481 if SDL_MustLock(tmpsurf) then |
481 if SDL_MustLock(tmpsurf) then |
482 SDLTry(SDL_LockSurface(tmpsurf) >= 0, true); |
482 SDLTry(SDL_LockSurface(tmpsurf) >= 0, true); |
483 |
483 |
484 p:= tmpsurf^.pixels; |
484 p:= tmpsurf^.pixels; |
485 for y:= 0 to Pred(tmpsurf^.h) do |
485 for y:= 0 to Pred(tmpsurf^.h) do |
486 begin |
486 begin |
487 for x:= 0 to Pred(tmpsurf^.w) do |
487 for x:= 0 to Pred(tmpsurf^.w) do |
488 begin |
488 SetLand(Land[cpY + y, cpX + x], p^[x]); |
489 // this an if instead of masking colours to avoid confusing map creators |
489 p:= @(p^[tmpsurf^.pitch div 4]); |
490 if ((AMask and p^[x]) = 0) then |
|
491 Land[cpY + y, cpX + x]:= 0 |
|
492 else if p^[x] = $FFFFFFFF then // white |
|
493 Land[cpY + y, cpX + x]:= lfObject |
|
494 else if p^[x] = AMask then // black |
|
495 begin |
|
496 Land[cpY + y, cpX + x]:= lfBasic; |
|
497 disableLandBack:= false |
|
498 end |
|
499 else if p^[x] = (AMask or RMask) then // red |
|
500 Land[cpY + y, cpX + x]:= lfIndestructible |
|
501 else if p^[x] = (AMask or BMask) then // blue |
|
502 Land[cpY + y, cpX + x]:= lfObject or lfIce |
|
503 else if p^[x] = (AMask or GMask) then // green |
|
504 Land[cpY + y, cpX + x]:= lfObject or lfBouncy |
|
505 end; |
490 end; |
506 p:= @(p^[tmpsurf^.pitch div 4]); |
|
507 end; |
|
508 |
491 |
509 if SDL_MustLock(tmpsurf) then |
492 if SDL_MustLock(tmpsurf) then |
510 SDL_UnlockSurface(tmpsurf); |
493 SDL_UnlockSurface(tmpsurf); |
511 if not disableLandBack then |
494 if not disableLandBack then |
512 begin |
495 begin |