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.30 by root, Thu Apr 13 23:07:56 2006 UTC vs.
Revision 1.35 by root, Fri Apr 14 02:03:10 2006 UTC

37 37
38static void 38static void
39substitute_func (FcPattern *pattern, gpointer data) 39substitute_func (FcPattern *pattern, gpointer data)
40{ 40{
41 FcPatternAddBool (pattern, FC_HINTING , 1); 41 FcPatternAddBool (pattern, FC_HINTING , 1);
42 FcPatternAddBool (pattern, FC_AUTOHINT, 1); 42 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
43} 43}
44 44
45static void 45static void
46layout_update (CFClient__Layout self) 46layout_update (CFClient__Layout self)
47{ 47{
150 if (x >= row->c0) 150 if (x >= row->c0)
151 { 151 {
152 if (x >= row->c1) 152 if (x >= row->c1)
153 break; 153 break;
154 154
155 mapcell *cell = row->col + (x - row->c0); 155 row->col[x - row->c0].darkness = -1;
156 cell->darkness = -1;
157 cell->face [2] = 0;
158 } 156 }
159 } 157 }
160} 158}
161 159
162MODULE = CFClient PACKAGE = CFClient 160MODULE = CFClient PACKAGE = CFClient
287 CODE: 285 CODE:
288 g_object_unref (self->pl); 286 g_object_unref (self->pl);
289 Safefree (self); 287 Safefree (self);
290 288
291void 289void
290set_text (CFClient::Layout self, SV *text_)
291 CODE:
292{
293 STRLEN textlen;
294 char *text = SvPVutf8 (text_, textlen);
295
296 pango_layout_set_text (self->pl, text, textlen);
297}
298
299void
292set_markup (CFClient::Layout self, SV *text_) 300set_markup (CFClient::Layout self, SV *text_)
293 CODE: 301 CODE:
294{ 302{
295 STRLEN textlen; 303 STRLEN textlen;
296 char *text = SvPVutf8 (text_, textlen); 304 char *text = SvPVutf8 (text_, textlen);
560 { 568 {
561 cell->face [2] = (data [0] << 8) + data [1]; data += 2; 569 cell->face [2] = (data [0] << 8) + data [1]; data += 2;
562 } 570 }
563 } 571 }
564 else 572 else
565 {
566 cell->darkness = -1; 573 cell->darkness = -1;
567 cell->face [2] = 0;
568 }
569 } 574 }
570} 575}
571 576
572void 577void
573draw (CFClient::Map self, int x0, int y0, int sw, int sh) 578draw (CFClient::Map self, int x0, int y0, int sw, int sh)
574 CODE: 579 PPCODE:
575{ 580{
581 int sw4 = (sw + 3) & ~3;
582 SV *darkness_sv = sv_2mortal (newSV (sw4 * sh));
583 uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv);
584
585 SvPOK_only (darkness_sv);
586 SvCUR_set (darkness_sv, sw4 * sh);
587
576 int vx = self->vx = self->w >= sw 588 int vx = self->vx = self->w >= sw
577 ? self->x + (self->w - sw) / 2 589 ? self->x + (self->w - sw) / 2
578 : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); 590 : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx));
579 591
580 int vy = self->vy = self->h >= sh 592 int vy = self->vy = self->h >= sh
602 614
603 for (x = 0; x < sw; x++) 615 for (x = 0; x < sw; x++)
604 if (row->c0 <= x + vx && x + vx < row->c1) 616 if (row->c0 <= x + vx && x + vx < row->c1)
605 { 617 {
606 mapcell *cell = row->col + (x + vx - row->c0); 618 mapcell *cell = row->col + (x + vx - row->c0);
619
620 darkness[y * sw4 + x] = cell->darkness < 0
621 ? 255 - FOW_DARKNESS
622 : 255 - cell->darkness;
623
607 uint16_t face = cell->face [z]; 624 uint16_t face = cell->face [z];
608 625
609 if (face) 626 if (face)
610 { 627 {
611 mapface tex = self->face [face]; 628 mapface tex = self->face [face];
628 } 645 }
629 } 646 }
630 } 647 }
631 648
632 glEnd (); 649 glEnd ();
633}
634 650
651 glDisable (GL_TEXTURE_2D);
652 glDisable (GL_BLEND);
653
654 EXTEND (SP, 3);
655 PUSHs (sv_2mortal (newSViv (sw4)));
656 PUSHs (sv_2mortal (newSViv (sh)));
657 PUSHs (darkness_sv);
658}
659

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines