正文
增加 39 行删除 39 行
17 行未改动181920212223242526272829303132333435363 行未改动404142434445464748495051525354554 行未改动6061626364656667685 行未改动74757677787980818276 行未改动15916016116216316416516616716816917017117217324 行未改动19819920020120220320420520620720820921021121221321421521621721821922022122222325 行未改动2492502512522532542552562574 行未改动26226326426526626726826927029 行未改动30030130230330430530630730827 行未改动336337338339340341342343344345346347348349350351352353354159 行未改动全部展开5145155165175185195205215224 行未改动52752852953053153253353453513 行未改动54955055155255355455555655783 行未改动6416426436446456466476486496 行未改动65665765865966066166266366410 行未改动67567667767867968068168268368468544 行未改动73073173273373473573673773837 行未改动7767777787797807817827837847857867877887897907917927936 行未改动80080180280380480580680780818 行未改动82782882983083183283383483524 行未改动86086186286386486586686786819 行未改动88888989089189289389489589655 行未改动95295395495595695795895996089 行未改动10501051105210531054105510561057105851 行未改动111011111112111311141115111611171118111949 行未改动1169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120017 行未改动int anim;}plane;//控制台小飞机void Handle(bool flag) {HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);CONSOLE_CURSOR_INFO cci;GetConsoleCursorInfo(hOut, &cci);cci.bVisible = flag;SetConsoleCursorInfo(hOut, &cci);}//隐藏控制台光标void SetConsole(int x, int y){COORD position;3 行未改动}//建立函数 移动光标 第一个参数为行void Clear(int x, int y, int lenth) {SetConsole(x, y);REP(i, 1, lenth)printf(" ");}//清除第x行y列开始的控制台输出 注:清除完后需要重定向void Print(string s, int t) {for (int i = 0; i < s.size(); i++) { //使用UNICODEif (s[i] < 0) { //汉字cout << s[i] << s[i + 1];i++;4 行未改动}//实现间隔一定时间输出一个字void Loading() {for (int i = 1; i <= 5; i++) {printf("/ ");Sleep(200); printf("\b\b");printf("- ");Sleep(200); printf("\b\b");5 行未改动printf(" ");}//转圈圈void DrawDialogBox(int x, int y, int numLine) {SetConsole(x, y);printf(" ————————");for (int i = 1; i <= numLine - 2; i++) {SetConsole(x + i, y);76 行未改动printf("—");}//绘制从x1到x2的控制台操作窗口void AnimMap(int x1, int x2, int y, int lenth) {int mid = (x1 + x2) / 2;SetConsole(mid, y);Print(" ", 3);REP(i, 1, lenth)Print("—", 3);REP(i, 1, (x2 - x1) / 2) {DrawMap(mid - i, mid + i, y, lenth);Sleep(10);}}24 行未改动printf(" "); SetConsole(x + 3, y);printf(" "); BackgroundBlack(); printf(" "); BackgroundWhite(); printf(" "); SetConsole(x + 4, y);printf(" "); BackgroundBlack(); printf(" "); BackgroundWhite(); printf(" "); SetConsole(x + 5, y);printf(" "); BackgroundBlack(); printf(" "); BackgroundWhite(); printf(" "); SetConsole(x + 6, y);printf(" ");BackgroundBlack();}void Drawand(int x, int y) {x++;//比其他两个字母少一行y -= 2;//画的时候多了两格出来SetConsole(x, y + 5); BackgroundWhite();printf(" ");SetConsole(x + 1, y + 4); printf(" ");SetConsole(x + 1, y + 8); printf(" ");SetConsole(x + 2, y + 5); printf(" ");SetConsole(x + 3, y + 3); printf(" "); SetConsole(x + 3, y + 7); printf(" ");SetConsole(x + 3, y + 9); printf(" ");SetConsole(x + 4, y + 2); printf(" "); SetConsole(x + 4, y + 8); printf(" ");SetConsole(x + 5, y + 3); printf(" "); SetConsole(x + 5, y + 9); printf(" ");BackgroundBlack();}void DrawK(int x, int y) {BackgroundWhite();SetConsole(x, y);printf(" "); SetConsole(x, y + 8); printf(" ");SetConsole(x + 1, y); printf(" "); SetConsole(x + 1, y + 6); printf(" ");SetConsole(x + 2, y); printf(" "); SetConsole(x + 2, y + 4); printf(" ");25 行未改动}//输出对话,定位跟随对话框int consoleX, consoleY;void PrintConsole(int x, string content, int speed, bool stop) {SetConsole(consoleX + x, consoleY);cout << " ";SetConsole(consoleX + x, consoleY);Print(content, speed);4 行未改动}//从控制台第x行输出控制台内容(从0开始)void PrintPlane() {//(x, y)为机头坐标 所以-2switch (plane.anim) { //先写绘制case 0 :SetConsole(plane.x, plane.y - 2);29 行未改动if (plane.y < 3)plane.y = 3;if (plane.y > 61)plane.y = 61;}void MovePlane(int speed) {plane.preX = plane.x, plane.preY = plane.y;Clear(plane.preX, plane.preY - 2, 6);Clear(plane.preX + 1, plane.preY - 2, 6);Clear(plane.preX + 2, plane.preY - 2, 6);27 行未改动if (consolePlaneLeftTime < 7000) {SetConsole(consoleX + 1, consoleY);cout << "通讯记录云同步信号: ";ForeYellow(); cout << "一般"; BackgroundBlack();}if (consolePlaneLeftTime < 6400) {SetConsole(consoleX + 1, consoleY);cout << "通讯记录云同步信号: ";ForeGreen(); cout << "良好"; BackgroundBlack();}return 1;}void Chapter1() {puts("GRIFFIN & KRYUGER Combat Operation System[版本 10.0.19042.1348]");puts("(c) GRIFFIN & KRYUGER Corporation。保留所有权利。\n");printf("C:\\Users\\Commander>");Sleep(3000);159 行未改动全部展开IMAGE img_explode[2];void LoadResource() {loadimage(&img_background, _T("./image/background/Background.jpg"));loadimage(&img_backbackground, _T("./image/background/backbackground4.png"));loadimage(&img_dialoguebox, _T("./image/UI/dialoguebox.png"));4 行未改动loadimage(&img_gundam[1], _T("./image/player/Gundam.png"));loadimage(&img_rush[0], _T("./image/player/rushxor.jpg"));loadimage(&img_rush[1], _T("./image/player/rush2.png"));loadimage(&img_idle[0], _T("./image/player/Idlexor.jpg"));loadimage(&img_idle[1], _T("./image/player/Idle.png"));loadimage(&img_idle[2], _T("./image/player/Idledark1.png"));13 行未改动}//载入图片资源int lastUpdateBackground, backgroundY = 981;void PrintBackground(int t) {if (runTime - lastUpdateBackground > t && backgroundY > 0) {backgroundY--;lastUpdateBackground = runTime;}83 行未改动}enemy[40];int lastRushAnim, animRush = 0;void DrawPlayer(){if (!player.animHit) {putimage(player.x + 59, player.y, 70, 85, &img_gundam[0], (player.anim + 2) * 70, 0, NOTSRCERASE);//绘制高达本体putimage(player.x + 59, player.y, 70, 85, &img_gundam[1], (player.anim + 2) * 70, 0, SRCINVERT);}6 行未改动int t;//喷射闪烁时间if (player.rush == -1)t = 10;//惩罚闪烁变慢else t = 5;if (runTime - lastRushAnim > t) {animRush = (animRush + 70) % 140;lastRushAnim = runTime;}if (player.rush == 1) {//冲刺10 行未改动}}//绘制高达 t为火焰喷射循环时间void DrawBullet() {REP(i, 0, 39) {if (bullet[i].alive) {putimage(bullet[i].x + 59, bullet[i].y, &img_bullet[0], NOTSRCERASE);putimage(bullet[i].x + 59, bullet[i].y, &img_bullet[1], SRCINVERT);}}44 行未改动}}}void GundamPositionJudge() {if (player.x < 0)player.x = 0;if (player.y < 0)player.y = 0;if (player.x + 70 > 850)player.x = 850 - 70;if (player.y + 85 > 720)player.y = 720 - 85;37 行未改动lastRushPunishTime = runTime;punishing = 1;punishReady = 0;}if (punishing) {//printf("punish----%d%%\n", (runTime - lastRushPunishTime) * 100 / rushPunishTime);}if (runTime - lastRushPunishTime > rushPunishTime && punishing) {//检查结束惩罚punishing = 0;player.speed = 5;player.rush = 0;}REP(i, 0, 39) { //子弹相关if (bullet[i].alive) {bullet[i].x += bullet[i].speedX;bullet[i].y += bullet[i].speedY;if (bullet[i].y < -30 || bullet[i].x < -4 || bullet[i].x > 831)bullet[i].alive = false;REP(j, 0, 39) {6 行未改动}}}}REP(i, 0, 39) {//敌机相关if (enemy[i].alive) {enemy[i].x += enemy[i].speedX;//更新位置enemy[i].y += enemy[i].speedY;18 行未改动//检查位置合法、检查状态更新等void CreatBullet(int x, int y, bool isplayer, int speedX) {static int lastCreatBulletTime = -999, creatBulletCD = 5;//太快重复bugREP(i, 0, 39) {if (!bullet[i].alive && runTime - lastCreatBulletTime > creatBulletCD) {lastCreatBulletTime = runTime;bullet[i].x = x + 21, bullet[i].y = y;bullet[i].speedX = speedX;24 行未改动}}int animValue, bulletDegree, degreeValue;void MoveGundam(int speed) {if (player.opt == -1)return;bool flag1 = false, flag2 = false;if (GetAsyncKeyState('W'))player.y -= speed;if (GetAsyncKeyState('S'))player.y += speed;19 行未改动if (GetAsyncKeyState(VK_SPACE)) {if (player.opt == 1 && singleFinish) {continueDialogue = true;}else if (player.opt == 2) {//战斗模式CreatBullet(player.x, player.y, true, bulletDegree);}}if (!flag1) {//AD没按或者全按,复位55 行未改动}break;case 10:if (indexDialogue < 4)return;//到第三句前不触发if (indexDialogue == 4) {player.opt = 0;//对话禁止bulletDegree = 0;rushCD = 2000;//CD 999999 -> 2000 就是开启这个功能if (player.rush) {89 行未改动}void PrintConsoleText() {outtextxy(920, 452, _T("通讯记录云同步信号:"));//第一行if (tongxun == 1) setcolor(GREEN),outtextxy(1080, 452, _T("良好"));else if (tongxun == 0) setcolor(YELLOW), outtextxy(1080, 452, _T("一般"));else setcolor(RED), outtextxy(1080, 452, _T("极差"));setcolor(WHITE);51 行未改动else setcolor(RGB(255, 215, 0)), outtextxy(1040, 552, s), setcolor(WHITE);}}}if (indexDialogue >= 9) {outtextxy(920, 572, _T(" >战斗模块:"));if (indexDialogue == 9) {setcolor(RGB(255, 215, 0));outtextxy(1020, 572, _T("LOADING"));49 行未改动DrawExplode();}//总绘制函数void Chapter2() {InitGraph();BeginBatchDraw();//双缓冲绘图while (1) {GameDraw();FlushBatchDraw();runTime++;Sleep(1);}EndBatchDraw();}int main() {//Init();//_getch();//Chapter1();Chapter2();//Handle(FALSE);//test1();getchar();return 0;}```17 行未改动181920212223242526272829303132333435363 行未改动404142434445464748495051525354554 行未改动6061626364656667685 行未改动74757677787980818276 行未改动15916016116216316416516616716816917017117217324 行未改动19819920020120220320420520620720820921021121221321421521621721821922022122222325 行未改动2492502512522532542552562574 行未改动26226326426526626726826927029 行未改动30030130230330430530630730827 行未改动336337338339340341342343344345346347348349350351352353354159 行未改动全部展开5145155165175185195205215224 行未改动52752852953053153253353453513 行未改动54955055155255355455555655783 行未改动6416426436446456466476486496 行未改动65665765865966066166266366410 行未改动67567667767867968068168268368468544 行未改动73073173273373473573673773837 行未改动7767777787797807817827837847857867877887897907917927936 行未改动80080180280380480580680780818 行未改动82782882983083183283383483524 行未改动86086186286386486586686786819 行未改动88888989089189289389489589655 行未改动95295395495595695795895996089 行未改动10501051105210531054105510561057105851 行未改动111011111112111311141115111611171118111949 行未改动1169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120017 行未改动int anim;}plane;//控制台小飞机void Handle(bool flag) {HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);CONSOLE_CURSOR_INFO cci;GetConsoleCursorInfo(hOut, &cci);cci.bVisible = flag;SetConsoleCursorInfo(hOut, &cci);}//隐藏控制台光标void SetConsole(int x, int y){COORD position;3 行未改动}//建立函数 移动光标 第一个参数为行void Clear(int x, int y, int lenth) {SetConsole(x, y);REP(i, 1, lenth)printf(" ");}//清除第x行y列开始的控制台输出 注:清除完后需要重定向void Print(string s, int t) {for (int i = 0; i < s.size(); i++) { //使用UNICODEif (s[i] < 0) { //汉字cout << s[i] << s[i + 1];i++;4 行未改动}//实现间隔一定时间输出一个字void Loading() {for (int i = 1; i <= 5; i++) {printf("/ ");Sleep(200); printf("\b\b");printf("- ");Sleep(200); printf("\b\b");5 行未改动printf(" ");}//转圈圈void DrawDialogBox(int x, int y, int numLine) {SetConsole(x, y);printf(" ————————");for (int i = 1; i <= numLine - 2; i++) {SetConsole(x + i, y);76 行未改动printf("—");}//绘制从x1到x2的控制台操作窗口void AnimMap(int x1, int x2, int y, int lenth) {int mid = (x1 + x2) / 2;SetConsole(mid, y);Print(" ", 3);REP(i, 1, lenth)Print("—", 3);REP(i, 1, (x2 - x1) / 2) {DrawMap(mid - i, mid + i, y, lenth);Sleep(10);}}24 行未改动printf(" "); SetConsole(x + 3, y);printf(" "); BackgroundBlack(); printf(" "); BackgroundWhite(); printf(" "); SetConsole(x + 4, y);printf(" "); BackgroundBlack(); printf(" "); BackgroundWhite(); printf(" "); SetConsole(x + 5, y);printf(" "); BackgroundBlack(); printf(" "); BackgroundWhite(); printf(" "); SetConsole(x + 6, y);printf(" ");BackgroundBlack();}void Drawand(int x, int y) {x++;//比其他两个字母少一行y -= 2;//画的时候多了两格出来SetConsole(x, y + 5); BackgroundWhite();printf(" ");SetConsole(x + 1, y + 4); printf(" ");SetConsole(x + 1, y + 8); printf(" ");SetConsole(x + 2, y + 5); printf(" ");SetConsole(x + 3, y + 3); printf(" "); SetConsole(x + 3, y + 7); printf(" ");SetConsole(x + 3, y + 9); printf(" ");SetConsole(x + 4, y + 2); printf(" "); SetConsole(x + 4, y + 8); printf(" ");SetConsole(x + 5, y + 3); printf(" "); SetConsole(x + 5, y + 9); printf(" ");BackgroundBlack();}void DrawK(int x, int y) {BackgroundWhite();SetConsole(x, y);printf(" "); SetConsole(x, y + 8); printf(" ");SetConsole(x + 1, y); printf(" "); SetConsole(x + 1, y + 6); printf(" ");SetConsole(x + 2, y); printf(" "); SetConsole(x + 2, y + 4); printf(" ");25 行未改动}//输出对话,定位跟随对话框int consoleX, consoleY;void PrintConsole(int x, string content, int speed, bool stop) {SetConsole(consoleX + x, consoleY);cout << " ";SetConsole(consoleX + x, consoleY);Print(content, speed);4 行未改动}//从控制台第x行输出控制台内容(从0开始)void PrintPlane() {//(x, y)为机头坐标 所以-2switch (plane.anim) { //先写绘制case 0 :SetConsole(plane.x, plane.y - 2);29 行未改动if (plane.y < 3)plane.y = 3;if (plane.y > 61)plane.y = 61;}void MovePlane(int speed) {plane.preX = plane.x, plane.preY = plane.y;Clear(plane.preX, plane.preY - 2, 6);Clear(plane.preX + 1, plane.preY - 2, 6);Clear(plane.preX + 2, plane.preY - 2, 6);27 行未改动if (consolePlaneLeftTime < 7000) {SetConsole(consoleX + 1, consoleY);cout << "通讯记录云同步信号: ";ForeYellow(); cout << "一般"; BackgroundBlack();}if (consolePlaneLeftTime < 6400) {SetConsole(consoleX + 1, consoleY);cout << "通讯记录云同步信号: ";ForeGreen(); cout << "良好"; BackgroundBlack();}return 1;}void Chapter1() {puts("GRIFFIN & KRYUGER Combat Operation System[版本 10.0.19042.1348]");puts("(c) GRIFFIN & KRYUGER Corporation。保留所有权利。\n");printf("C:\\Users\\Commander>");Sleep(3000);159 行未改动全部展开IMAGE img_explode[2];void LoadResource() {loadimage(&img_background, _T("./image/background/Background.jpg"));loadimage(&img_backbackground, _T("./image/background/backbackground4.png"));loadimage(&img_dialoguebox, _T("./image/UI/dialoguebox.png"));4 行未改动loadimage(&img_gundam[1], _T("./image/player/Gundam.png"));loadimage(&img_rush[0], _T("./image/player/rushxor.jpg"));loadimage(&img_rush[1], _T("./image/player/rush2.png"));loadimage(&img_idle[0], _T("./image/player/Idlexor.jpg"));loadimage(&img_idle[1], _T("./image/player/Idle.png"));loadimage(&img_idle[2], _T("./image/player/Idledark1.png"));13 行未改动}//载入图片资源int lastUpdateBackground, backgroundY = 981;void PrintBackground(int t) {if (runTime - lastUpdateBackground > t && backgroundY > 0) {backgroundY--;lastUpdateBackground = runTime;}83 行未改动}enemy[40];int lastRushAnim, animRush = 0;void DrawPlayer(){if (!player.animHit) {putimage(player.x + 59, player.y, 70, 85, &img_gundam[0], (player.anim + 2) * 70, 0, NOTSRCERASE);//绘制高达本体putimage(player.x + 59, player.y, 70, 85, &img_gundam[1], (player.anim + 2) * 70, 0, SRCINVERT);}6 行未改动int t;//喷射闪烁时间if (player.rush == -1)t = 10;//惩罚闪烁变慢else t = 5;if (runTime - lastRushAnim > t) {animRush = (animRush + 70) % 140;lastRushAnim = runTime;}if (player.rush == 1) {//冲刺10 行未改动}}//绘制高达 t为火焰喷射循环时间void DrawBullet() {REP(i, 0, 39) {if (bullet[i].alive) {putimage(bullet[i].x + 59, bullet[i].y, &img_bullet[0], NOTSRCERASE);putimage(bullet[i].x + 59, bullet[i].y, &img_bullet[1], SRCINVERT);}}44 行未改动}}}void GundamPositionJudge() {if (player.x < 0)player.x = 0;if (player.y < 0)player.y = 0;if (player.x + 70 > 850)player.x = 850 - 70;if (player.y + 85 > 720)player.y = 720 - 85;37 行未改动lastRushPunishTime = runTime;punishing = 1;punishReady = 0;}if (punishing) {//printf("punish----%d%%\n", (runTime - lastRushPunishTime) * 100 / rushPunishTime);}if (runTime - lastRushPunishTime > rushPunishTime && punishing) {//检查结束惩罚punishing = 0;player.speed = 5;player.rush = 0;}REP(i, 0, 39) { //子弹相关if (bullet[i].alive) {bullet[i].x += bullet[i].speedX;bullet[i].y += bullet[i].speedY;if (bullet[i].y < -30 || bullet[i].x < -4 || bullet[i].x > 831)bullet[i].alive = false;REP(j, 0, 39) {6 行未改动}}}}REP(i, 0, 39) {//敌机相关if (enemy[i].alive) {enemy[i].x += enemy[i].speedX;//更新位置enemy[i].y += enemy[i].speedY;18 行未改动//检查位置合法、检查状态更新等void CreatBullet(int x, int y, bool isplayer, int speedX) {static int lastCreatBulletTime = -999, creatBulletCD = 5;//太快重复bugREP(i, 0, 39) {if (!bullet[i].alive && runTime - lastCreatBulletTime > creatBulletCD) {lastCreatBulletTime = runTime;bullet[i].x = x + 21, bullet[i].y = y;bullet[i].speedX = speedX;24 行未改动}}int animValue, bulletDegree, degreeValue;void MoveGundam(int speed) {if (player.opt == -1)return;bool flag1 = false, flag2 = false;if (GetAsyncKeyState('W'))player.y -= speed;if (GetAsyncKeyState('S'))player.y += speed;19 行未改动if (GetAsyncKeyState(VK_SPACE)) {if (player.opt == 1 && singleFinish) {continueDialogue = true;}else if (player.opt == 2) {//战斗模式CreatBullet(player.x, player.y, true, bulletDegree);}}if (!flag1) {//AD没按或者全按,复位55 行未改动}break;case 10:if (indexDialogue < 4)return;//到第三句前不触发if (indexDialogue == 4) {player.opt = 0;//对话禁止bulletDegree = 0;rushCD = 2000;//CD 999999 -> 2000 就是开启这个功能if (player.rush) {89 行未改动}void PrintConsoleText() {outtextxy(920, 452, _T("通讯记录云同步信号:"));//第一行if (tongxun == 1) setcolor(GREEN),outtextxy(1080, 452, _T("良好"));else if (tongxun == 0) setcolor(YELLOW), outtextxy(1080, 452, _T("一般"));else setcolor(RED), outtextxy(1080, 452, _T("极差"));setcolor(WHITE);51 行未改动else setcolor(RGB(255, 215, 0)), outtextxy(1040, 552, s), setcolor(WHITE);}}}if (indexDialogue >= 9) {outtextxy(920, 572, _T(" >战斗模块:"));if (indexDialogue == 9) {setcolor(RGB(255, 215, 0));outtextxy(1020, 572, _T("LOADING"));49 行未改动DrawExplode();}//总绘制函数void Chapter2() {InitGraph();BeginBatchDraw();//双缓冲绘图while (1) {GameDraw();FlushBatchDraw();runTime++;Sleep(1);}EndBatchDraw();}int main() {//Init();//_getch();//Chapter1();Chapter2();//Handle(FALSE);//test1();getchar();return 0;}```