Cube  Diff

Differences From Artifact [1c146ff92c]:

To Artifact [25a7c9cd46]:


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
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







+



-


-
+


-
-
+
+


-
-
+
+


-
-
+
+


-
+



-
-
-
+
+
+





-






+







		for (int y = y1; y <= y2; y++) {
			// collide with map
			if (OUTBORD(x, y))
				return false;
			struct sqr *s = S(x, y);
			float ceil = s->ceil;
			float floor = s->floor;

			switch (s->type) {
			case SOLID:
				return false;

			case CORNER: {
				int bx = x, by = y, bs = 1;
				if (x == x1 && y == y1 &&
				if ((x == x1 && y == y1 &&
				        cornertest(
				            0, x, y, -1, -1, &bx, &by, &bs) &&
				        fx1 - bx + fy1 - by <= bs ||
				    x == x2 && y == y1 &&
				        fx1 - bx + fy1 - by <= bs) ||
				    (x == x2 && y == y1 &&
				        cornertest(
				            0, x, y, 1, -1, &bx, &by, &bs) &&
				        fx2 - bx >= fy1 - by ||
				    x == x1 && y == y2 &&
				        fx2 - bx >= fy1 - by) ||
				    (x == x1 && y == y2 &&
				        cornertest(
				            0, x, y, -1, 1, &bx, &by, &bs) &&
				        fx1 - bx <= fy2 - by ||
				    x == x2 && y == y2 &&
				        fx1 - bx <= fy2 - by) ||
				    (x == x2 && y == y2 &&
				        cornertest(
				            0, x, y, 1, 1, &bx, &by, &bs) &&
				        fx2 - bx + fy2 - by >= bs)
				        fx2 - bx + fy2 - by >= bs))
					return false;
				break;
			}

			case FHF: // FIXME: too simplistic collision with
			          // slopes, makes it feels like tiny stairs
			// FIXME: too simplistic collision with slopes, makes
			// it feels like tiny stairs
			case FHF:
				floor -= (s->vdelta + S(x + 1, y)->vdelta +
				             S(x, y + 1)->vdelta +
				             S(x + 1, y + 1)->vdelta) /
				    16.0f;
				break;

			case CHF:
				ceil += (s->vdelta + S(x + 1, y)->vdelta +
				            S(x, y + 1)->vdelta +
				            S(x + 1, y + 1)->vdelta) /
				    16.0f;
			}

			if (ceil < hi)
				hi = ceil;
			if (floor > lo)
				lo = floor;
			if (floor < minfloor)
				return false;
		}