版本比较
基本功能
正文
增加 39 行删除 39 行
17 行未改动1819202122222324252627282930313232333435363 行未改动4041424344444546474849505151525354554 行未改动606162636464656667685 行未改动7475767778787980818276 行未改动15916016116216316316416516616716816916917017117217324 行未改动19819920020120220220320420520520620720820920921021121221321421521621721821921922022122222325 行未改动2492502512522532532542552562574 行未改动26226326426526626626726826927029 行未改动30030130230330430430530630730827 行未改动336337338339340340341342343344345346347348349350350351352353354159 行未改动全部展开5145155165175185185195205215224 行未改动52752852953053153153253353453513 行未改动54955055155255355355455555655783 行未改动6416426436446456456466476486496 行未改动65665765865966066066166266366410 行未改动67567667767867967968068168168268368468544 行未改动73073173273373473473573673773837 行未改动7767777787797807807817827837847857867877887897897907917927936 行未改动80080180280380480480580680780818 行未改动82782882983083183183283383483524 行未改动86086186286386486486586686786819 行未改动88888989089189289289389489589655 行未改动95295395495595695695795895996089 行未改动105010511052105310541054105510561057105851 行未改动11101111111211131114111511141115111611171118111949 行未改动11691170117111721173117311741175117611761177117811791180118111821183118411851186118611871188118911901191119211931194119511951196119711981199120017 行未改动 int anim; }plane;//控制台小飞机
void Handle(bool flag) { 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) void SetConsole(int x, int y)
{
COORD position;3 行未改动
}//建立函数 移动光标 第一个参数为行
void Clear(int x, int y, int lenth) { void Clear(int x, int y, int lenth) { SetConsole(x, y); REP(i, 1, lenth) printf(" "); }//清除第x行y列开始的控制台输出 注:清除完后需要重定向
void Print(string s, int t) { void Print(string s, int t) { for (int i = 0; i < s.size(); i++) { //使用UNICODE if (s[i] < 0) { //汉字 cout << s[i] << s[i + 1]; i++;4 行未改动 }//实现间隔一定时间输出一个字
void Loading() { for (int i = 1; i <= 5; i++) { 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) { 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) { 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) { 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(" "); printf(" "); BackgroundBlack(); }void Drawand(int x, int y) { void Drawand(int x, int y) { x++;//比其他两个字母少一行 y -= 2;//画的时候多了两格出来 SetConsole(x, y + 5); BackgroundWhite(); printf(" "); 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) { 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) { 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() { void PrintPlane() { //(x, y)为机头坐标 所以-2 switch (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) { 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() { 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() { 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) { 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) { if (runTime - lastRushAnim > t) { animRush = (animRush + 70) % 140; lastRushAnim = runTime; } if (player.rush == 1) {//冲刺10 行未改动 } }//绘制高达 t为火焰喷射循环时间
void DrawBullet() { void DrawBullet() { REP(i, 0, 39) { if (bullet[i].alive) { 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() { 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) { 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) { 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;//太快重复bug REP(i, 0, 39) { REP(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) { 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) {//战斗模式 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) { 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("良好")); 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) {
if (indexDialogue >= 9) { outtextxy(920, 572, _T(" >战斗模块:")); if (indexDialogue == 9) { setcolor(RGB(255, 215, 0)); outtextxy(1020, 572, _T("LOADING"));49 行未改动 DrawExplode(); }//总绘制函数
void Chapter2() { void Chapter2() { InitGraph(); BeginBatchDraw();//双缓冲绘图 while (1) { while (1) { GameDraw(); FlushBatchDraw(); runTime++; Sleep(1); } EndBatchDraw(); }
int main() { int main() { //Init(); //_getch();
//Chapter1(); Chapter2();
//Handle(FALSE); //test1();
getchar(); return 0; }```