From 3295f3c40157c2bc385a903611bfa803a69b617d Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Wed, 5 Aug 2015 22:52:32 +0200 Subject: Fix tiling issues for PLANTLIKE and FIRELIKE with FSAA --- src/script/common/c_content.cpp | 15 +++++++++------ src/script/common/c_content.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/script') diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 42c6889d8..3754fc2ff 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -258,17 +258,20 @@ void push_object_properties(lua_State *L, ObjectProperties *prop) } /******************************************************************************/ -TileDef read_tiledef(lua_State *L, int index) +TileDef read_tiledef(lua_State *L, int index, u8 drawtype) { if(index < 0) index = lua_gettop(L) + 1 + index; TileDef tiledef; - + bool default_tiling = (drawtype == NDT_PLANTLIKE || drawtype == NDT_FIRELIKE) + ? false : true; // key at index -2 and value at index if(lua_isstring(L, index)){ // "default_lava.png" tiledef.name = lua_tostring(L, index); + tiledef.tileable_vertical = default_tiling; + tiledef.tileable_horizontal = default_tiling; } else if(lua_istable(L, index)) { @@ -279,9 +282,9 @@ TileDef read_tiledef(lua_State *L, int index) tiledef.backface_culling = getboolfield_default( L, index, "backface_culling", true); tiledef.tileable_horizontal = getboolfield_default( - L, index, "tileable_horizontal", true); + L, index, "tileable_horizontal", default_tiling); tiledef.tileable_vertical = getboolfield_default( - L, index, "tileable_vertical", true); + L, index, "tileable_vertical", default_tiling); // animation = {} lua_getfield(L, index, "animation"); if(lua_istable(L, -1)){ @@ -357,7 +360,7 @@ ContentFeatures read_content_features(lua_State *L, int index) int i = 0; while(lua_next(L, table) != 0){ // Read tiledef from value - f.tiledef[i] = read_tiledef(L, -1); + f.tiledef[i] = read_tiledef(L, -1, f.drawtype); // removes value, keeps key for next iteration lua_pop(L, 1); i++; @@ -392,7 +395,7 @@ ContentFeatures read_content_features(lua_State *L, int index) int i = 0; while(lua_next(L, table) != 0){ // Read tiledef from value - f.tiledef_special[i] = read_tiledef(L, -1); + f.tiledef_special[i] = read_tiledef(L, -1, f.drawtype); // removes value, keeps key for next iteration lua_pop(L, 1); i++; diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h index 4547009e7..46416ad8e 100644 --- a/src/script/common/c_content.h +++ b/src/script/common/c_content.h @@ -63,7 +63,8 @@ class Schematic; ContentFeatures read_content_features (lua_State *L, int index); -TileDef read_tiledef (lua_State *L, int index); +TileDef read_tiledef (lua_State *L, int index, + u8 drawtype); void read_soundspec (lua_State *L, int index, SimpleSoundSpec &spec); NodeBox read_nodebox (lua_State *L, int index); -- cgit v1.2.3 d class='linenumbers'>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="512"
   height="512"
   viewBox="0 0 135.46666 135.46667"
   version="1.1"
   id="svg8"
   inkscape:version="0.92.1 r15371"
   sodipodi:docname="drop_btn.svg"
   inkscape:export-filename="/home/stu/Desktop/icons/png/drop_btn.png"
   inkscape:export-xdpi="24.000002"
   inkscape:export-ydpi="24.000002">
  <defs
     id="defs2">
    <filter
       style="color-interpolation-filters:sRGB;"
       inkscape:label="Colorize"
       id="filter4628">
      <feComposite
         in2="SourceGraphic"
         operator="arithmetic"
         k1="0"
         k2="1"
         result="composite1"
         id="feComposite4614" />
      <feColorMatrix
         in="composite1"
         values="1"
         type="saturate"
         result="colormatrix1"
         id="feColorMatrix4616" />
      <feFlood
         flood-opacity="1"
         flood-color="rgb(158,0,0)"
         result="flood1"
         id="feFlood4618" />
      <feBlend
         in="flood1"
         in2="colormatrix1"
         mode="multiply"
         result="blend1"
         id="feBlend4620" />
      <feBlend
         in2="blend1"
         mode="screen"
         result="blend2"
         id="feBlend4622" />
      <feColorMatrix
         in="blend2"
         values="1"
         type="saturate"
         result="colormatrix2"
         id="feColorMatrix4624" />
      <feComposite
         in="colormatrix2"
         in2="SourceGraphic"
         operator="in"
         k2="1"
         result="composite2"
         id="feComposite4626" />
    </filter>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#404040"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.49497475"
     inkscape:cx="-435.15132"
     inkscape:cy="209.28829"
     inkscape:document-units="mm"
     inkscape:current-layer="layer2"
     showgrid="true"
     units="px"
     inkscape:window-width="1920"
     inkscape:window-height="1023"
     inkscape:window-x="0"
     inkscape:window-y="34"
     inkscape:window-maximized="1"
     inkscape:pagecheckerboard="false"
     inkscape:snap-grids="true"
     inkscape:snap-page="true"
     showguides="false">
    <inkscape:grid
       type="xygrid"
       id="grid16"
       spacingx="0.26458333"
       spacingy="0.26458333"
       empspacing="4"
       color="#40ff40"
       opacity="0.1254902"
       empcolor="#40ff40"
       empopacity="0.25098039" />
  </sodipodi:namedview>
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
        <cc:license
           rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
      </cc:Work>
      <cc:License
         rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
        <cc:permits
           rdf:resource="http://creativecommons.org/ns#Reproduction" />
        <cc:permits
           rdf:resource="http://creativecommons.org/ns#Distribution" />
        <cc:requires
           rdf:resource="http://creativecommons.org/ns#Notice" />
        <cc:requires
           rdf:resource="http://creativecommons.org/ns#Attribution" />
        <cc:permits
           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
        <cc:requires
           rdf:resource="http://creativecommons.org/ns#ShareAlike" />
      </cc:License>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:groupmode="layer"
     id="layer2"
     inkscape:label="Layer 2"
     style="display:inline">
    <path
       style="fill:#ffffff;fill-opacity:0.50196078;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="m 21.166666,29.761616 21.166667,-7.055555 21.166666,7.055555 -21.166666,8.338385 z"
       id="path4693"
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="ccccc" />
    <path
       style="fill:#ffffff;fill-opacity:0.25098039;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="m 21.166666,30.40303 v 26.939394 l 21.166667,7.69697 V 38.099999 Z"
       id="path4699"
       inkscape:connector-curvature="0" />
    <path
       style="fill:#ffffff;fill-opacity:0.0627451;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="m 42.333333,38.099999 v 26.939395 l 21.166666,-7.69697 V 30.40303 Z"
       id="path4701"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="M 110.06667,110.06667 H 67.733332"
       id="path4727"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="m 88.899999,97.366665 0,-16.933331 C 89.263773,55.921256 75.773505,47.130445 55.033333,46.566666"
       id="path4729"
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="ccc" />
    <path
       style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="m 101.6,84.666667 -12.700001,12.699998 -12.7,-12.699998"
       id="path4737"
       inkscape:connector-curvature="0" />
  </g>
</svg>