static int add_D51_coach(int x, char *c[]) { int y, i; #ifdef DEBUG char buf[100]; #endif if (x < ( 4 - ALL_LENGTH )) return ERR; y = LINES / 2 - 5; #ifdef DEBUG sprintf(buf, "%d", x); my_mvaddstr(1, 0, buf); #endif if (FLY == 1) { y = (x / 7) + LINES - (COLS / 7) - D51HIGHT; } for (i = 0; i <= D51HIGHT; ++i) { my_mvaddstr(y + i, 0, c[(D51HIGHT + 1) * ((ALL_LENGTH + x) % D51PATTERNS) + i] + COLS - x); } if (ACCIDENT == 1) { add_man(y + 2, x + 43); add_man(y + 2, x + 47); add_man(y + 2, x + 125); add_man(y + 2, x + 129); add_man(y + 2, x + 207); add_man(y + 2, x + 211); } add_smoke(y - 1, x + D51FUNNEL); add_smoke(y - 1, x + D51FUNNEL + 81); add_smoke(y - 1, x + D51FUNNEL + 162); return OK; }
int add_sl(int x, char *c[]) { int i, y, py1 = 0, py2 = 0, py3 = 0; if (x < - LOGOLENGTH) { return ERR; } y = LINES / 2 - 3; if (FLY == 1) { y = (x / 6) + LINES - (COLS / 6) - LOGOHIGHT; py1 = 2; py2 = 4; py3 = 6; } for (i = 0; i <= LOGOHIGHT; ++i) { my_mvaddstr(y + i, x, sl[(LOGOLENGTH + x) / 3 % LOGOPATTERNS][i]); my_mvaddstr(y + i + py1, x + 21, lcoal[i]); my_mvaddstr(y + i + py2, x + 42, car[i]); my_mvaddstr(y + i + py3, x + 63, car[i]); } if (ACCIDENT == 1) { add_man(y + 1, x + 14); add_man(y + 1 + py2, x + 45); add_man(y + 1 + py2, x + 53); add_man(y + 1 + py3, x + 66); add_man(y + 1 + py3, x + 74); } add_smoke(y - 1, x + LOGOFUNNEL); return OK; }
static int add_sl(int x) { static const char *sl[LOGOPATTERNS][LOGOHIGHT + 1] = {{LOGO1, LOGO2, LOGO3, LOGO4, LWHL11, LWHL12, DELLN}, {LOGO1, LOGO2, LOGO3, LOGO4, LWHL21, LWHL22, DELLN}, {LOGO1, LOGO2, LOGO3, LOGO4, LWHL31, LWHL32, DELLN}, {LOGO1, LOGO2, LOGO3, LOGO4, LWHL41, LWHL42, DELLN}, {LOGO1, LOGO2, LOGO3, LOGO4, LWHL51, LWHL52, DELLN}, {LOGO1, LOGO2, LOGO3, LOGO4, LWHL61, LWHL62, DELLN}}; static const char *car[LOGOHIGHT + 1] = {LCAR1, LCAR2, LCAR3, LCAR4, LCAR5, LCAR6, DELLN}; int i, y, py1 = 0, py2 = 0, py3 = 0; if (x < - LOGOLENGTH) return ERR; y = LINES / 2 - 3; if (FLY == 1) { y = (x / 6) + LINES - (COLS / 6) - LOGOHIGHT; py1 = 2; py2 = 4; py3 = 6; } for (i = 0; i <= LOGOHIGHT; ++i) { my_mvaddstr(y + i, x, sl[(LOGOLENGTH + x) / 3 % LOGOPATTERNS][i]); my_mvaddstr(y + i + py1, x + 21, lcoal[i]); my_mvaddstr(y + i + py2, x + 42, car[i]); my_mvaddstr(y + i + py3, x + 63, car[i]); } if (ACCIDENT == 1) { add_man(y + 1, x + 14); add_man(y + 1 + py2, x + 45); add_man(y + 1 + py2, x + 53); add_man(y + 1 + py3, x + 66); add_man(y + 1 + py3, x + 74); } add_smoke(y - 1, x + LOGOFUNNEL); return OK; }
static int dirc(int y, int x) { if (DIREC == RTOL) { my_mvaddstr(y + 5, cros0l[5] + x - 1, "<-- "); } else { my_mvaddstr(y + 5, cros0l[5] + x - 1, " -->"); } return 0; }
int add_mayakataso(int x) { static char *mayakataso[MAYAKATASOPATTERNS][MAYAKATASOHIGHT + 1] = {{MAYAKATASO11, MAYAKATASO12, MAYAKATASO13, MAYAKATASO14, MAYAKATASO15, MAYAKATASO16, MAYAKATASO17, MAYAKATASO18, MAYAKATASO19, MAYAKATASO1DEL}, {MAYAKATASO21, MAYAKATASO22, MAYAKATASO23, MAYAKATASO24, MAYAKATASO25, MAYAKATASO26, MAYAKATASO27, MAYAKATASO28, MAYAKATASO29, MAYAKATASO2DEL}, {MAYAKATASO31, MAYAKATASO32, MAYAKATASO33, MAYAKATASO34, MAYAKATASO35, MAYAKATASO36, MAYAKATASO37, MAYAKATASO38, MAYAKATASO39, MAYAKATASO3DEL}, {MAYAKATASO41, MAYAKATASO42, MAYAKATASO43, MAYAKATASO44, MAYAKATASO45, MAYAKATASO46, MAYAKATASO47, MAYAKATASO48, MAYAKATASO49, MAYAKATASO4DEL}, {MAYAKATASO31, MAYAKATASO32, MAYAKATASO33, MAYAKATASO34, MAYAKATASO35, MAYAKATASO36, MAYAKATASO37, MAYAKATASO38, MAYAKATASO39, MAYAKATASO3DEL}, {MAYAKATASO21, MAYAKATASO22, MAYAKATASO23, MAYAKATASO24, MAYAKATASO25, MAYAKATASO26, MAYAKATASO27, MAYAKATASO28, MAYAKATASO29, MAYAKATASO2DEL}}; int i, y; if (x < - MAYAKATASOLENGTH) return ERR; y = LINES / 2 - 3; if (FLY == 1) { y = (x / 6) + LINES - (COLS / 6) - MAYAKATASOHIGHT; } for (i = 0; i <= MAYAKATASOHIGHT; ++i) { my_mvaddstr(y + i, x, mayakataso[(MAYAKATASOLENGTH + x) / 3 % MAYAKATASOPATTERNS][i]); } if (ACCIDENT == 1) { add_fukuchan(y , x + 16); } add_smoke(y - 1, x + MAYAKATASOFUNNEL); return OK; }
int add_lolitaso(int x) { static char *LOLITASO[LOLITASOPATTERNS][LOLITASOHIGHT + 1] = {{LOLITASO11, LOLITASO12, LOLITASO13, LOLITASO14, LOLITASO15, LOLITASO16, LOLITASO17, LOLITASO1DEL}, {LOLITASO21, LOLITASO22, LOLITASO23, LOLITASO24, LOLITASO25, LOLITASO26, LOLITASO27, LOLITASO2DEL}, {LOLITASO31, LOLITASO32, LOLITASO33, LOLITASO34, LOLITASO35, LOLITASO36, LOLITASO37, LOLITASO3DEL}, {LOLITASO41, LOLITASO42, LOLITASO43, LOLITASO44, LOLITASO45, LOLITASO46, LOLITASO47, LOLITASO4DEL}, {LOLITASO31, LOLITASO32, LOLITASO33, LOLITASO34, LOLITASO35, LOLITASO36, LOLITASO37, LOLITASO3DEL}, {LOLITASO21, LOLITASO22, LOLITASO23, LOLITASO24, LOLITASO25, LOLITASO26, LOLITASO27, LOLITASO2DEL}}; int i, y; if (x < - LOLITASOLENGTH) return ERR; y = LINES / 2 - 3; if (FLY == 1) { y = (x / 6) + LINES - (COLS / 6) - LOLITASOHIGHT; } for (i = 0; i <= LOLITASOHIGHT; ++i) { my_mvaddstr(y + i, x, LOLITASO[(LOLITASOLENGTH + x) / 3 % LOLITASOPATTERNS][i]); } if (ACCIDENT == 1) { add_lolinarimasu(y , x + 13); } add_smoke(y - 1, x + LOLITASOFUNNEL); return OK; }
int add_erutaso(int x) { static char *erutaso[ERUTASOPATTERNS][ERUTASOHIGHT + 1] = {{ERUTASO11, ERUTASO12, ERUTASO13, ERUTASO14, ERUTASO15, ERUTASO16, ERUTASO17, ERUTASO18, ERUTASO19, ERUTASO1DEL}, {ERUTASO21, ERUTASO22, ERUTASO23, ERUTASO24, ERUTASO25, ERUTASO26, ERUTASO27, ERUTASO28, ERUTASO29, ERUTASO2DEL}, {ERUTASO31, ERUTASO32, ERUTASO33, ERUTASO34, ERUTASO35, ERUTASO36, ERUTASO37, ERUTASO38, ERUTASO39, ERUTASO3DEL}, {ERUTASO41, ERUTASO42, ERUTASO43, ERUTASO44, ERUTASO45, ERUTASO46, ERUTASO47, ERUTASO48, ERUTASO49, ERUTASO4DEL}, {ERUTASO31, ERUTASO32, ERUTASO33, ERUTASO34, ERUTASO35, ERUTASO36, ERUTASO37, ERUTASO38, ERUTASO39, ERUTASO3DEL}, {ERUTASO21, ERUTASO22, ERUTASO23, ERUTASO24, ERUTASO25, ERUTASO26, ERUTASO27, ERUTASO28, ERUTASO29, ERUTASO2DEL}}; int i, y; if (x < - ERUTASOLENGTH) return ERR; y = LINES / 2 - 3; if (FLY == 1) { y = (x / 6) + LINES - (COLS / 6) - ERUTASOHIGHT; } for (i = 0; i <= ERUTASOHIGHT; ++i) { my_mvaddstr(y + i, x, erutaso[(ERUTASOLENGTH + x) / 3 % ERUTASOPATTERNS][i]); } if (ACCIDENT == 1) { add_kininarimasu(y , x + 16); } add_smoke(y - 1, x + ERUTASOFUNNEL); return OK; }
int add_smoke(int y, int x) #define SMOKEPTNS 16 { static struct smokes { int y, x; int ptrn, kind; } S[1000]; static int sum = 0; static char *Smoke[2][SMOKEPTNS] = {{"( )", "( )", "( )", "( )", "( )", "( )" , "( )" , "( )" , "()" , "()" , "O" , "O" , "O" , "O" , "O" , " " }, {"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)", "(@@)" , "(@)" , "(@)" , "@@" , "@@" , "@" , "@" , "@" , "@" , "@" , " " }}; static char *Eraser[SMOKEPTNS] = {" ", " ", " ", " ", " ", " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " }; static int dy[SMOKEPTNS] = { 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static int dx[SMOKEPTNS] = {-2, -1, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3 }; int i; if (x < - COLS) { return 0; } if (x % 4 == 0) { for (i = 0; i < sum; ++i) { my_mvaddstr(S[i].y, S[i].x, Eraser[S[i].ptrn]); S[i].y -= dy[S[i].ptrn]; S[i].x += dx[S[i].ptrn]; S[i].ptrn += (S[i].ptrn < SMOKEPTNS - 1) ? 1 : 0; my_mvaddstr(S[i].y, S[i].x, Smoke[S[i].kind][S[i].ptrn]); } my_mvaddstr(y, x, Smoke[sum % 2][0]); S[sum].y = y; S[sum].x = x; S[sum].ptrn = 0; S[sum].kind = sum % 2; sum ++; } return 0; }
void add_man(int y, int x) { static char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}}; int i; for (i = 0; i < 2; ++i) { my_mvaddstr(y + i, x, man[(LOGOLENGTH + x) / 12 % 2][i]); } }
static int add_D51_coach_r(int x) { int y, i, j; char num[10]; if (x > ALL_LENGTH + COLS) return ERR; y = LINES / 2 - 5; for (i = 0; i <= D51HIGHT; ++i) { my_mvaddstr_r(y + i, x, d51_r[(ALL_LENGTH + x) % D51PATTERNS][i]); my_mvaddstr_r(y + i, x - 53, coal[i]); my_mvaddstr_r(y + i, x - 82, d51_r[(ALL_LENGTH + x) % D51PATTERNS][i]); my_mvaddstr_r(y + i, x - 135, coal[i]); my_mvaddstr_r(y + i, x - 164, d51_r[(ALL_LENGTH + x) % D51PATTERNS][i]); my_mvaddstr_r(y + i, x - 217, coal[i]); for (j = 0; j < PASSNUM - 1; ++j) { my_mvaddstr_r(y + i, x - 246 - (PASSLENGTH * j), coach[i]); if ( i == 3 ) { sprintf(num, "%d", j + 1); my_mvaddstr(y + i, x - 255 - (PASSLENGTH * j), num); } } my_mvaddstr_r(y + i, x - 246 - (PASSLENGTH * (PASSNUM - 1)), lcoach[i]); if ( i == 3 ) { sprintf(num, "%d", j + 1); my_mvaddstr(y + i, x - 255 - (PASSLENGTH * (PASSNUM - 1)), num); } } if (ACCIDENT == 1) { add_man(y + 2, x - 45); add_man(y + 2, x - 49); add_man(y + 2, x - 127); add_man(y + 2, x - 131); add_man(y + 2, x - 209); add_man(y + 2, x - 213); } add_smoke_r(y - 1, x - D51FUNNEL - 3); add_smoke_r(y - 1, x - D51FUNNEL - 84); add_smoke_r(y - 1, x - D51FUNNEL - 167); return OK; }
int add_C51(int x) { static char *c51[C51PATTERNS][C51HIGHT + 1] = {{C51STR1, C51STR2, C51STR3, C51STR4, C51STR5, C51STR6, C51STR7, C51WH11, C51WH12, C51WH13, C51WH14, C51DEL}, {C51STR1, C51STR2, C51STR3, C51STR4, C51STR5, C51STR6, C51STR7, C51WH21, C51WH22, C51WH23, C51WH24, C51DEL}, {C51STR1, C51STR2, C51STR3, C51STR4, C51STR5, C51STR6, C51STR7, C51WH31, C51WH32, C51WH33, C51WH34, C51DEL}, {C51STR1, C51STR2, C51STR3, C51STR4, C51STR5, C51STR6, C51STR7, C51WH41, C51WH42, C51WH43, C51WH44, C51DEL}, {C51STR1, C51STR2, C51STR3, C51STR4, C51STR5, C51STR6, C51STR7, C51WH51, C51WH52, C51WH53, C51WH54, C51DEL}, {C51STR1, C51STR2, C51STR3, C51STR4, C51STR5, C51STR6, C51STR7, C51WH61, C51WH62, C51WH63, C51WH64, C51DEL}}; static char *coal[C51HIGHT + 1] = {COALDEL, COAL01, COAL02, COAL03, COAL04, COAL05, COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL}; int y, i, dy = 0; if (x < - C51LENGTH) return ERR; y = LINES / 2 - 5; if (FLY == 1) { y = (x / 7) + LINES - (COLS / 7) - C51HIGHT; dy = 1; } for (i = 0; i <= C51HIGHT; ++i) { my_mvaddstr(y + i, x, c51[(C51LENGTH + x) % C51PATTERNS][i]); my_mvaddstr(y + i + dy, x + 55, coal[i]); } if (ACCIDENT == 1) { add_man(y + 3, x + 45); add_man(y + 3, x + 49); } add_smoke(y - 1, x + C51FUNNEL); return OK; }
static int add_man(int y, int x) { static const char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}}; int i; if ( x < 0 ) { return 0; } for (i = 0; i < 2; ++i) { my_mvaddstr(y + i, x, man[(LOGOLENGTH + x) / 12 % 2][i]); } return 0; }
int add_D51(int x) { static char *d51[D51PATTERNS][D51HIGHT + 1] = {{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7, D51WHL11, D51WHL12, D51WHL13, D51DEL}, {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7, D51WHL21, D51WHL22, D51WHL23, D51DEL}, {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7, D51WHL31, D51WHL32, D51WHL33, D51DEL}, {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7, D51WHL41, D51WHL42, D51WHL43, D51DEL}, {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7, D51WHL51, D51WHL52, D51WHL53, D51DEL}, {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7, D51WHL61, D51WHL62, D51WHL63, D51DEL}}; static char *coal[D51HIGHT + 1] = {COAL01, COAL02, COAL03, COAL04, COAL05, COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL}; int y, i, dy = 0; if (x < - D51LENGTH) return ERR; y = LINES / 2 - 5; if (FLY == 1) { y = (x / 7) + LINES - (COLS / 7) - D51HIGHT; dy = 1; } for (i = 0; i <= D51HIGHT; ++i) { my_mvaddstr(y + i, x, d51[(D51LENGTH + x) % D51PATTERNS][i]); my_mvaddstr(y + i + dy, x + 53, coal[i]); } if (ACCIDENT == 1) { add_man(y + 2, x + 43); add_man(y + 2, x + 47); } add_smoke(y - 1, x + D51FUNNEL); return OK; }
static int add_cross(int p) { int i, y, n = 20, hn; static int tt; #ifdef DEBUG char buf[100]; #endif hn = n / 2; if ( LOGO == 0) { y = LINES / 2 - 5; } else { y = LINES / 2 - 7; } for (i = 2; i < D51HIGHT; ++i) { my_mvaddstr(y + i, cros0l[i] + p, cros0[i]); } for (i = 8; i < D51HIGHT; ++i) { my_mvaddstr(y + i, p + 5, cros3[i]); } #ifdef DEBUG sprintf(buf, "%d", tt); my_mvaddstr(0, 0, buf); #endif if ( tt % n >= 0 && tt % n < hn) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "O"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "X"); my_mvaddstr(y + 5, cros0l[5] + p - 1, " || "); } else if ( tt % n >= hn && tt % n < n) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "X"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "O"); dirc(y, p); } ++tt; return 0; }
void add_lolinarimasu(int y, int x) { static char *man[2] = {"", "< kininarimasu! "}; my_mvaddstr(y , x, man[(LOLITASOLENGTH + x) / 12 % 2]); }
void add_fukuchan(int y, int x) { static char *man[2] = {"", "< FUKUCHAN! "}; my_mvaddstr(y , x, man[(MAYAKATASOLENGTH + x) / 12 % 2]); }
void add_kininarimasu(int y, int x) { static char *man[2] = {"", "< KININARIMASU! "}; my_mvaddstr(y , x, man[(ERUTASOLENGTH + x) / 12 % 2]); }
static int x_gate(int p) { int i, y, n = 20, hn; int tt; hn = n / 2; if ( LOGO == 0) { y = LINES / 2 - 5; } else { y = LINES / 2 - 7; } for (tt = 0; tt <= 20; ++tt) { for (i = 0; i < D51HIGHT; ++i) { my_mvaddstr(y + i, p + 5, cros3[i]); } for (i = 2; i < D51HIGHT; ++i) { my_mvaddstr(y + i, cros0l[i] + p, cros0[i]); } if ( tt % n >= 0 && tt % n < hn) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "O"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "X"); my_mvaddstr(y + 5, cros0l[5] + p - 1, " || "); } else if ( tt % n >= hn && tt % n < n) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "X"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "O"); dirc(y, p); } my_mvaddstr(LINES + 1, COLS + 1, ""); refresh(); usleep((USLEEP_ARG0_TYPE)WAIT_TIME); } for (tt = 0; tt <= 10; ++tt) { for (i = 0; i < D51HIGHT; ++i) { my_mvaddstr(y + i, p + 5, cros2[i]); } for (i = 2; i < D51HIGHT; ++i) { my_mvaddstr(y + i, cros0l[i] + p, cros0[i]); } if ( tt % n >= 0 && tt % n < hn) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "O"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "X"); my_mvaddstr(y + 5, cros0l[5] + p - 1, " || "); } else if ( tt % n >= hn && tt % n < n) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "X"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "O"); dirc(y, p); } my_mvaddstr(LINES + 1, COLS + 1, ""); refresh(); usleep((USLEEP_ARG0_TYPE)WAIT_TIME); } DIREC = ( DIREC + 1 ) % 2; for (tt = 0; tt <= 10; ++tt) { for (i = 0; i < D51HIGHT; ++i) { my_mvaddstr(y + i, p + 5, cros2[i]); } for (i = 2; i < D51HIGHT; ++i) { my_mvaddstr(y + i, cros0l[i] + p, cros0[i]); } if ( tt % n >= 0 && tt % n < hn) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "O"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "X"); my_mvaddstr(y + 5, cros0l[5] + p - 1, " || "); } else if ( tt % n >= hn && tt % n < n) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "X"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "O"); dirc(y, p); } my_mvaddstr(LINES + 1, COLS + 1, ""); refresh(); usleep((USLEEP_ARG0_TYPE)WAIT_TIME); } for (tt = 0; tt <= 20; ++tt) { for (i = 0; i < D51HIGHT; ++i) { my_mvaddstr(y + i, p + 5, cros3[i]); } for (i = 2; i < D51HIGHT; ++i) { my_mvaddstr(y + i, cros0l[i] + p, cros0[i]); } if ( tt % n >= 0 && tt % n < hn) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "O"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "X"); my_mvaddstr(y + 5, cros0l[5] + p - 1, " || "); } else if ( tt % n >= hn && tt % n < n) { my_mvaddstr(y + 4, cros0l[5] + p - 1, "X"); my_mvaddstr(y + 4, cros0l[5] + p + 2, "O"); dirc(y, p); } my_mvaddstr(LINES + 1, COLS + 1, ""); refresh(); usleep((USLEEP_ARG0_TYPE)WAIT_TIME); } return 0; }