… | |
… | |
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 | |
|
|
1412 | void |
|
|
1413 | draw_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 | float *c = color [m & 15]; |
|
|
1453 | |
|
|
1454 | float tx1 = m & 0x40 ? 0.5 : m & 0x80 ? 0.25 : 0.; |
|
|
1455 | float tx2 = tx1 + 0.25; |
|
|
1456 | |
|
|
1457 | glColor4f (c[0], c[1], c[2], 0.75); |
|
|
1458 | glTexCoord2f (tx1, 0.); glVertex2i (x , y ); |
|
|
1459 | glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1); |
|
|
1460 | glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1); |
|
|
1461 | glTexCoord2f (tx2, 0.); glVertex2i (x + 1, y ); |
|
|
1462 | } |
|
|
1463 | |
|
|
1464 | glEnd (); |
|
|
1465 | glDisable (GL_BLEND); |
|
|
1466 | glDisable (GL_TEXTURE_2D); |
1410 | } |
1467 | } |
1411 | |
1468 | |
1412 | void |
1469 | void |
1413 | fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1470 | fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1414 | PPCODE: |
1471 | PPCODE: |