OSDN Git Service

ユニークのクローンを倒した場合はその旨playrecordに明記するように変更.
[hengband/hengband.git] / src / z-term.c
index 6015776..00e6318 100644 (file)
  *   Term->user_hook = Perform user actions
  *   Term->xtra_hook = Perform extra actions
  *   Term->curs_hook = Draw (or Move) the cursor
+ *   Term->bigcurs_hook = Draw (or Move) the big cursor (bigtile mode)
  *   Term->wipe_hook = Draw some blank spaces
  *   Term->text_hook = Draw some text in the window
  *   Term->pict_hook = Draw some attr/chars in the window
@@ -570,7 +571,7 @@ void Term_queue_char(int x, int y, byte a, char c)
        if (x < Term->x1[y]) Term->x1[y] = x;
        if (x > Term->x2[y]) Term->x2[y] = x;
 
-       if (scrn->a[y][x] == 255)
+       if ((scrn->a[y][x] & 0xf0) == 0xf0)
                if ((x - 1) < Term->x1[y]) Term->x1[y]--;
 }
 
@@ -611,7 +612,7 @@ void Term_queue_line(int x, int y, int n, byte *a, char *c)
 
                /* Hack -- Ignore non-changes */
                if ((*scr_aa == *a) && (*scr_cc == *c) &&
-                       (*scr_taa == *ta) && (*scr_tcc == *tc))
+                       (*scr_taa == *ta) && (*scr_tcc == *tc))
                {
                        x++;
                        a++;
@@ -686,11 +687,11 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s)
 
        byte *scr_aa = Term->scr->a[y];
 #ifdef JP
-        unsigned char *scr_cc = (unsigned char *)Term->scr->c[y];
+       char *scr_cc = Term->scr->c[y];
 
 #ifdef USE_TRANSPARENCY
        byte *scr_taa = Term->scr->ta[y];
-       unsigned char *scr_tcc = Term->scr->tc[y];
+       char *scr_tcc = Term->scr->tc[y];
 #endif /* USE_TRANSPARENCY */
 
 #else
@@ -706,20 +707,19 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s)
 
 
 #ifdef JP
-        /* É½¼¨Ê¸»ú¤Ê¤· */
-        if (n == 0 || *s == 0) return;
-        /*
-         * Á´³Ñʸ»ú¤Î±¦È¾Ê¬¤«¤éʸ»ú¤òɽ¼¨¤¹¤ë¾ì¹ç¡¢
-         * ½Å¤Ê¤Ã¤¿Ê¸»ú¤Îº¸Éôʬ¤ò¾Ãµî¡£
-         * É½¼¨³«»Ï°ÌÃÖ¤¬º¸Ã¼¤Ç¤Ê¤¤¤È²¾Äê¡£
-         */
-        if ((scr_aa[x] & KANJI2) && !(scr_aa[x] & 0x80))
-        {
-               plog_fmt("scr_aa[%d]=%d\n",x,scr_aa[x]);
-                scr_cc[x - 1] = ' ';
-                scr_aa[x - 1] &= KANJIC;
-                x1 = x2 = x - 1;
-        }
+       /* É½¼¨Ê¸»ú¤Ê¤· */
+       if (n == 0 || *s == 0) return;
+       /*
+        * Á´³Ñʸ»ú¤Î±¦È¾Ê¬¤«¤éʸ»ú¤òɽ¼¨¤¹¤ë¾ì¹ç¡¢
+        * ½Å¤Ê¤Ã¤¿Ê¸»ú¤Îº¸Éôʬ¤ò¾Ãµî¡£
+        * É½¼¨³«»Ï°ÌÃÖ¤¬º¸Ã¼¤Ç¤Ê¤¤¤È²¾Äê¡£
+        */
+       if ((scr_aa[x] & KANJI2) && !(scr_aa[x] & 0x80))
+       {
+               scr_cc[x - 1] = ' ';
+               scr_aa[x - 1] &= KANJIC;
+               x1 = x2 = x - 1;
+       }
 #endif
        /* Queue the attr/chars */
        for ( ; n; x++, s++, n--)
@@ -728,13 +728,13 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s)
                /* Æüìʸ»ú¤È¤·¤ÆMSB¤¬Î©¤Ã¤Æ¤¤¤ë²ÄǽÀ­¤¬¤¢¤ë */
                /* ¤½¤Î¾ì¹çattr¤ÎMSB¤âΩ¤Ã¤Æ¤¤¤ë¤Î¤Ç¤³¤ì¤Ç¼±Ê̤¹¤ë */
 /* check */
-               if (iskanji(*s) && !(a & 0x80))
+               if (!(a & 0x80) && iskanji(*s))
                {
-                       int nc1 = *s++;
-                       int nc2 = *s;
+                       char nc1 = *s++;
+                       char nc2 = *s;
 
-                       int na1 = (a | KANJI1);
-                       int na2 = (a | KANJI2);
+                       byte na1 = (a | KANJI1);
+                       byte na2 = (a | KANJI2);
 
                        if((--n == 0) || !nc2) break;
 #ifdef USE_TRANSPARENCY
@@ -758,13 +758,13 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s)
                else
                {
 #endif
-               int oa = scr_aa[x];
-               int oc = scr_cc[x];
+               byte oa = scr_aa[x];
+               char oc = scr_cc[x];
 
 #ifdef USE_TRANSPARENCY
 
-               int ota = scr_taa[x];
-               int otc = scr_tcc[x];
+               byte ota = scr_taa[x];
+               char otc = scr_tcc[x];
 
                /* Hack -- Ignore non-changes */
                if ((oa == a) && (oc == *s) && (ota == 0) && (otc == 0)) continue;
@@ -808,7 +808,7 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s)
                if (x != w && !(scr_aa[x] & 0x80) && (scr_aa[x] & KANJI2))
                {
                        scr_cc[x] = ' ';
-                        scr_aa[x] &= KANJIC;
+                       scr_aa[x] &= KANJIC;
                        if (x1 < 0) x1 = x;
                        x2 = x;
                }
@@ -918,9 +918,9 @@ static void Term_fresh_row_pict(int y, int x1, int x2)
 #ifdef JP
                if ((na == oa) && (nc == oc) && (nta == ota) && (ntc == otc)
                    &&(!kanji || (scr_aa[x + 1] == old_aa[x + 1] &&
-                                 scr_cc[x + 1] == old_cc[x + 1] &&
-                                  scr_taa[x + 1] == old_taa[x + 1] &&
-                                  scr_tcc[x + 1] == old_tcc[x + 1])))
+                                 scr_cc[x + 1] == old_cc[x + 1] &&
+                                 scr_taa[x + 1] == old_taa[x + 1] &&
+                                 scr_tcc[x + 1] == old_tcc[x + 1])))
 #else
                if ((na == oa) && (nc == oc) && (nta == ota) && (ntc == otc))
 #endif
@@ -932,7 +932,7 @@ static void Term_fresh_row_pict(int y, int x1, int x2)
 #ifdef JP
                if ((na == oa) && (nc == oc) &&
                    (!kanji || (scr_aa[x + 1] == old_aa[x + 1] &&
-                               scr_cc[x + 1] == old_cc[x + 1])))
+                               scr_cc[x + 1] == old_cc[x + 1])))
 #else
                if ((na == oa) && (nc == oc))
 #endif
@@ -1084,9 +1084,9 @@ static void Term_fresh_row_both(int y, int x1, int x2)
 #ifdef JP
                if ((na == oa) && (nc == oc) && (nta == ota) && (ntc == otc)&&
                    (!kanji || (scr_aa[x + 1] == old_aa[x + 1] &&
-                               scr_cc[x + 1] == old_cc[x + 1] &&
-                                scr_taa[x + 1] == old_taa[x + 1] &&
-                                scr_tcc[x + 1] == old_tcc[x + 1])))
+                               scr_cc[x + 1] == old_cc[x + 1] &&
+                               scr_taa[x + 1] == old_taa[x + 1] &&
+                               scr_tcc[x + 1] == old_tcc[x + 1])))
 #else
                if ((na == oa) && (nc == oc) && (nta == ota) && (ntc == otc))
 #endif
@@ -1098,7 +1098,7 @@ static void Term_fresh_row_both(int y, int x1, int x2)
 #ifdef JP
                if ((na == oa) && (nc == oc) &&
                    (!kanji || (scr_aa[x + 1] == old_aa[x + 1] &&
-                               scr_cc[x + 1] == old_cc[x + 1])))
+                               scr_cc[x + 1] == old_cc[x + 1])))
 #else
                if ((na == oa) && (nc == oc))
 #endif
@@ -1157,7 +1157,7 @@ static void Term_fresh_row_both(int y, int x1, int x2)
 #endif /* USE_TRANSPARENCY */
 
                /* 2nd byte of bigtile */
-               if (na == 255) continue;
+               if ((na & 0xf0) == 0xf0) continue;
 
                /* Handle high-bit attr/chars */
                if ((na & 0x80) && (nc & 0x80))
@@ -1352,7 +1352,7 @@ static void Term_fresh_row_text(int y, int x1, int x2)
 #ifdef JP
                if ((na == oa) && (nc == oc) &&
                    (!kanji || (scr_aa[x + 1] == old_aa[x + 1] &&
-                               scr_cc[x + 1] == old_cc[x + 1])))
+                               scr_cc[x + 1] == old_cc[x + 1])))
 #else
                if ((na == oa) && (nc == oc))
 #endif
@@ -1618,6 +1618,7 @@ errr Term_fresh(void)
 
        /* Paranoia -- use "fake" hooks to prevent core dumps */
        if (!Term->curs_hook) Term->curs_hook = Term_curs_hack;
+       if (!Term->bigcurs_hook) Term->bigcurs_hook = Term->curs_hook;
        if (!Term->wipe_hook) Term->wipe_hook = Term_wipe_hack;
        if (!Term->text_hook) Term->text_hook = Term_text_hack;
        if (!Term->pict_hook) Term->pict_hook = Term_pict_hack;
@@ -1735,7 +1736,7 @@ errr Term_fresh(void)
 #ifdef CHUUKEI
                                send_text_to_chuukei_server(tx, ty, csize, (old_aa[tx] & 0xf), &old_cc[tx]);
 #endif
-                               (void)((*Term->text_hook)(tx, ty, csize, (old_aa[tx] & 0xf), &old_cc[tx]));
+                               (void)((*Term->text_hook)(tx, ty, csize, (unsigned char) (old_aa[tx] & 0xf), &old_cc[tx]));
                        }
 
                        /* Hack -- erase the grid */
@@ -1832,10 +1833,26 @@ errr Term_fresh(void)
                if (!scr->cu && scr->cv)
                {
 #ifdef CHUUKEI
-                 send_curs_to_chuukei_server(scr->cx, scr->cy);
+                       send_curs_to_chuukei_server(scr->cx, scr->cy);
 #endif
-                       /* Call the cursor display routine */
-                       (void)((*Term->curs_hook)(scr->cx, scr->cy));
+
+#ifdef JP
+                       if ((scr->cx + 1 < w) &&
+                           ((old->a[scr->cy][scr->cx + 1] == 255) ||
+                            (!(old->a[scr->cy][scr->cx] & 0x80) &&
+                             iskanji(old->c[scr->cy][scr->cx]))))
+#else
+                       if ((scr->cx + 1 < w) && (old->a[scr->cy][scr->cx + 1] == 255))
+#endif
+                       {
+                               /* Double width cursor for the Bigtile mode */
+                               (void)((*Term->bigcurs_hook)(scr->cx, scr->cy));
+                       }
+                       else
+                       {
+                               /* Call the cursor display routine */
+                               (void)((*Term->curs_hook)(scr->cx, scr->cy));
+                       }
                }
        }
 
@@ -2182,19 +2199,19 @@ errr Term_erase(int x, int y, int n)
 #endif /* USE_TRANSPARENCY */
 
 #ifdef JP
-        /*
-         * Á´³Ñʸ»ú¤Î±¦È¾Ê¬¤«¤éʸ»ú¤òɽ¼¨¤¹¤ë¾ì¹ç¡¢
-         * ½Å¤Ê¤Ã¤¿Ê¸»ú¤Îº¸Éôʬ¤ò¾Ãµî¡£
-         */
-        if (n > 0 && ((scr_aa[x] & KANJI2) && !(scr_aa[x] & 0x80))
-           || ((byte)scr_cc[x] == 255 && scr_aa[x] == 255))
+       /*
+        * Á´³Ñʸ»ú¤Î±¦È¾Ê¬¤«¤éʸ»ú¤òɽ¼¨¤¹¤ë¾ì¹ç¡¢
+        * ½Å¤Ê¤Ã¤¿Ê¸»ú¤Îº¸Éôʬ¤ò¾Ãµî¡£
+        */
+       if (n > 0 && (((scr_aa[x] & KANJI2) && !(scr_aa[x] & 0x80))
+                     || ((byte)scr_cc[x] == 255 && scr_aa[x] == 255)))
 #else
-        if (n > 0 && (byte)scr_cc[x] == 255 && scr_aa[x] == 255)
+       if (n > 0 && (byte)scr_cc[x] == 255 && scr_aa[x] == 255)
 #endif
-        {
-                x--;
-                n++;
-        }
+       {
+               x--;
+               n++;
+       }
 
        /* Scan every column */
        for (i = 0; i < n; i++, x++)
@@ -2206,15 +2223,15 @@ errr Term_erase(int x, int y, int n)
                if ((oa == na) && (oc == nc)) continue;
 
 #ifdef JP
-                /*
-                 * Á´³Ñʸ»ú¤Îº¸È¾Ê¬¤Çɽ¼¨¤ò½ªÎ»¤¹¤ë¾ì¹ç¡¢
-                 * ½Å¤Ê¤Ã¤¿Ê¸»ú¤Î±¦Éôʬ¤ò¾Ãµî¡£
+               /*
+                * Á´³Ñʸ»ú¤Îº¸È¾Ê¬¤Çɽ¼¨¤ò½ªÎ»¤¹¤ë¾ì¹ç¡¢
+                * ½Å¤Ê¤Ã¤¿Ê¸»ú¤Î±¦Éôʬ¤ò¾Ãµî¡£
                 *
                 * 2001/04/29 -- Habu
                 * ¹Ô¤Î±¦Ã¼¤Î¾ì¹ç¤Ï¤³¤Î½èÍý¤ò¤·¤Ê¤¤¤è¤¦¤Ë½¤Àµ¡£
-                 */
-                if ((oa & KANJI1) && (i + 1) == n && x != w - 1)
-                        n++;
+                */
+               if ((oa & KANJI1) && (i + 1) == n && x != w - 1)
+                       n++;
 #endif
                /* Save the "literal" information */
                scr_aa[x] = na;