… | |
… | |
144 | } |
144 | } |
145 | |
145 | |
146 | static void |
146 | static void |
147 | layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) |
147 | layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) |
148 | { |
148 | { |
|
|
149 | PangoRectangle rect; |
|
|
150 | |
|
|
151 | // get_pixel_* wrongly rounds down |
149 | pango_layout_get_pixel_size (self->pl, w, h); |
152 | pango_layout_get_extents (self->pl, 0, &rect); |
150 | |
153 | |
151 | if (!*w) *w = 1; |
154 | rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE; |
152 | if (!*h) *h = 1; |
155 | rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE; |
153 | |
156 | |
154 | *w = (*w + 3) & ~3; |
157 | if (!rect.width) rect.width = 1; |
|
|
158 | if (!rect.height) rect.height = 1; |
|
|
159 | |
|
|
160 | *w = rect.width; |
|
|
161 | *h = rect.height; |
155 | } |
162 | } |
156 | |
163 | |
157 | typedef uint16_t mapface; |
164 | typedef uint16_t mapface; |
158 | |
165 | |
159 | typedef struct { |
166 | typedef struct { |
… | |
… | |
1253 | self->y += MAP_EXTEND_Y; |
1260 | self->y += MAP_EXTEND_Y; |
1254 | } |
1261 | } |
1255 | } |
1262 | } |
1256 | |
1263 | |
1257 | void |
1264 | void |
1258 | map1a_update (CFPlus::Map self, SV *data_) |
1265 | map1a_update (CFPlus::Map self, SV *data_, int extmap) |
1259 | CODE: |
1266 | CODE: |
1260 | { |
1267 | { |
1261 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1268 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1262 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1269 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1263 | mapcell *cell; |
1270 | mapcell *cell; |
… | |
… | |
1280 | cell->face [0] = 0; |
1287 | cell->face [0] = 0; |
1281 | cell->face [1] = 0; |
1288 | cell->face [1] = 0; |
1282 | cell->face [2] = 0; |
1289 | cell->face [2] = 0; |
1283 | } |
1290 | } |
1284 | |
1291 | |
|
|
1292 | if (flags & 8) |
|
|
1293 | { |
|
|
1294 | fprintf (stderr, "oi\n");//D |
|
|
1295 | if (extmap) |
|
|
1296 | { |
|
|
1297 | uint8_t ext, cmd; |
|
|
1298 | |
|
|
1299 | do |
|
|
1300 | { |
|
|
1301 | |
|
|
1302 | ext = *data++; |
|
|
1303 | cmd = ext & 0x7f; |
|
|
1304 | |
|
|
1305 | fprintf (stderr, "extcmd = %x\n", ext);//D |
|
|
1306 | |
|
|
1307 | if (ext < 4) |
|
|
1308 | cell->darkness = 255 - ext * 64; |
|
|
1309 | } |
|
|
1310 | while (cmd & 0x80); |
|
|
1311 | } |
|
|
1312 | else |
1285 | cell->darkness = flags & 8 ? *data++ : 255; |
1313 | cell->darkness = flags & 8 ? *data++ : 255; |
|
|
1314 | } |
1286 | |
1315 | |
1287 | //TODO: don't trust server data to be in-range(!) |
1316 | //TODO: don't trust server data to be in-range(!) |
1288 | |
1317 | |
1289 | if (flags & 4) |
1318 | if (flags & 4) |
1290 | { |
1319 | { |
… | |
… | |
1803 | const_iv (GL_SEPARABLE_2D), |
1832 | const_iv (GL_SEPARABLE_2D), |
1804 | const_iv (GL_CONVOLUTION_2D), |
1833 | const_iv (GL_CONVOLUTION_2D), |
1805 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1834 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1806 | const_iv (GL_CONSTANT_BORDER), |
1835 | const_iv (GL_CONSTANT_BORDER), |
1807 | const_iv (GL_LINES), |
1836 | const_iv (GL_LINES), |
|
|
1837 | const_iv (GL_LINE_STRIP), |
1808 | const_iv (GL_LINE_LOOP), |
1838 | const_iv (GL_LINE_LOOP), |
1809 | const_iv (GL_QUADS), |
1839 | const_iv (GL_QUADS), |
1810 | const_iv (GL_QUAD_STRIP), |
1840 | const_iv (GL_QUAD_STRIP), |
1811 | const_iv (GL_TRIANGLES), |
1841 | const_iv (GL_TRIANGLES), |
1812 | const_iv (GL_TRIANGLE_STRIP), |
1842 | const_iv (GL_TRIANGLE_STRIP), |
… | |
… | |
2009 | |
2039 | |
2010 | void glEndList () |
2040 | void glEndList () |
2011 | |
2041 | |
2012 | void glCallList (int list) |
2042 | void glCallList (int list) |
2013 | |
2043 | |
2014 | |
|
|