ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.116 by root, Thu Jun 15 08:29:16 2006 UTC vs.
Revision 1.120 by root, Sun Jun 18 19:13:19 2006 UTC

1233 1233
1234 while (data < data_end) 1234 while (data < data_end)
1235 { 1235 {
1236 flags = (data [0] << 8) + data [1]; data += 2; 1236 flags = (data [0] << 8) + data [1]; data += 2;
1237 1237
1238 x = ((flags >> 10) & 63) + self->x; 1238 x = self->x + ((flags >> 10) & 63);
1239 y = ((flags >> 4) & 63) + self->y; 1239 y = self->y + ((flags >> 4) & 63);
1240 1240
1241 cell = map_get_cell (self, x, y); 1241 cell = map_get_cell (self, x, y);
1242 1242
1243 if (flags & 15) 1243 if (flags & 15)
1244 { 1244 {
1341 int vx, vy; 1341 int vx, vy;
1342 int x, y, z; 1342 int x, y, z;
1343 int last_name; 1343 int last_name;
1344 mapface face; 1344 mapface face;
1345 1345
1346 vx = self->x + (self->w - sw + 1) / 2 - shift_x; 1346 vx = self->x + self->w / 2 - sw / 2 - shift_x;
1347 vy = self->y + (self->h - sh + 1) / 2 - shift_y; 1347 vy = self->y + self->h / 2 - sh / 2 - shift_y;
1348 1348
1349 /* 1349 /*
1350 int vx = self->vx = self->w >= sw 1350 int vx = self->vx = self->w >= sw
1351 ? self->x + (self->w - sw) / 2 1351 ? self->x + (self->w - sw) / 2
1352 : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); 1352 : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx));
1356 : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy)); 1356 : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy));
1357 */ 1357 */
1358 1358
1359 glColor4ub (255, 255, 255, 255); 1359 glColor4ub (255, 255, 255, 255);
1360 1360
1361 glEnable (GL_BLEND);
1361 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 1362 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1362 glEnable (GL_BLEND);
1363 glEnable (GL_TEXTURE_2D); 1363 glEnable (GL_TEXTURE_2D);
1364 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 1364 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
1365 1365
1366 glBegin (GL_QUADS); 1366 glBegin (GL_QUADS);
1367 1367
1405 1405
1406 glEnd (); 1406 glEnd ();
1407 1407
1408 glDisable (GL_TEXTURE_2D); 1408 glDisable (GL_TEXTURE_2D);
1409 glDisable (GL_BLEND); 1409 glDisable (GL_BLEND);
1410}
1411
1412void
1413draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data)
1414 CODE:
1415{
1416 static float color[16][3] = {
1417 { 0.00, 0.00, 0.00 },
1418 { 1.00, 1.00, 1.00 },
1419 { 0.00, 0.00, 0.55 },
1420 { 1.00, 0.00, 0.00 },
1421
1422 { 1.00, 0.54, 0.00 },
1423 { 0.11, 0.56, 1.00 },
1424 { 0.93, 0.46, 0.00 },
1425 { 0.18, 0.54, 0.34 },
1426
1427 { 0.56, 0.73, 0.56 },
1428 { 0.80, 0.80, 0.80 },
1429 { 0.55, 0.41, 0.13 },
1430 { 0.99, 0.77, 0.26 },
1431
1432 { 0.74, 0.65, 0.41 },
1433
1434 { 0.00, 1.00, 1.00 },
1435 { 1.00, 0.00, 1.00 },
1436 { 1.00, 1.00, 0.00 },
1437 };
1438
1439 int x, y;
1440
1441 glEnable (GL_TEXTURE_2D);
1442 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
1443 glEnable (GL_BLEND);
1444 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1445 glBegin (GL_QUADS);
1446
1447 for (y = 0; y < h; y++)
1448 for (x = 0; x < w; x++)
1449 {
1450 unsigned char m = data [x + y * w];
1451
1452 if (m)
1453 {
1454 float *c = color [m & 15];
1455
1456 float tx1 = m & 0x40 ? 0.5 : 0.;
1457 float tx2 = tx1 + 0.5;
1458
1459 glColor4f (c[0], c[1], c[2], 0.75);
1460 glTexCoord2f (tx1, 0.); glVertex2i (x , y );
1461 glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1);
1462 glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1);
1463 glTexCoord2f (tx2, 0.); glVertex2i (x + 1, y );
1464 }
1465 }
1466
1467 glEnd ();
1468 glDisable (GL_BLEND);
1469 glDisable (GL_TEXTURE_2D);
1410} 1470}
1411 1471
1412void 1472void
1413fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) 1473fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh)
1414 PPCODE: 1474 PPCODE:
1655 const_iv (GL_SCISSOR_TEST), 1715 const_iv (GL_SCISSOR_TEST),
1656 const_iv (GL_DEPTH_TEST), 1716 const_iv (GL_DEPTH_TEST),
1657 const_iv (GL_ALPHA_TEST), 1717 const_iv (GL_ALPHA_TEST),
1658 const_iv (GL_NORMALIZE), 1718 const_iv (GL_NORMALIZE),
1659 const_iv (GL_RESCALE_NORMAL), 1719 const_iv (GL_RESCALE_NORMAL),
1720 const_iv (GL_FRONT),
1721 const_iv (GL_BACK),
1660 const_iv (GL_AND), 1722 const_iv (GL_AND),
1661 const_iv (GL_ONE), 1723 const_iv (GL_ONE),
1662 const_iv (GL_ZERO), 1724 const_iv (GL_ZERO),
1663 const_iv (GL_SRC_ALPHA), 1725 const_iv (GL_SRC_ALPHA),
1664 const_iv (GL_DST_ALPHA), 1726 const_iv (GL_DST_ALPHA),
1786 1848
1787void glPopMatrix () 1849void glPopMatrix ()
1788 1850
1789void glLoadIdentity () 1851void glLoadIdentity ()
1790 1852
1853void glDrawBuffer (int buffer)
1854
1855void glReadBuffer (int buffer)
1856
1791# near_ and far_ are due to microsofts buggy "c" compiler 1857# near_ and far_ are due to microsofts buggy "c" compiler
1792void glFrustum (double left, double right, double bottom, double top, double near_, double far_) 1858void glFrustum (double left, double right, double bottom, double top, double near_, double far_)
1793 1859
1794# near_ and far_ are due to microsofts buggy "c" compiler 1860# near_ and far_ are due to microsofts buggy "c" compiler
1795void glOrtho (double left, double right, double bottom, double top, double near_, double far_) 1861void glOrtho (double left, double right, double bottom, double top, double near_, double far_)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines