#include #include #ifndef UNIX #include #include #endif #include "aplinks.h" #include "disp_ctr.h" #ifdef UNIX #include "stricmp.h" #include "delay.h" #include "kbhit.h" #include "getch.h" #endif #define LAST_ST_FRAME_NUM 9 #define LAST_SU_FRAME_NUM 4 #define DELAY_TIME 100 int cup_x; int cup_y; char su_frame[LAST_SU_FRAME_NUM][5] = { "~~~~", "~-~-", "~~~~", "-~-~" }; char st_frame[LAST_ST_FRAME_NUM][9] = { " _ ", " _- ", " _-- ", " _--~", " _-~~", " -~~", " ~~", " ~", " "}; int chk_anim(int argc, char *argv[]) { int i; int anim; anim = DEFAULT_ANIM; for(i = 1; i < argc; i++){ if(stricmp(argv[i], "-A") == 0){ anim = ON; continue; } else if(stricmp(argv[i], "-A-") == 0){ anim = OFF; } } return anim; } int sig_anim(int anim, int m_colum, int m_row) { int i; if(anim == OFF){ return 0; } cup_x = (m_colum / 2) - 10; cup_y = (m_row) / 2; cls(); #ifndef UNIX cursor_off(); #endif disp_cup(); delay(500); anim_coffee(); for(i = 0; i < (LAST_ST_FRAME_NUM * 1); i++){ anim_surface(); anim_steam(); delay(DELAY_TIME); } disp_noike(); anim_surface(); anim_signboard(); /* in this function, call anim_surface(), anim_steam() and delay(DELAY_TIME); */ for(i = 0; i < (LAST_ST_FRAME_NUM * 3) - 12; i++){ anim_surface(); anim_steam(); delay(DELAY_TIME); } delay(DELAY_TIME * 4); cursor_on(); cls(); delay(DELAY_TIME * 4); return 0; } int disp_cup(void) { xyc_printf(cup_x, cup_y , -1, "| |_ "); xyc_printf(cup_x, cup_y + 1, -1, "| | )"); xyc_printf(cup_x, cup_y + 2, -1, "|____| "); #ifdef UNIX xy_printf(1, 1, "\n"); #endif return 0; } int anim_coffee(void) { int i; for(i = 1; i >= 0; i--){ xyc_printf(cup_x + 1, cup_y + i, -1, "____"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); xyc_printf(cup_x + 1, cup_y + i, -1, "_-_-"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); #ifdef KOMA xyc_printf(cup_x + 1, cup_y + i, -1, "-_-_"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); #endif xyc_printf(cup_x + 1, cup_y + i, -1, "----"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); #ifdef KOMA xyc_printf(cup_x + 1, cup_y + i, -1, "-~-~"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); #endif xyc_printf(cup_x + 1, cup_y + i, -1, "~-~-"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); xyc_printf(cup_x + 1, cup_y + i, -1, "~~~~"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif if(i == 0){ break; } delay(DELAY_TIME); xyc_printf(cup_x + 1, cup_y+i-1, -1, " _ _"); xyc_printf(cup_x + 1, cup_y + i, -1, "~ ~ "); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); #ifdef KOMA xyc_printf(cup_x + 1, cup_y+i-1, -1, "_ _ "); xyc_printf(cup_x + 1, cup_y + i, -1, " ~ ~"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif delay(DELAY_TIME); #endif xyc_printf(cup_x + 1, cup_y+i-1, -1, " "); xyc_printf(cup_x + 1, cup_y + i, -1, " "); #ifdef UNIX xy_printf(1, 1, "\n"); #endif } xyc_printf(cup_x + 1, cup_y, -1, "~~~~"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif return 0; } int anim_surface(void) { static int su_frame_num; xyc_printf(cup_x + 1, cup_y, -1, "%s", su_frame[su_frame_num]); #ifdef UNIX xy_printf(1, 1, "\n"); #endif su_frame_num++; if(su_frame_num == LAST_SU_FRAME_NUM){ su_frame_num = 0; } return 0; } int anim_steam(void) { static double st_frame_num; xyc_printf(cup_x, cup_y - 1, -1, "%s", st_frame[(int)st_frame_num]); #ifdef UNIX xy_printf(1, 1, "\n"); #endif st_frame_num += 0.5; if((int)st_frame_num == LAST_ST_FRAME_NUM){ st_frame_num = 0; } return 0; } int disp_noike(void) { xyc_printf(cup_x + 1, cup_y + 1, -1, "àÝàê"); xyc_printf(cup_x + 8, cup_y + 1, -1, "O_(^^) "); xyc_printf(cup_x + 8, cup_y + 2, -1, " NOIKE"); #ifdef UNIX xy_printf(1, 1, "\n"); #endif return 0; } int anim_signboard(void) { int i, j; char board[4][11] = { "---------", "|ID:4167|", "|-------|", " | "}; for(i = 0; i < 4; i++){ for(j = 0; j <= i; j++){ xyc_printf(cup_x + 17, cup_y + 2 - i + j, -1, "%s", board[j]); #ifdef UNIX xy_printf(1, 1, "\n"); #endif } anim_surface(); anim_steam(); delay(DELAY_TIME); } return 0; } #if 0 _-~~ --------- |----|_ |ID:4167| |àÛàè| )O_(^^) |-------| |____| NOIKE | #endif