equal
deleted
inserted
replaced
23 type TLandArray = packed array[0..1023, 0..2047] of LongWord; |
23 type TLandArray = packed array[0..1023, 0..2047] of LongWord; |
24 TPreview = packed array[0..127, 0..31] of byte; |
24 TPreview = packed array[0..127, 0..31] of byte; |
25 |
25 |
26 var Land: TLandArray; |
26 var Land: TLandArray; |
27 LandSurface: PSDL_Surface; |
27 LandSurface: PSDL_Surface; |
28 LandTexture: PTexture; |
28 LandTexture: PTexture = nil; |
29 |
29 |
30 procedure GenMap; |
30 procedure GenMap; |
31 function GenPreview: TPreview; |
31 function GenPreview: TPreview; |
32 procedure CheckLandDigest(s: shortstring); |
32 procedure CheckLandDigest(s: shortstring); |
|
33 procedure UpdateLandTexture; |
33 |
34 |
34 implementation |
35 implementation |
35 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO; |
36 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO; |
36 |
37 |
37 type TPixAr = record |
38 type TPixAr = record |
530 AddProgress; |
531 AddProgress; |
531 SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0); |
532 SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0); |
532 AddObjects(tmpsurf, LandSurface); |
533 AddObjects(tmpsurf, LandSurface); |
533 SDL_FreeSurface(tmpsurf); |
534 SDL_FreeSurface(tmpsurf); |
534 |
535 |
535 LandTexture:= Surface2Tex(LandSurface); |
536 UpdateLandTexture; |
536 AddProgress |
537 AddProgress |
537 end; |
538 end; |
538 |
539 |
539 procedure MakeFortsMap; |
540 procedure MakeFortsMap; |
540 var tmpsurf: PSDL_Surface; |
541 var tmpsurf: PSDL_Surface; |
552 |
553 |
553 tmpsurf:= LoadImage(Pathz[ptForts] + '/' + TeamsArray[1]^.FortName + 'R', false, true, true); |
554 tmpsurf:= LoadImage(Pathz[ptForts] + '/' + TeamsArray[1]^.FortName + 'R', false, true, true); |
554 BlitImageAndGenerateCollisionInfo(1024, 0, tmpsurf, LandSurface); |
555 BlitImageAndGenerateCollisionInfo(1024, 0, tmpsurf, LandSurface); |
555 SDL_FreeSurface(tmpsurf); |
556 SDL_FreeSurface(tmpsurf); |
556 |
557 |
557 LandTexture:= Surface2Tex(LandSurface) |
558 UpdateLandTexture |
558 end; |
559 end; |
559 |
560 |
560 procedure LoadMap; |
561 procedure LoadMap; |
561 var x, y: Longword; |
562 var x, y: Longword; |
562 p: PByteArray; |
563 p: PByteArray; |
590 end; |
591 end; |
591 |
592 |
592 if SDL_MustLock(LandSurface) then |
593 if SDL_MustLock(LandSurface) then |
593 SDL_UnlockSurface(LandSurface); |
594 SDL_UnlockSurface(LandSurface); |
594 |
595 |
595 LandTexture:= Surface2Tex(LandSurface) |
596 UpdateLandTexture |
596 end; |
597 end; |
597 |
598 |
598 procedure GenMap; |
599 procedure GenMap; |
599 begin |
600 begin |
600 if (GameFlags and gfForts) = 0 then |
601 if (GameFlags and gfForts) = 0 then |
626 end |
627 end |
627 end; |
628 end; |
628 GenPreview:= Preview |
629 GenPreview:= Preview |
629 end; |
630 end; |
630 |
631 |
|
632 procedure UpdateLandTexture; |
|
633 begin |
|
634 if LandTexture <> nil then FreeTexture(LandTexture); |
|
635 LandTexture:= Surface2Tex(LandSurface) |
|
636 end; |
|
637 |
631 initialization |
638 initialization |
632 |
639 |
633 end. |
640 end. |