summaryrefslogtreecommitdiffstats
path: root/mbbsd/dark.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-08 10:46:24 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-08 10:46:24 +0800
commita0f8ef1e2e04905908478088fc376435b770417c (patch)
treea96bd4096703e5d0bb0b9fe7c9499d0db7768070 /mbbsd/dark.c
parentf55eaef82ab265772418a545f32fa2780468603b (diff)
downloadpttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.gz
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.bz2
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.lz
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.xz
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.tar.zst
pttbbs-a0f8ef1e2e04905908478088fc376435b770417c.zip
New style to specify ANSI escape commands.
First introduced by pmore, but this hard work (to transform all files to new style) is made by Rong-en Fan (rafan). Thanks! git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2796 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/dark.c')
-rw-r--r--mbbsd/dark.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/mbbsd/dark.c b/mbbsd/dark.c
index 9fe17eb8..475fc302 100644
--- a/mbbsd/dark.c
+++ b/mbbsd/dark.c
@@ -129,15 +129,15 @@ brd_prints(void)
clear();
move(1, 0);
outs("\n"
- " ¢~¢w¢s¢w¢s¢w¢s¢w¢s¢w¢s¢w¢s¢w¢s¢w¢¡\n"
- " ¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x\n"
- " ¢u¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢t\n"
- " ¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x\n"
- " ¢u¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢t\n"
- " ¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x\n"
- " ¢u¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢t\n"
- " ¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x\n"
- " ¢¢¢w¢r¢w¢r¢w¢r¢w¢r¢w¢r¢w¢r¢w¢r¢w¢£\n"
+ " " ANSI_COLOR(43;30) "¢~¢w¢s¢w¢s¢w¢s¢w¢s¢w¢s¢w¢s¢w¢s¢w¢¡" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢u¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢t" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢u¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢t" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢u¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢q¢w¢t" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x¡´¢x" ANSI_RESET "\n"
+ " " ANSI_COLOR(43;30) "¢¢¢w¢r¢w¢r¢w¢r¢w¢r¢w¢r¢w¢r¢w¢r¢w¢£" ANSI_RESET "\n"
" ");
}
@@ -149,21 +149,21 @@ draw_line(struct DarkData *dd, sint y, sint f)
*buf = 0;
*tmp = 0;
- strlcpy(buf, "\033[43;30m", sizeof(buf));
+ strlcpy(buf, ANSI_COLOR(43;30), sizeof(buf));
for (i = 0; i < 8; i++) {
if (dd->brd[y][i].die == 1)
snprintf(tmp, sizeof(tmp), "¢x ");
else if (dd->brd[y][i].out == 0)
snprintf(tmp, sizeof(tmp), "¢x¡´");
else {
- snprintf(tmp, sizeof(tmp), "¢x\033[%s1;%dm%s\033[m\033[43;30m",
+ snprintf(tmp, sizeof(tmp), "¢x" ANSI_COLOR(%s1;%d) "%s" ANSI_RESET ANSI_COLOR(43;30) "",
(f == i) ? "1;47;" : "", (dd->brd[y][i].color) ? 31 : 34,
(dd->brd[y][i].color) ? rname[dd->brd[y][i].value] :
bname[dd->brd[y][i].value]);
}
strcat(buf, tmp);
}
- strcat(buf, "¢x\033[m");
+ strcat(buf, "¢x" ANSI_RESET);
move(cury[y], 3);
clrtoeol();
@@ -379,22 +379,22 @@ main_dark(int fd, userinfo_t * uin)
if (currutmp->turn) {
brd_rand(&dd);
send(fd, &dd.brd, sizeof(dd.brd), 0);
- mouts(21, 0, " ¡»§A¬O¥ý¤â");
- mouts(22, 0, " ¡»½ü¨ì§A¤U¤F");
+ mouts(21, 0, " " ANSI_COLOR(1;37) ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;37) "§A¬O¥ý¤â" ANSI_RESET);
+ mouts(22, 0, " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(5;35) "½ü¨ì§A¤U¤F" ANSI_RESET);
} else {
recv(fd, &dd.brd, sizeof(dd.brd), 0);
- mouts(21, 0, " ¡»§A¬O«á¤â");
+ mouts(21, 0, " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;37) "§A¬O«á¤â" ANSI_RESET);
}
move(12, 3);
- prints("%s[0³Ó0±Ñ]¢þ¢û.%s[0³Ó0±Ñ]", currutmp->userid, currutmp->mateid);
+ prints("%s[0³Ó0±Ñ]" ANSI_COLOR(5;31) "¢þ¢û" ANSI_COLOR(1;37) "." ANSI_RESET "%s[0³Ó0±Ñ]", currutmp->userid, currutmp->mateid);
outs("\n"
- " ¢®¢¬¥\\¯àªí¢­¢®¢­¢¬¢®¢­\n"
- " ¢¬ ¡ô¡ö¡õ¡÷: ²¾°Ê\n"
- " ¢® ¢û:  ¿ï¤l,½¤l\n"
- " ¢¬ enter:  ¦Y´Ñ,©ñ´Ñ\n"
- "¡@¤w¸g¸Ñ¨Mªº:¡@¡@ ¢® ¢ø:  ¦X´Ñ\n"
- " ¡@¡@ ¢¬ ¢ù:  »{¿é\n"
- " ¢® ¢ë:  ´«Ãä");
+ " " ANSI_COLOR(1;36) "¢®¢¬" ANSI_COLOR(1;31) "¥\\¯àªí" ANSI_COLOR(1;36) "¢­¢®¢­¢¬¢®¢­" ANSI_RESET "\n"
+ " " ANSI_COLOR(1;36) "¢¬" ANSI_COLOR(1;33) " ¡ô¡ö¡õ¡÷" ANSI_COLOR(1;37) ": " ANSI_COLOR(1;35) "²¾°Ê" ANSI_RESET "\n"
+ " " ANSI_COLOR(1;36) "¢®" ANSI_COLOR(1;33) " ¢û" ANSI_COLOR(1;37) ": " ANSI_COLOR(1;35) " ¿ï¤l,½¤l" ANSI_RESET "\n"
+ " " ANSI_COLOR(1;36) "¢¬" ANSI_COLOR(1;33) " enter" ANSI_COLOR(1;37) ": " ANSI_COLOR(1;35) " ¦Y´Ñ,©ñ´Ñ" ANSI_RESET "\n"
+ "¡@" ANSI_COLOR(1;33) "¤w¸g¸Ñ¨Mªº" ANSI_COLOR(1;37) ":" ANSI_COLOR(1;36) "¡@¡@ ¢®" ANSI_COLOR(1;33) " ¢ø" ANSI_COLOR(1;37) ": " ANSI_COLOR(1;35) " ¦X´Ñ" ANSI_RESET "\n"
+ " ¡@¡@ " ANSI_COLOR(1;36) "¢¬" ANSI_COLOR(1;33) " ¢ù" ANSI_COLOR(1;37) ": " ANSI_COLOR(1;35) " »{¿é" ANSI_RESET "\n"
+ " " ANSI_COLOR(1;36) "¢®" ANSI_COLOR(1;33) " ¢ë" ANSI_COLOR(1;37) ": " ANSI_COLOR(1;35) " ´«Ãä" ANSI_RESET);
if (currutmp->turn)
move(cury[0], curx[0]);
@@ -421,11 +421,11 @@ main_dark(int fd, userinfo_t * uin)
break;
}
if (dd.curr.end == -3)
- mouts(23, 30, "\033[33m­n¨D¦X´Ñ\033[m");
+ mouts(23, 30, ANSI_COLOR(33) "­n¨D¦X´Ñ" ANSI_RESET);
else if (dd.curr.end == -4)
- mouts(23, 30, "\033[33m­n¨D´«Ãä\033[m");
+ mouts(23, 30, ANSI_COLOR(33) "­n¨D´«Ãä" ANSI_RESET);
else if (dd.curr.end == -5)
- mouts(23, 30, "\033[33m­n¨D³s¦Y\033[m");
+ mouts(23, 30, ANSI_COLOR(33) "­n¨D³s¦Y" ANSI_RESET);
else
mouts(23, 30, "");
@@ -434,7 +434,7 @@ main_dark(int fd, userinfo_t * uin)
dd.mx = dd.curr.x;
redraw(&dd);
if (dd.curr.end)
- mouts(22, 0, " ¡»½ü¨ì§A¤U¤F");
+ mouts(22, 0, " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(5;35) "½ü¨ì§A¤U¤F" ANSI_RESET);
move(cury[dd.my], curx[dd.mx]);
} else {
if (currutmp->turn == 'p') {
@@ -451,7 +451,7 @@ main_dark(int fd, userinfo_t * uin)
if (ch == 'y') {
currutmp->color = (currutmp->color == '1') ? '0' : '1';
uin->color = (uin->color == '1') ? '0' : '1';
- mouts(21, 0, (currutmp->color == '1') ? " \033[1;33m¡»§A«ù¬õ¦â´Ñ\033[m" : " \033[1;33m¡»§A«ù¶Â¦â´Ñ\033[m");
+ mouts(21, 0, (currutmp->color == '1') ? " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;31) "§A«ù¬õ¦â´Ñ" ANSI_RESET : " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;36) "§A«ù¶Â¦â´Ñ" ANSI_RESET);
} else {
mouts(23, 30, "");
currutmp->turn = (uin->turn) ? 0 : 1;
@@ -459,7 +459,7 @@ main_dark(int fd, userinfo_t * uin)
} else if (currutmp->turn == 'g') {
if (ch == 'y') {
dd.cont = 1;
- mouts(21, 0, " \033[1;33m¡»§A«ù¬õ¦â´Ñ\033[m ¥i³s¦Y");
+ mouts(21, 0, " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;31) "§A«ù¬õ¦â´Ñ" ANSI_RESET " ¥i³s¦Y");
} else {
mouts(23, 30, "");
currutmp->turn = (uin->turn) ? 0 : 1;
@@ -503,12 +503,12 @@ main_dark(int fd, userinfo_t * uin)
continue;
}
if (!i && currutmp->color == '1') {
- mouts(21, 0, " \033[1;33m¡»§A«ù¬õ¦â´Ñ\033[m");
+ mouts(21, 0, " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;31) "§A«ù¬õ¦â´Ñ" ANSI_RESET);
i++;
move(cury[dd.my], curx[dd.mx]);
}
if (!i && currutmp->color == '0') {
- mouts(21, 0, " \033[1;33m¡»§A«ù¶Â¦â´Ñ\033[m");
+ mouts(21, 0, " " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;36) "§A«ù¶Â¦â´Ñ" ANSI_RESET);
i++;
move(cury[dd.my], curx[dd.mx]);
}
@@ -521,7 +521,7 @@ main_dark(int fd, userinfo_t * uin)
move(22, 0);
clrtoeol();
- prints(" ¡»½ü¨ì%s¤U §O©È§O©È ¥LºâÔ£¦Ì", currutmp->mateid);
+ prints(" " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;37) "½ü¨ì%s¤U §O©È§O©È ¥LºâÔ£¦Ì" ANSI_RESET, currutmp->mateid);
currutmp->turn = 0;
uin->turn = 1;
} else {
@@ -531,7 +531,7 @@ main_dark(int fd, userinfo_t * uin)
}
move(22, 0);
clrtoeol();
- prints(" ¡»½ü¨ì%s¤U §O©È§O©È ¥LºâÔ£¦Ì", currutmp->mateid);
+ prints(" " ANSI_COLOR(1;33) "¡»" ANSI_COLOR(1;37) "½ü¨ì%s¤U §O©È§O©È ¥LºâÔ£¦Ì" ANSI_RESET, currutmp->mateid);
}
}
}
@@ -542,15 +542,15 @@ main_dark(int fd, userinfo_t * uin)
if (currutmp->turn == 'w') {
move(22, 0);
clrtoeol();
- outs("§AŤF.. ¯u¬O®¥³ß~~");
+ outs(ANSI_COLOR(1;31) "§AŤF.. ¯u¬O®¥³ß~~" ANSI_RESET);
} else {
move(22, 0);
clrtoeol();
- outs("¿é±¼¤F°Õ.....¤U¦¸Åý¥L¦n¬Ý!!");
+ outs(ANSI_COLOR(1;31) "¿é±¼¤F°Õ.....¤U¦¸Åý¥L¦n¬Ý!!" ANSI_RESET);
}
break;
case -3:
- mouts(22, 0, "¦X´Ñ­ò!! ¤U¦¸¦b¤À°ª¤U§a ^_^");
+ mouts(22, 0, ANSI_COLOR(1;31) "¦X´Ñ­ò!! ¤U¦¸¦b¤À°ª¤U§a ^_^" ANSI_RESET);
break;
default:
add_io(0, 0);