hedgewars/uLandTemplates.pas
author unc0rr
Tue, 27 Jan 2009 15:34:37 +0000
changeset 1773 bc6ad6136675
parent 1761 c7038eade58d
child 1774 3627ba6099ca
permissions -rw-r--r--
nemo's template patch (invertion)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     1
(*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 883
diff changeset
     2
 * Hedgewars, a free turn based strategy game
883
07a568ba44e0 Update copyright info in source files headers
unc0rr
parents: 715
diff changeset
     3
 * Copyright (c) 2005-2008 Andrey Korotaev <unC0Rr@gmail.com>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     4
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     8
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    12
 * GNU General Public License for more details.
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    13
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    15
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 *)
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    19
unit uLandTemplates;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    20
interface
534
92fb2b0d5117 - Fix some bugs
unc0rr
parents: 527
diff changeset
    21
uses SDLh;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    22
{$INCLUDE options.inc}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    23
365
a26cec847dd7 - New land generator feature: islands in the sky
unc0rr
parents: 364
diff changeset
    24
const NTPX = Low(TSDL_Rect.x); 
a26cec847dd7 - New land generator feature: islands in the sky
unc0rr
parents: 364
diff changeset
    25
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    26
type PPointArray = ^TPointArray;
358
236bbd12d4d9 - New Land Generator
unc0rr
parents: 351
diff changeset
    27
     TPointArray = array[0..64] of TSDL_Rect;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    28
     TEdgeTemplate = record
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    29
                     BasePoints: PPointArray;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    30
                     BasePointsCount: Longword;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    31
                     FillPoints: PPointArray;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    32
                     FillPointsCount: Longword;
429
7f69c7ac2e97 One more land template + some templates tuning
unc0rr
parents: 405
diff changeset
    33
                     BezierizeCount: Longword;
364
52cb4d6f84b7 - Better land generator
unc0rr
parents: 360
diff changeset
    34
                     RandPassesCount: Longword;
1773
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    35
                     TemplateHeight, TemplateWidth: LongInt;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    36
                     canMirror, canFlip, isNegative, canInvert: boolean;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    37
                     end;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    38
1753
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    39
//////////////////////////////////////////////////////////////////////////////
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    40
/////////////////// MIRRORED FOUR TIMES //////////////////////////////////////
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    41
//////////////////////////////////////////////////////////////////////////////
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    42
// Hi unC0Rr.  Yeah, I know this is kind of lame.  Real templates should probably
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    43
// be made from scratch for taller/wider area.  But hey, for testing.
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    44
// The first 18 are in all 4 quadrants, the last 18 are in only the bottom 2
1761
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    45
const Template0Points: array[0..37] of TSDL_Rect =
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    46
      (
359
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    47
       (x:  410; y: 1024; w:    1; h:    1),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    48
       (x:  160; y:  760; w:  130; h:  170),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    49
       (x:  342; y:  706; w:  316; h:  150),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    50
       (x:  238; y:  386; w:  270; h:  180),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    51
       (x:  246; y:  176; w:  242; h:  156),
403
282b00e559bd Better templates, giving more different lands
unc0rr
parents: 393
diff changeset
    52
       (x:  552; y:  128; w:  610; h:  300),
282b00e559bd Better templates, giving more different lands
unc0rr
parents: 393
diff changeset
    53
       (x:  750; y:  468; w:  352; h:  324),
359
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    54
       (x:  650; y: 1024; w:  500; h:    1),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    55
       (x: 1250; y: 1100; w:    1; h:    1),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    56
       (x: 1490; y: 1024; w:    1; h:    1),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    57
       (x: 1452; y:  904; w:   74; h:   12),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    58
       (x: 1248; y:  575; w:   68; h:  425),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    59
       (x: 1426; y:  592; w:  140; h:  142),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    60
       (x: 1310; y:  192; w:  150; h:  350),
403
282b00e559bd Better templates, giving more different lands
unc0rr
parents: 393
diff changeset
    61
       (x: 1588; y:  194; w:  148; h:  242),
359
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    62
       (x: 1618; y:  472; w:  276; h:  314),
59fbfc65fbda - New land templates
unc0rr
parents: 358
diff changeset
    63
       (x: 1710; y:  850; w:  130; h:   86),
365
a26cec847dd7 - New land generator feature: islands in the sky
unc0rr
parents: 364
diff changeset
    64
       (x: 1734; y: 1024; w:    1; h:    1),
1753
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    65
       (x: NTPX; y:    0; w:    1; h:    1),
1761
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    66
       (x: 2458; y: 1024; w:    1; h:    1), // X + 2048
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    67
       (x: 2208; y:  760; w:  130; h:  170),
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    68
       (x: 2390; y:  706; w:  316; h:  150),
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    69
       (x: 2286; y:  386; w:  270; h:  180),
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    70
       (x: 2294; y:  176; w:  242; h:  156),
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    71
       (x: 2600; y:  128; w:  610; h:  300),
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    72
       (x: 2798; y:  468; w:  352; h:  324),
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    73
       (x: 2698; y: 1024; w:  500; h:    1),
1753
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    74
       (x: 3298; y: 1100; w:    1; h:    1),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    75
       (x: 3538; y: 1024; w:    1; h:    1),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    76
       (x: 3500; y:  904; w:   74; h:   12),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    77
       (x: 3296; y:  575; w:   68; h:  425),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    78
       (x: 3474; y:  592; w:  140; h:  142),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    79
       (x: 3358; y:  192; w:  150; h:  350),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    80
       (x: 3636; y:  194; w:  148; h:  242),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    81
       (x: 3666; y:  472; w:  276; h:  314),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    82
       (x: 3758; y:  850; w:  130; h:   86),
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    83
       (x: 3782; y: 1024; w:    1; h:    1),
1761
c7038eade58d Fix width/height dependant consts
unc0rr
parents: 1753
diff changeset
    84
       (x: NTPX; y:    0; w:    1; h:    1)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    85
      );
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    86
      Template0FPoints: array[0..0] of TPoint =
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    87
      (
1753
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
    88
       (x: 2047; y:    0)
712
e87cafcf0e2d +1 land template
unc0rr
parents: 711
diff changeset
    89
      );
1773
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    90
const Template1Points: array[0..4] of TSDL_Rect =
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    91
      (
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    92
       (x:  100; y:  100; w:    1; h:    1),
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    93
       (x:  100; y:  100; w: 3000; h: 1500),
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    94
       (x:  500; y:  500; w: 2000; h: 1000),
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    95
       (x: 4000; y: 2000; w:    1; h:    1),
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    96
       (x: NTPX; y:    0; w:    1; h:    1)
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    97
      );
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    98
      Template1FPoints: array[0..0] of TPoint =
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
    99
      (
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   100
       (x: 2047; y:    0)
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   101
      );
711
8ff62133ac48 One more crazy land template
unc0rr
parents: 710
diff changeset
   102
1753
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
   103
//////////////////////////////////////////////////////////////////////////////
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
   104
/////////////////// END MIRRORED TWO TIMES ///////////////////////////////////
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
   105
//////////////////////////////////////////////////////////////////////////////
2ccba26f1aa4 Apply nemo's world resize patch
unc0rr
parents: 1066
diff changeset
   106
1773
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   107
const EdgeTemplates: array[0..1] of TEdgeTemplate =
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   108
      (
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   109
       (BasePoints: @Template0Points;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   110
        BasePointsCount: Succ(High(Template0Points));
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   111
        FillPoints: @Template0FPoints;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   112
        FillPointsCount: Succ(High(Template0FPoints));
431
79ac59673df3 - Two more land templates
unc0rr
parents: 429
diff changeset
   113
        BezierizeCount: 3;
561
19d2d422ff84 Improve land generator
unc0rr
parents: 534
diff changeset
   114
        RandPassesCount: 8;
1773
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   115
        TemplateHeight: 1024; TemplateWidth: 4096;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   116
        canMirror: true; canFlip: false; isNegative: false; canInvert: true;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   117
// Yes. I know this isn't a good map to invert, just testing
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   118
       ),
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   119
       (BasePoints: @Template1Points;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   120
        BasePointsCount: Succ(High(Template1Points));
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   121
        FillPoints: @Template0FPoints;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   122
        FillPointsCount: Succ(High(Template1FPoints));
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   123
        BezierizeCount: 6;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   124
        RandPassesCount: 8;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   125
        TemplateHeight: 2048; TemplateWidth: 4096;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   126
        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
bc6ad6136675 nemo's template patch (invertion)
unc0rr
parents: 1761
diff changeset
   127
// make a decent cave about one time in, oh, 5 or 6 :-/
358
236bbd12d4d9 - New Land Generator
unc0rr
parents: 351
diff changeset
   128
       )
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   129
      );
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   130
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   131
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   132
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   133
implementation
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   134
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   135
end.