645 |
645 |
646 |
646 |
647 procedure CheckRect(Width, Height, x, y, w, h: LongWord); |
647 procedure CheckRect(Width, Height, x, y, w, h: LongWord); |
648 begin |
648 begin |
649 if (x + w > Width) then |
649 if (x + w > Width) then |
650 OutError('Object''s rectangle exceeds image: x + w (' + inttostr(x) + ' + ' + inttostr(w) + ') > Width (' + inttostr(Width) + ')', true); |
650 OutError('Broken theme. Object''s rectangle exceeds image: x + w (' + inttostr(x) + ' + ' + inttostr(w) + ') > Width (' + inttostr(Width) + ')', true); |
651 if (y + h > Height) then |
651 if (y + h > Height) then |
652 OutError('Object''s rectangle exceeds image: y + h (' + inttostr(y) + ' + ' + inttostr(h) + ') > Height (' + inttostr(Height) + ')', true); |
652 OutError('Broken theme. Object''s rectangle exceeds image: y + h (' + inttostr(y) + ' + ' + inttostr(h) + ') > Height (' + inttostr(Height) + ')', true); |
653 end; |
653 end; |
654 |
654 |
655 procedure ReadRect(var rect: TSDL_Rect; var s: ShortString); |
655 procedure ReadRect(var rect: TSDL_Rect; var s: ShortString); |
656 var i: LongInt; |
656 var i: LongInt; |
657 begin |
657 begin |
899 Delete(s, 1, i); |
899 Delete(s, 1, i); |
900 i:= Pos(',', s); |
900 i:= Pos(',', s); |
901 Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
901 Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
902 Delete(s, 1, i); |
902 Delete(s, 1, i); |
903 if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then |
903 if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then |
904 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true); |
904 OutError('Broken theme. Object''s max. count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true); |
905 ChecksumLandObjectImage(Surf); |
905 ChecksumLandObjectImage(Surf); |
906 ChecksumLandObjectImage(Mask); |
906 ChecksumLandObjectImage(Mask); |
907 |
907 |
908 inrectcnt := 0; |
908 inrectcnt := 0; |
909 |
909 |
918 inrectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
918 inrectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
919 Delete(s, 1, i); |
919 Delete(s, 1, i); |
920 end; |
920 end; |
921 |
921 |
922 if inrectcnt > MAXOBJECTRECTS then |
922 if inrectcnt > MAXOBJECTRECTS then |
923 OutError('Object''s inland rectangle count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(inrectcnt) +').', true); |
923 OutError('Broken theme. Object''s inland rectangle count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(inrectcnt) +').', true); |
924 |
924 |
925 for ii:= 0 to Pred(inrectcnt) do |
925 for ii:= 0 to Pred(inrectcnt) do |
926 ReadRect(inland[ii], s); |
926 ReadRect(inland[ii], s); |
927 |
927 |
928 i:= Pos(',', s); |
928 i:= Pos(',', s); |
929 outrectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
929 outrectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
930 Delete(s, 1, i); |
930 Delete(s, 1, i); |
931 |
931 |
932 if outrectcnt > MAXOBJECTRECTS then |
932 if outrectcnt > MAXOBJECTRECTS then |
933 OutError('Object''s outland rectangle count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(outrectcnt) +').', true); |
933 OutError('Broken theme. Object''s outland rectangle count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(outrectcnt) +').', true); |
934 |
934 |
935 for ii:= 0 to Pred(outrectcnt) do |
935 for ii:= 0 to Pred(outrectcnt) do |
936 ReadRect(outland[ii], s); |
936 ReadRect(outland[ii], s); |
937 end; |
937 end; |
938 end |
938 end |
942 nameRef:= Trim(Copy(s, 1, Pred(i))); |
942 nameRef:= Trim(Copy(s, 1, Pred(i))); |
943 for ii:= 0 to Pred(ThemeObjects.Count) do |
943 for ii:= 0 to Pred(ThemeObjects.Count) do |
944 if ThemeObjects.objs[ii].Name = nameRef then with ThemeObjects.objs[ii] do |
944 if ThemeObjects.objs[ii].Name = nameRef then with ThemeObjects.objs[ii] do |
945 begin |
945 begin |
946 if anchorcnt <> 0 then |
946 if anchorcnt <> 0 then |
947 OutError('Duplicate anchors declaration for ' + nameRef, true); |
947 OutError('Broken theme. Duplicate anchors declaration for object ' + nameRef, true); |
948 Delete(s, 1, i); |
948 Delete(s, 1, i); |
949 i:= Pos(',', s); |
949 i:= Pos(',', s); |
950 anchorcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
950 anchorcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
951 Delete(s, 1, i); |
951 Delete(s, 1, i); |
952 if anchorcnt > MAXOBJECTRECTS then |
952 if anchorcnt > MAXOBJECTRECTS then |
953 OutError('Object''s anchor rectangle count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(anchorcnt) +').', true); |
953 OutError('Broken theme. Object''s anchor rectangle count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(anchorcnt) +').', true); |
954 for t:= 0 to Pred(anchorcnt) do |
954 for t:= 0 to Pred(anchorcnt) do |
955 ReadRect(anchors[t], s); |
955 ReadRect(anchors[t], s); |
956 break |
956 break |
957 end; |
957 end; |
958 end |
958 end |
962 nameRef:= Trim(Copy(s, 1, Pred(i))); |
962 nameRef:= Trim(Copy(s, 1, Pred(i))); |
963 for ii:= 0 to Pred(ThemeObjects.Count) do |
963 for ii:= 0 to Pred(ThemeObjects.Count) do |
964 if ThemeObjects.objs[ii].Name = nameRef then with ThemeObjects.objs[ii] do |
964 if ThemeObjects.objs[ii].Name = nameRef then with ThemeObjects.objs[ii] do |
965 begin |
965 begin |
966 if overlaycnt <> 0 then |
966 if overlaycnt <> 0 then |
967 OutError('Duplicate overlays declaration for ' + nameRef, true); |
967 OutError('Broken theme. Duplicate overlays declaration for object ' + nameRef, true); |
968 Delete(s, 1, i); |
968 Delete(s, 1, i); |
969 i:= Pos(',', s); |
969 i:= Pos(',', s); |
970 overlaycnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
970 overlaycnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
971 Delete(s, 1, i); |
971 Delete(s, 1, i); |
972 if overlaycnt > MAXOBJECTRECTS then |
972 if overlaycnt > MAXOBJECTRECTS then |
973 OutError('Object''s overlay count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(overlaycnt) +').', true); |
973 OutError('Broken theme. Object''s overlay count should be no more than '+ inttostr(MAXOBJECTRECTS) +' (it was '+ inttostr(overlaycnt) +').', true); |
974 for t:= 0 to Pred(overlaycnt) do |
974 for t:= 0 to Pred(overlaycnt) do |
975 ReadOverlay(overlays[t], s); |
975 ReadOverlay(overlays[t], s); |
976 break |
976 break |
977 end; |
977 end; |
978 end |
978 end |