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.143 by root, Fri Aug 18 02:23:39 2006 UTC vs.
Revision 1.145 by root, Fri Aug 18 03:19:58 2006 UTC

1300 uint8_t ext, cmd; 1300 uint8_t ext, cmd;
1301 1301
1302 do 1302 do
1303 { 1303 {
1304 ext = *data++; 1304 ext = *data++;
1305 cmd = ext & 0x7f; 1305 cmd = ext & 0x3f;
1306 1306
1307 if (ext < 4) 1307 if (ext < 4)
1308 cell->darkness = 255 - ext * 64 + 1; 1308 cell->darkness = 255 - ext * 64 + 1;
1309 else if (ext == 5) // health 1309 else if (ext == 5) // health
1310 cell->stat_hp = *data++; 1310 cell->stat_hp = *data++;
1311 else if (ext & 0x40) // unknown, multibyte => skip
1312 data += *data + 1;
1311 } 1313 }
1312 while (cmd & 0x80); 1314 while (cmd & 0x80);
1313 } 1315 }
1314 else 1316 else
1315 cell->darkness = *data++ + 1; 1317 cell->darkness = *data++ + 1;
1439 { 1441 {
1440 mapcell *cell = row->col + (x + vx - row->c0); 1442 mapcell *cell = row->col + (x + vx - row->c0);
1441 1443
1442 face = cell->face [z]; 1444 face = cell->face [z];
1443 1445
1444 if (face) 1446 if (face && face < self->texs)
1445 { 1447 {
1446 maptex tex = self->tex [face]; 1448 maptex tex = self->tex [face];
1447 1449
1448 int px = (x + 1) * 32 - tex.w; 1450 int px = (x + 1) * 32 - tex.w;
1449 int py = (y + 1) * 32 - tex.h; 1451 int py = (y + 1) * 32 - tex.h;
1467 glEnd (); 1469 glEnd ();
1468 1470
1469 glDisable (GL_TEXTURE_2D); 1471 glDisable (GL_TEXTURE_2D);
1470 glDisable (GL_BLEND); 1472 glDisable (GL_BLEND);
1471 1473
1474 // top layer: overlays such as the health bar
1472 for (y = 0; y < sh; y++) 1475 for (y = 0; y < sh; y++)
1473 if (0 <= y + vy && y + vy < self->rows) 1476 if (0 <= y + vy && y + vy < self->rows)
1474 { 1477 {
1475 maprow *row = self->row + (y + vy); 1478 maprow *row = self->row + (y + vy);
1476 1479
1482 int px = x * 32; 1485 int px = x * 32;
1483 int py = y * 32; 1486 int py = y * 32;
1484 1487
1485 if (cell->stat_hp) 1488 if (cell->stat_hp)
1486 { 1489 {
1490 int width = sh / 28 + 1;
1491
1487 glColor3ub (0, 0, 0); 1492 glColor3ub (0, 0, 0);
1488 glRectf (px + 1, py + 1, px + 31, py + 4); 1493 glRectf (px + 1, py, px + 31, py + width + 2);
1489 1494
1490 glColor3ub (0, 255, 0); 1495 glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0);
1491 glBegin (GL_LINES);
1492 glVertex2f (px + 2, py + 2.5f);
1493 glVertex2f (px + 29.f - cell->stat_hp * (28.f / 255.f), py + 2.5f); 1496 glRectf (px + 2, py + 1, px + 30 - cell->stat_hp * 28 / 255, py + width + 1);
1494 glEnd ();
1495 } 1497 }
1496 } 1498 }
1497 } 1499 }
1498} 1500}
1499 1501

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines