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.144 by root, Fri Aug 18 02:25:12 2006 UTC vs.
Revision 1.146 by root, Sat Aug 19 02:49:53 2006 UTC

294static void 294static void
295map_blank (CFPlus__Map self, int x0, int y0, int w, int h) 295map_blank (CFPlus__Map self, int x0, int y0, int w, int h)
296{ 296{
297 int x, y; 297 int x, y;
298 maprow *row; 298 maprow *row;
299 mapcell *cell;
299 300
300 for (y = y0; y < y0 + h; y++) 301 for (y = y0; y < y0 + h; y++)
301 if (y >= 0) 302 if (y >= 0)
302 { 303 {
303 if (y >= self->rows) 304 if (y >= self->rows)
309 if (x >= row->c0) 310 if (x >= row->c0)
310 { 311 {
311 if (x >= row->c1) 312 if (x >= row->c1)
312 break; 313 break;
313 314
314 row->col[x - row->c0].darkness = 0; 315 cell = row->col + x - row->c0;
316
317 cell->darkness = 0;
318 cell->stat_hp = 0;
315 } 319 }
316 } 320 }
317} 321}
318 322
319static void 323static void
1286 { 1290 {
1287 cell->darkness = 256; 1291 cell->darkness = 256;
1288 cell->face [0] = 0; 1292 cell->face [0] = 0;
1289 cell->face [1] = 0; 1293 cell->face [1] = 0;
1290 cell->face [2] = 0; 1294 cell->face [2] = 0;
1291 cell->stat_hp = 0;
1292 } 1295 }
1293 1296
1294 //TODO: don't trust server data to be in-range(!) 1297 //TODO: don't trust server data to be in-range(!)
1295 1298
1296 if (flags & 8) 1299 if (flags & 8)
1331 { 1334 {
1332 cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; 1335 cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2;
1333 } 1336 }
1334 } 1337 }
1335 else 1338 else
1339 {
1336 cell->darkness = 0; 1340 cell->darkness = 0;
1341 cell->stat_hp = 0;
1342 }
1337 } 1343 }
1338} 1344}
1339 1345
1340SV * 1346SV *
1341mapmap (CFPlus::Map self, int x0, int y0, int w, int h) 1347mapmap (CFPlus::Map self, int x0, int y0, int w, int h)
1441 { 1447 {
1442 mapcell *cell = row->col + (x + vx - row->c0); 1448 mapcell *cell = row->col + (x + vx - row->c0);
1443 1449
1444 face = cell->face [z]; 1450 face = cell->face [z];
1445 1451
1446 if (face) 1452 if (face && face < self->texs)
1447 { 1453 {
1448 maptex tex = self->tex [face]; 1454 maptex tex = self->tex [face];
1449 1455
1450 int px = (x + 1) * 32 - tex.w; 1456 int px = (x + 1) * 32 - tex.w;
1451 int py = (y + 1) * 32 - tex.h; 1457 int py = (y + 1) * 32 - tex.h;
1469 glEnd (); 1475 glEnd ();
1470 1476
1471 glDisable (GL_TEXTURE_2D); 1477 glDisable (GL_TEXTURE_2D);
1472 glDisable (GL_BLEND); 1478 glDisable (GL_BLEND);
1473 1479
1480 // top layer: overlays such as the health bar
1474 for (y = 0; y < sh; y++) 1481 for (y = 0; y < sh; y++)
1475 if (0 <= y + vy && y + vy < self->rows) 1482 if (0 <= y + vy && y + vy < self->rows)
1476 { 1483 {
1477 maprow *row = self->row + (y + vy); 1484 maprow *row = self->row + (y + vy);
1478 1485
1484 int px = x * 32; 1491 int px = x * 32;
1485 int py = y * 32; 1492 int py = y * 32;
1486 1493
1487 if (cell->stat_hp) 1494 if (cell->stat_hp)
1488 { 1495 {
1496 int width = sh / 28 + 1;
1497
1489 glColor3ub (0, 0, 0); 1498 glColor3ub (0, 0, 0);
1490 glRectf (px + 1, py + 1, px + 31, py + 4); 1499 glRectf (px + 1, py, px + 31, py + width + 2);
1491 1500
1492 glColor3ub (0, 255, 0); 1501 glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0);
1493 glBegin (GL_LINES);
1494 glVertex2f (px + 2, py + 2.5f);
1495 glVertex2f (px + 29.f - cell->stat_hp * (28.f / 255.f), py + 2.5f); 1502 glRectf (px + 2, py + 1, px + 30 - cell->stat_hp * 28 / 255, py + width + 1);
1496 glEnd ();
1497 } 1503 }
1498 } 1504 }
1499 } 1505 }
1500} 1506}
1501 1507

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines