📄 mine.c
字号:
#include "include.c"
int flag_gameover, flag_exit, flag_fresh;
void graph_init(){
diamond_init();
score_init();
alpha_init();
hz_init();
Set_Video_Mode(VGA256);
mouse_init("mouse_0.bmp", MOUSE_SMALL, 0, 0);
}
void setting_init(){
BMP_LoadScreen("ground_0.bmp");
randomize();
clk.chd = 0;
score = 0;
flag_gameover = 0;
flag_exit = 0;
}
void release(){
Set_Video_Mode(TEXT_MODE);
nosound();
flag_gdon = 0;
printf("Diamond Mine Version 0.1.1(May 20, 2004)\n");
printf("Written by: Chenxing Yang\n");
printf(" Jia Xu\n");
printf(" Chengxing Gao\n");
printf("From Zhejiang University College of Computer Science\n");
printf("Thank you for playing this game!");
mouse_wait();
exit(0);
}
void newgame(){
mouse_get();
mouse_putback();
setting_init();
mouse_getback();
mouse_showcur();
diamond_fresh();
while (diamond_check(1))
diamond_fill();
diamond_showall();
score_out();
}
void aboutus(){
mouse_putback();
clean_black(120, 0, 200, 200);
BMP_DirectShow("about_2.bmp", ABOUTUS_X, ABOUTUS_Y);
mouse_get();
mouse_getback();
mouse_showcur();
mouse_wait();
mouse_putback();
clean_black(120, 0, 200, 200);
mouse_get();
mouse_getback();
diamond_showall();
}
void gameover(){
mouse_putback();
BMP_DirectShow("over_2.bmp", GAMEOVER_X, GAMEOVER_Y);
mouse_get();
mouse_getback();
mouse_showcur();
mouse_wait();
clean_black(120, 0, 200, 200);
diamond_showall();
if (hiscore_newhiscore())
hiscore_savehiscore();
flag_gameover = 1;
}
void main(){
long temp, times;
unsigned key;
graph_init();
sound_init();
newgame();
while (kbhit()) getch();
do{
sound_gdserver();
diamond_flashserver();
if (clk.chd) diamond_choose();
else if (mouse_move) mouse_fresh();
if (kbhit()){
key = getch();
if (key == 27) flag_exit = 1; else
if (key == 0){
key = getch();
switch (key){
case 59 : newgame();
case 60 : aboutus();
case 61 : hiscore_show();
// case 62 : if (hiscore_newhiscore()) hiscore_savehiscore();
case 63 : flag_gdon = !flag_gdon;
}
}
}
mouse_get();
if (!flag_gameover && diamond_nomove()) gameover();
if (mouse_left_up){
if (on_diamonds()){
if (diamond_cur(), diamond_click()){
diamond_change();
if (!(temp = diamond_check(times = 1)))
diamond_change();
else
do{
score += temp;
score_out();
diamond_showall();
sound_clean();
diamond_fall();
}while(temp = diamond_check(times *= 2));
}
}
else if (on_exit_btn()) flag_exit = 1;
else if (on_new_btn()) newgame();
else if (on_about_btn()) aboutus();
else if (on_hiscore_btn()) hiscore_show();
}
/* if (mouse_right_up && hiscore_newhiscore()) hiscore_savehiscore();*/
}while(!flag_exit);
if (hiscore_newhiscore()) hiscore_savehiscore();
release();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -