1#
2#   Copyright <=2004 by Immanuel Halupczok
3#   Modified 2005,2006,2014 by Immanuel Halupczok
4#   Maintenance modifications 2005,2006,2011,2014 by the cuyo developers
5#
6#   This program is free software; you can redistribute it and/or modify
7#   it under the terms of the GNU General Public License as published by
8#   the Free Software Foundation; either version 2 of the License, or
9#   (at your option) any later version.
10#
11#   This program is distributed in the hope that it will be useful,
12#   but WITHOUT ANY WARRANTY; without even the implied warranty of
13#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#   GNU General Public License for more details.
15#
16#   You should have received a copy of the GNU General Public License
17#   along with this program; if not, write to the Free Software
18#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19#
20# The above notices apply to this file and to:
21#   iwaBad.xpm[.gz], iwaBeton.xpm[.gz], iwaNix.xpm[.gz], iwaObjekte.xpm[.gz],
22#   iwaParkett.xpm[.gz], iwaTeppich.xpm[.gz],
23#   iwaAlles.xcf
24#
25
26Walls = {
27
28  name = "Walls"
29  author = "Immi"
30  description = "Floors don't connect through walls."
31  startpic = gras
32  pics=bad,parkett,teppich
33  #pics[1]=gruen,gelb,rosa,orange
34  randomgreys[1]=60
35  numexplode = 4
36  numexplode[1] = 5
37
38  bgcolor = 112,110,104
39
40  startdist="++++++++++","AAAAAAAAAA"
41
42#pics=inGruen.xpm
43#numexplode = 200
44#startdist="AAAAAAAAAA","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++","++++++++++"
45  greypic=grau
46  nogreyprob=1
47  emptypic=leer
48
49  <<
50
51  var wob, wun, wli, wre;  # Wand
52  var plo; # Pfosten links oben
53  var vob, vun, vli, vre;  # Verbindung
54  var dy;
55  var xx, yy, sp_h, sp_v;
56  var wand;
57
58  initWaende = {
59    wob = 0; wli = 0; wre = 0; wun = 0;
60  };
61
62  korrigierexxyy = {
63    yy += dy@@;
64    if loc_p == 1 -> {
65      sp_h = 0;
66    } else -> {
67      xx = 9 - xx;
68      sp_h = 1;
69    };
70    if yy > 19 -> {
71      yy = 39 - yy;
72      xx = 9 - xx;
73      sp_h = 1 - sp_h;
74      sp_v = 1;
75    } else -> {
76      sp_v = 0;
77    };
78  };
79
80  # vorher xx,yy setzen
81  getWandOben = {
82    wand = 0;
83    yy += dy@@;
84    if loc_p == 2 -> xx = 9 - xx;
85    if yy > 19 -> {
86      yy = 40 - yy;
87      xx = 9 - xx;
88    };
89    switch {
90      yy == 20 -> if xx == 1 || xx == 4 || xx == 5 || xx == 8 -> wand = 1;
91      yy == 19 -> if xx == 2 || xx == 3 || xx == 5 ||
92                     xx == 6 || xx == 9                       -> wand = 1;
93      yy == 18 -> if xx == 1 || xx == 3 || xx == 4 ||
94                     xx == 7 || xx == 8                       -> wand = 1;
95      yy == 17 -> if xx == 0 || xx == 2 || xx == 5 || xx == 9 -> wand = 1;
96      yy == 16 -> if xx == 5                                  -> wand = 1;
97      yy == 15 -> if xx == 6                                  -> wand = 1;
98      yy == 14 -> if xx == 1 || xx == 8                       -> wand = 1;
99      yy == 13 -> if xx == 4                                  -> wand = 1;
100      yy == 12 -> if xx == 7                                  -> wand = 1;
101      yy == 11 -> if xx == 6                                  -> wand = 1;
102      yy == 10 -> if xx == 9                                  -> wand = 1;
103    };
104  };
105
106  # vorher xx,yy setzen
107  getWandLinks = {
108    if xx == 0 || xx == 10 -> wand = 1
109    else -> {
110      wand = 0;
111      yy += dy@@;
112      if loc_p == 2 -> xx = 10 - xx;
113      if yy > 19 -> {
114	yy = 39 - yy;
115	xx = 10 - xx;
116      };
117      switch {
118	yy == 19 -> if xx == 1 || xx == 3 || xx == 8            -> wand = 1;
119	yy == 18 -> if xx == 1 || xx == 7                       -> wand = 1;
120	yy == 17 -> if xx == 6                                  -> wand = 1;
121	yy == 16 -> if xx == 2 || xx == 4 || xx == 7 || xx == 9 -> wand = 1;
122	yy == 15 -> if xx == 1 || xx == 4 || xx == 8            -> wand = 1;
123	yy == 14 -> if xx == 3 || xx == 5                       -> wand = 1;
124	yy == 13 -> if xx == 7                                  -> wand = 1;
125  #      yy == 12 -> if xx == 3                                  -> wand = 1;
126	yy == 11 -> if xx == 3                                  -> wand = 1;
127	yy == 10 -> if xx == 1                                  -> wand = 1;
128      };
129    };
130  };
131
132  checkWaende = {
133    initWaende;
134
135    if !informational -> {
136      xx = loc_x; yy = loc_y; getWandLinks; wli = wand;
137      xx = loc_x+1; yy = loc_y; getWandLinks; wre = wand;
138      xx = loc_x; yy = loc_y; getWandOben; wob = wand;
139      xx = loc_x; yy = loc_y+1; getWandOben; wun = wand;
140      if wli || wob -> plo = 1 else -> {
141	xx = loc_x; yy = loc_y-1; getWandLinks;
142	if wand -> plo = 1 else -> {
143	  xx = loc_x-1; yy = loc_y; getWandOben;
144	  plo = wand;
145	}
146      };
147    #} else -> {
148    #  wli = 1; wre = 1; wob = 1; wun = 1;
149    };
150  };
151
152  #malWaende = {
153  #  1D*;
154  #  if wli -> B*;
155  #  if wre -> A*;
156  #  if wob -> E*;
157  #  if wun -> C*;
158  #};
159
160  meinConnect = {
161    checkWaende;
162    inhibit = 0;
163    if wob -> inhibit += DIR_U;
164    if wun -> inhibit += DIR_D;
165    if wli -> inhibit += DIR_L;
166    if wre -> inhibit += DIR_R;
167  };
168
169  #meinBlobAlt = {
170  #  if falling -> {initWaende;}
171  #  else       -> {checkWaende;malWaende;};
172#
173#    vob = !wob && (kind == kind@(0,-1) ||
174#                   kind == nothing && kind@(0,-1) == outside);
175#    vun = !wun && kind == kind@(0,1);
176#    vli = !wli && kind == kind@(-1,0);
177#    vre = !wre && kind == kind@(1,0);
178#
179#    if vli -> pos = 3 - vre else pos = vre;
180#    if vob -> pos += 12 - 4 * vun else pos += 4 * vun;
181#    0*;
182#  };
183
184
185  meinBlop = {
186    if falling -> 0J*
187    else -> {
188      # W�nde bestimmen
189      checkWaende;
190
191      # Verbindungen bestimmen
192      vob = !wob && (kind == kind@(0,-1) ||
193                     kind == nothing && kind@(0,-1) == outside);
194      vun = !wun && kind == kind@(0,1);
195      vli = !wli && kind == kind@(-1,0);
196      vre = !wre && kind == kind@(1,0);
197
198      # Verbindungen (Boden) malen
199      0;
200      [qu=Q_TL] [pos =       vli + 2*wli + 3*vob + 6*wob] *;
201      [qu=Q_TR] [pos = 2 - 2*vre -   wre + 3*vob + 6*wob] *;
202      [qu=Q_BL] [pos = 6 +   vli + 2*wli - 6*vun - 3*wun] *;
203      [qu=Q_BR] [pos = 8 - 2*vre -   wre - 6*vun - 3*wun] *;
204
205      # W�nde malen
206      # malWaende;
207
208      # Mittelpfosten entfernen
209      if !plo && vli && vob && (kind == kind@(-1,-1) ||
210                       kind == nothing && kind@(-1,-1) == outside) -> {
211        0K;
212        [qu=Q_BR_TL] *@(0,0);
213        [qu=Q_BL_TR] *@(-1,0);
214        [qu=Q_TR_BL] *@(0,-1);
215        [qu=Q_TL_BR] *@(-1,-1);
216      };
217      if informational -> 0K*;
218    };
219
220
221
222  };
223
224  bad.connect = meinConnect;
225  bad = meinBlop;
226
227  parkett = meinBlop;
228  parkett.connect = meinConnect;
229
230  teppich = meinBlop;
231  teppich.connect = meinConnect;
232
233  grau = meinBlop;
234
235  gras.init = { version = rnd(4); };
236  gras = {
237    meinBlop;
238    pos = version; 1*;
239  };
240
241  leer = meinBlop;
242
243
244  semiglobal.row_up = { dy+=1; };
245  semiglobal.row_down = { dy-=1; };
246  >>
247
248  bad={
249    pics=iwaBad.xpm
250  }
251  parkett={
252    pics=iwaParkett.xpm
253  }
254  teppich={
255    pics=iwaTeppich.xpm
256  }
257  grau={
258    pics=iwaBeton.xpm
259  }
260  gras={
261    pics=iwaBeton.xpm,iwaObjekte.xpm
262  }
263  leer={
264    pics=iwaNix.xpm
265  }
266}
267
268