![](/user_photo/1992_2odKD.png)
Добавил:
Mymnan
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:КПиЯП. Курсовые / kurs / pacman / Pacman
.Cpp#include<iostream.h>
#include<ctype.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<time.h>
#include<graphics.h>
#include<bios.h>
#include<dos.h>
#include<stdlib.h>
#include<dir.h>
#include<string.h>
char *level[]={"","level1.lvl","level2.lvl","level3.lvl","level4.lvl"
,"level5.lvl","level6.lvl","level7.lvl","level8.lvl"
,"level9.lvl","level10.lvl"};
char userF[10]="user.sav";
char scorF[10]="score.sav";
int mass[20][28];
//struct temp
struct temp
{
int starcounter;
int loadedlevel;
int score;
double loadedtime;
}tmp;
//struct coord
struct coord
{
int x;
int y;
int xx;
int yy;
}cr;
//struct star
struct star
{
int x;
int y;
int size;
}str;
//struct pacman
struct pacman
{
int x;
int y;
int size;
int eye;
}pac;
//struct enemy
struct enemy
{
int x;
int y;
int size;
int eye;
}ene;
//struct ExiT
struct ExiT
{
int x;
int y;
int r;
}ex;
//struct mas
struct mas
{
double x;
double y;
int val;
}ms2;
//struct lock
struct lock
{
double x;
double y;
int size;
int r;
}lo;
//struct User
struct User
{
int life;
double level;
int score;
char name[8];
double time;
}us;
struct Hscore
{
int score;
double time;
char name[8];
}sc;
//struct all
struct all
{
double coor;
double stars;
double enemies;
int pacman;
int exit;
double mas;
int lock;
}al;
class QueneNode
{
friend class Quene;
public:
QueneNode(char*,int,double);
private:
QueneNode *nextptr;
char name[10];
int score;
double time;
};
QueneNode::QueneNode(char *Name,int scor,double tim)
{
strcpy(name,Name);
score=scor;
time=tim;
nextptr=0;
}
class Quene
{
public:
Quene();
Quene &fill();
Quene &addNew(char *,int,double);
int Empty(){return firstptr==0;}
void toFile();
Quene &clear();
Quene &sort();
private:
QueneNode *firstptr;
QueneNode *lastptr;
int counter;
}quene;
Quene::Quene()
{
firstptr=lastptr=0;
counter=0;
}
Quene &Quene::clear()
{
if(!Empty()){
QueneNode *curptr=firstptr,*tempptr;
while(curptr!=0){
tempptr=curptr;
curptr=curptr->nextptr;
delete tempptr;
}
}
sc.time=0;
sc.score=0;
char bl[1]="\0";
strcpy(sc.name,bl);
return *this;
}
Quene &Quene::fill()
{
ifstream file(scorF);
file.read((char*)&sc,sizeof(Hscore));
while(!file.eof()){
if(sc.time!=0){
addNew(sc.name,sc.score,sc.time);
}
file.read((char*)&sc,sizeof(Hscore));
}
file.close();
return *this;
}
Quene &Quene::addNew(char *name,int score,double time)
{
QueneNode *newptr=new QueneNode(name,score,time);
if(Empty()){
firstptr=lastptr=newptr;
counter++;
}
else{
lastptr->nextptr=newptr;
lastptr=newptr;
counter++;
}
return *this;
}
Quene &Quene::sort()
{
if(!Empty()){
char name[10];
int score;
double time;
for(int i=0;i<counter;i++){
QueneNode *cur2ptr=firstptr,*curptr;
while(cur2ptr!=lastptr){
curptr=cur2ptr;
if(curptr->score>=curptr->nextptr->score&&curptr->time>curptr->nextptr->time){
strcpy(name,curptr->name);
score=curptr->score;
time=curptr->time;
strcpy(curptr->name,curptr->nextptr->name);
curptr->score=curptr->nextptr->score;
curptr->time=curptr->nextptr->time;
strcpy(curptr->nextptr->name,name);
curptr->nextptr->score=score;
curptr->nextptr->time=time;
}
cur2ptr=cur2ptr->nextptr;
}
}
}
return *this;
}
void Quene::toFile()
{
ofstream scoreF(scorF);
if(counter<15){
QueneNode *curptr=firstptr;
while(curptr!=0){
strcpy(sc.name,curptr->name);
sc.score=curptr->score;
sc.time=curptr->time;
scoreF.write((char*)&sc,sizeof(Hscore));
curptr=curptr->nextptr;
}
}
else
{
counter=0;
QueneNode *curptr=firstptr;
while(counter<14){
strcpy(sc.name,curptr->name);
sc.score=curptr->score;
sc.time=curptr->time;
scoreF.write((char*)&sc,sizeof(Hscore));
counter++;
curptr=curptr->nextptr;
}
}
scoreF.close();
}
////////////////////////////////////////////////////////////////
class Drawing
{
public:
void drawMenuPac(int,int,int,int);
void destroyMenuPac(int,int,int);
void drawBrick(int,int,int,int);
void drawStar(int,int,int);
void drawExit(int,int,int);
void drawEnemy(int,int,int,int);
void drawLock(int,int,int,int);
void destroyLock();
int pacmanDie(int,int);
void pacmanEats(int,int);
void drawLpacman(int,int,int,int);
void drawRpacman(int,int,int,int);
void drawUpacman(int,int,int,int);
void drawDpacman(int,int,int,int);
void destroyGamePacman(int,int,int);
void drawScore();
void drawLife();
void drawLevel();
void drawTime();
void destroyObj(int,int);
};
void Drawing::destroyObj(int xK,int yK)
{
setcolor(0);
setfillstyle(1,0);
circle(xK,yK,9);
floodfill(xK,yK,0);
}
void Drawing::drawScore()
{
char scor[10];
int textXpos=290,textYpos=20;
settextstyle(1,HORIZ_DIR,3);
itoa(us.score,scor,10);
setcolor(8);
setfillstyle(1,BLACK);
rectangle(textXpos,textYpos,textXpos+80,textYpos+25);
floodfill(textXpos+1,textYpos+1,8);
setcolor(15);
outtextxy(textXpos+6,textYpos-3,scor);
} //Main::drawTime()
void Drawing::drawTime()
{
char min[10],sec[10];
int textXpos=430,textYpos=20;
float f_sec;
int n_min,n_sec;
n_min=(us.time+tmp.loadedtime)/60;
f_sec=(us.time+tmp.loadedtime)-60*n_min;
n_sec=f_sec;
if(f_sec>n_sec+0.5) n_sec+=1;
itoa(n_min,min,10);
itoa(n_sec,sec,10);
settextstyle(1,HORIZ_DIR,3);
setcolor(8);
setfillstyle(1,BLACK);
rectangle(textXpos,textYpos,textXpos+176,textYpos+25);
floodfill(textXpos+1,textYpos+1,8);
setcolor(15);
outtextxy(textXpos+6,textYpos-3,min);
outtextxy(textXpos+50,textYpos-3,"min");
outtextxy(textXpos+110,textYpos-3,sec);
outtextxy(textXpos+140,textYpos-3,"sec");
}
void Drawing::drawLife()
{
char life[10];
int textXpos=70,textYpos=20;
settextstyle(1,HORIZ_DIR,3);
itoa(us.life,life,10);
setcolor(8);
setfillstyle(1,BLACK);
rectangle(textXpos,textYpos,textXpos+23,textYpos+25);
floodfill(textXpos+1,textYpos+1,8);
setcolor(15);
outtextxy(textXpos+6,textYpos-3,life);
}
void Drawing::drawLevel()
{
char level[10];
int textXpos=170,textYpos=20;
settextstyle(1,HORIZ_DIR,3);
itoa(us.level,level,10);
setcolor(8);
setfillstyle(1,BLACK);
rectangle(textXpos,textYpos,textXpos+38,textYpos+25);
floodfill(textXpos+1,textYpos+1,8);
setcolor(15);
outtextxy(textXpos+6,textYpos-3,level);
}
void Drawing::destroyGamePacman(int xP,int yP,int pacmanSize)
{
setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(xP,yP,pacmanSize,pacmanSize);
}
void Drawing::drawUpacman(int xP,int yP,int pacmanSize,int eye)
{
setcolor(14);
setfillstyle(1,0);
fillellipse(xP,yP,9,9);
circle(xP,yP,pacmanSize);
circle(xP+5,yP-1,eye);
setfillstyle(SOLID_FILL,14);
floodfill(xP+1,yP,14);
setcolor(BLACK);
line(xP,yP,xP,yP-pacmanSize);
}
void Drawing::drawRpacman(int xP,int yP,int pacmanSize,int eye)
{
setcolor(14);
setfillstyle(1,0);
fillellipse(xP,yP,9,9);
circle(xP,yP,pacmanSize);
circle(xP-5,yP+1,eye);
setfillstyle(SOLID_FILL,14);
floodfill(xP+1,yP,14);
setcolor(BLACK);
line(xP,yP,xP,yP+pacmanSize);
}
void Drawing::drawDpacman(int xP,int yP,int pacmanSize,int eye)
{
setcolor(14);
setfillstyle(1,0);
fillellipse(xP,yP,9,9);
circle(xP,yP,pacmanSize);
circle(xP+1,yP-5,eye);
setfillstyle(SOLID_FILL,14);
floodfill(xP+1,yP,14);
setcolor(BLACK);
line(xP+pacmanSize,yP,xP,yP);
}
void Drawing::pacmanEats(int x,int y)
{
for(int i=0;i<3;i++){
setcolor(14);
setfillstyle(1,14);
fillellipse(x,y,9,9);
floodfill(x,y,14);
setcolor(0);
setfillstyle(1,0);
circle(x-3,y-3,2);
floodfill(x-4,y-3,0);
circle(x+3,y-3,2);
floodfill(x+4,y-3,0);
int xx=x,yy=y+3;
for(int j=2;j>=0;j--){
delay(30);
fillellipse(xx,yy,4,j);
}
}
}
int Drawing::pacmanDie(int x,int y)
{
int i;
char life[3];
setcolor(0);
setfillstyle(1,0);
for(i=0;i<10;i++){
delay(35);
circle(x,y,i);
floodfill(x,y,0);
}
delay(400);
cleardevice();
if(us.life>0){
itoa(us.life,life,10);
setcolor(1);
settextstyle(1,HORIZ_DIR,7);
outtextxy(90,160,life);
outtextxy(150,160," MORE LEFT");
delay(1000);
return 1;
}
else
if(us.life<=0){
settextstyle(1,HORIZ_DIR,9);
setcolor(3);
outtextxy(50,140,"GAME OVER");
delay(1000);
return 0;
}
return 1;
}
void Drawing::destroyLock()
{
ifstream file(level[us.level]);
file.read((char*)&al,sizeof(all));
file.read((char*)&lo,sizeof(lock));
mass[lo.y/20-3][lo.x/20-2]=0;
setcolor(0);
setfillstyle(1,0);
fillellipse(lo.x,lo.y,lo.size,lo.size);
file.close();
}
void Drawing::drawLpacman(int xP,int yP,int pacmanSize,int eye)
{
setcolor(14);
circle(xP,yP,pacmanSize);
circle(xP-1,yP-5,eye);
setfillstyle(SOLID_FILL,14);
floodfill(xP+1,yP,14);
setcolor(BLACK);
line(xP-pacmanSize,yP,xP,yP);
}
void Drawing::drawLock(int xLoc,int yLoc,int lockSize,int rLoc)
{
setcolor(6);
setfillstyle(1,1);
ellipse(xLoc,yLoc,180,0,lockSize,lockSize);
line(xLoc-lockSize,yLoc,xLoc+lockSize,yLoc);
circle(xLoc,yLoc+4,rLoc);
floodfill(xLoc,yLoc+1,6);
ellipse(xLoc,yLoc,0,180,lockSize-4,lockSize-4);
ellipse(xLoc,yLoc,0,180,lockSize-1,lockSize-1);
}
void Drawing::drawEnemy(int xE,int yE,int enemySize,int Eeye)
{
setcolor(9);
ellipse(xE,yE,0,180,enemySize,enemySize);
circle(xE-2,yE-3,Eeye);
circle(xE+2,yE-3,Eeye);
line(xE-9,yE,xE,yE+9);
line(xE+9,yE,xE,yE+9);
line(xE-3,yE+3,xE+3,yE+3);
setfillstyle(1,1);
floodfill(xE,yE,9);
}
void Drawing::drawExit(int xX,int yX,int rX)
{
setcolor(2);
circle(xX,yX,rX);
settextstyle(1,HORIZ_DIR,1);
outtextxy(xX-5,yX-12,"E");
}
void Drawing::drawStar(int xS,int yS,int starSize)
{
setcolor(WHITE);
ellipse(xS,yS,0,90,starSize,starSize);
ellipse(xS,yS-starSize*2,270,0,starSize,starSize);
ellipse(xS+starSize*2,yS,90,180,starSize,starSize);
ellipse(xS+starSize*2,yS-starSize*2,180,270,starSize,starSize);
setfillstyle(SOLID_FILL,MAGENTA);
floodfill(xS+starSize,yS-starSize,WHITE);
}
void Drawing::drawBrick(int x,int y,int xx,int yy)
{
setcolor(8);
setfillstyle(1,7);
rectangle(1,1,3,3);
rectangle(x,y,xx,yy);
floodfill(x+1,y+1,8);
}
void Drawing::destroyMenuPac(int sxP,int syP,int smallPacmanSize)
{
int sxPr=410;
setcolor(0);
setfillstyle(1,0);
fillellipse(sxP,syP,smallPacmanSize,smallPacmanSize);
fillellipse(sxPr,syP,smallPacmanSize,smallPacmanSize);
}
void Drawing::drawMenuPac(int sxP,int syP,int smallPacmanSize,int smPEye)
{
int sxPr=410;
setcolor(14);
ellipse(sxP,syP,220,180,smallPacmanSize,smallPacmanSize);
line(sxP-smallPacmanSize,syP,sxP,syP);
line(sxP,syP,sxP-7,syP+7);
circle(sxP-3,syP-5,smPEye);
setfillstyle(SOLID_FILL,14);
floodfill(sxP+1,syP,14);
ellipse(sxPr,syP,0,320,smallPacmanSize,smallPacmanSize);
line(sxPr+smallPacmanSize,syP,sxPr,syP);
line(sxPr,syP,sxPr+7,syP+7);
circle(sxPr+3,syP-5,smPEye);
floodfill(sxPr-1,syP,14);
}
////////////////////////////////////////////////////////////
class EnemyMain:public Drawing
{
public:
EnemyMain();
void setXY(int,int,int);
int enemyMove(int,int);
private:
int *x;
int *y;
int *counter;
double t;
}killers;
EnemyMain::EnemyMain()
{
x=new int[50];
y=new int[50];
counter=new int;
t=0;
}
void EnemyMain::setXY(int xE,int yE,int count)
{
*counter=count;
x[*counter]=xE;
y[*counter]=yE;
}
int EnemyMain::enemyMove(int pacX,int pacY)
{
int i,j,k;
t++;
if(t==4000000){
//stars redraw
for(i=0;i<20;i++){
for(j=0;j<28;j++){
if(mass[i][j]==2){
drawStar((j+2)*20-4,(i+4)*20-1,str.size-1);
}
}
}
for(i=0;i<=(*counter);i++){
//X+right - MOVE---------------------------------------
if(x[i]<pacX){
destroyObj(x[i],y[i]);
if(mass[y[i]/20-3][x[i]/20-1]==2){
mass[y[i]/20-3][x[i]/20-2]=0;
x[i]+=20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-3][x[i]/20-1]!=1){
x[i]+=20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-3][x[i]/20-1]==1){
x[i]+=20;
x[i]=mass[y[i]/20-3][x[i]/20-2]!=1?x[i]:x[i]-20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-1]!=2){
mass[y[i]/20-3][x[i]/20-2]=0;
x[i]+=20;
x[i]=mass[y[i]/20-3][x[i]/20-2]!=1?x[i]:x[i]-20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
}
//X+left - MOVE---------------------------------------
if(x[i]>pacX){
destroyObj(x[i],y[i]);
if(mass[y[i]/20-3][x[i]/20-3]==2){
mass[y[i]/20-3][x[i]/20-2]=0;
x[i]-=20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-3][x[i]/20-3]!=1){
x[i]-=20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-3][x[i]/20-3]==1){
x[i]-=20;
x[i]=mass[y[i]/20-3][x[i]/20-2]!=1?x[i]:x[i]+20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-3]!=2){
mass[y[i]/20-3][x[i]/20-2]=0;
x[i]-=20;
x[i]=mass[y[i]/20-3][x[i]/20-2]!=1?x[i]:x[i]+20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
}
//Y+DOWN - MOVE---------------------------------------
if(y[i]<pacY){
destroyObj(x[i],y[i]);
if(mass[y[i]/20-2][x[i]/20-2]==2){
mass[y[i]/20-3][x[i]/20-2]=0;
y[i]+=20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-2][x[i]/20-2]!=1){
y[i]+=20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-2][x[i]/20-2]==1){
y[i]+=20;
y[i]=mass[y[i]/20-3][x[i]/20-2]!=1?y[i]:y[i]-20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-2][x[i]/20-2]!=2){
mass[y[i]/20-3][x[i]/20-2]=0;
y[i]+=20;
y[i]=mass[y[i]/20-3][x[i]/20-2]!=1?y[i]:y[i]-20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
}
//Y+DOWN - MOVE---------------------------------------
if(y[i]>pacY){
destroyObj(x[i],y[i]);
if(mass[y[i]/20-4][x[i]/20-2]==2){
mass[y[i]/20-3][x[i]/20-2]=0;
y[i]-=20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-4][x[i]/20-2]!=1){
y[i]-=20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-3][x[i]/20-2]==2&&mass[y[i]/20-4][x[i]/20-2]==1){
y[i]-=20;
y[i]=mass[y[i]/20-3][x[i]/20-2]!=1?y[i]:y[i]+20;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
else
if(mass[y[i]/20-4][x[i]/20-2]!=2){
mass[y[i]/20-3][x[i]/20-2]=0;
y[i]-=20;
y[i]=mass[y[i]/20-3][x[i]/20-2]!=1?y[i]:y[i]+20;
mass[y[i]/20-3][x[i]/20-2]=4;
drawEnemy(x[i],y[i],ene.size,ene.eye);
}
}
//-----------------------------------------------------
}//for
t=0;
}
return 1;
}
class Main:public Drawing
{
public:
int Menu();
int about();
int Exit();
int loadGame();
void highScore(int);
Main &Level();
Main &LevelBgrd();
Main &Game();
Main &saveGame();
Main &beforeStart();
}mai;
void Main::highScore(int flag)
{
int x=150,y=170;
switch(flag){
case 1:
cleardevice();
char name[8],bl[20]="\0";
drawStar(x-30,y+20,20);
drawStar(x+140,y-30,20);
drawStar(x+300,y+20,20);
drawStar(x+70,y+160,20);
drawStar(x+230,y+170,20);
setcolor(14);
settextstyle(1,HORIZ_DIR,4);
outtextxy(x+20,y+5,"CONGRATULATIONS!!");
outtextxy(x-60,y+35,"YOU HAVE PASSED THE GAME!!");
setcolor(RED);
settextstyle(2,HORIZ_DIR,6);
outtextxy(x+50,y+82,"ENTER YOUR NAME:");
gotoxy(46,17);
cin.getline(bl,20);
int len=strlen(bl);
len=len<9?len:8;
strncpy(name,bl,len);
name[len]='\0';
for(int k=0;k<len;k++)
name[k]=toupper(name[k]);
quene.clear().addNew(name,us.score,us.time+tmp.loadedtime);
quene.fill().sort().toFile();
break;
case 0:
cleardevice();
int miN,sec;
setcolor(8);
setfillstyle(1,7);
x=100,y=50;
rectangle(x,y,x+440,y+400);
rectangle(x+10,y+10,x+430,y+390);
floodfill(x+1,y+1,8);
setcolor(9);
outtextxy(x+120,y+20,"HIGH SCORE:");
settextstyle(1,0,3);
outtextxy(x+35,y+60,"NAME");
outtextxy(x+170,y+60,"SCORE");
outtextxy(x+300,y+60,"TIME");
int yy=y+20;
char score[10],time[10],Tsec[10];
ifstream read(scorF);
read.read((char*)&sc,sizeof(Hscore));
while(!read.eof()){
if(sc.time!=0){
yy+=20;
sec=sc.time;
miN=sec/60;
sec=sec-miN*60;
itoa(sc.score,score,10);
itoa(miN,time,10);
itoa(sec,Tsec,10);
setcolor(15);
outtextxy(x+25,yy+50,sc.name);
outtextxy(x+180,yy+50,score);
outtextxy(x+280,yy+50,time);
outtextxy(x+310,yy+50,"m");
outtextxy(x+350,yy+50,Tsec);
outtextxy(x+370,yy+50," s");
}
read.read((char*)&sc,sizeof(Hscore));
}
while(bioskey(1)==0);
getch();
break;
}
}
int Main::Menu()
{
cleardevice();
int xM=220,yM=220,yDist=40,xCor=5;
int xS=5,yS=70,starSize=30;
int xP=120,yP=100,pacmanSize=50,eye=5;
drawStar(xS,yS,starSize);
xS=150;yS=150;//
drawStar(xS,yS,starSize);
xS=450;yS=100;starSize=50;
drawStar(xS,yS,starSize);
xS=550;yS=200;starSize=40;
drawStar(xS,yS,starSize);
setcolor(14);
ellipse(xP,yP,220,180,pacmanSize,pacmanSize);
line(xP-pacmanSize,yP,xP,yP);
line(xP,yP,xP-37,yP+31);
circle(xP-15,yP-25,eye);
setfillstyle(SOLID_FILL,14);
floodfill(xP+1,yP,14);
setcolor(9);
settextstyle(4,HORIZ_DIR,7);
outtextxy(xP,yP,"The PACMAN");
setcolor(RED);
settextstyle(2,HORIZ_DIR,4);
outtextxy(1,465,"Pacman v1.0 by Vital");
setcolor(CYAN);
settextstyle(1,HORIZ_DIR,4);
outtextxy(xM,yM,"NEW GAME");
setcolor(BROWN);
outtextxy(xM-xCor,yM+=yDist,"LOAD GAME");
xCor=8;
setcolor(WHITE);
outtextxy(xM-xCor,yM+=yDist,"HIGH SCORE");
xCor=-28;
setcolor(GREEN);
outtextxy(xM-xCor,yM+=yDist,"ABOUT");
xCor=-47;
setcolor(RED);
outtextxy(xM-xCor,yM+=yDist,"EXIT");
return 1;
}
int Main::about()
{
cleardevice();
int lTextx=10,lTexty=150,yMov=30;
setcolor(15);
outtextxy(245,50,"ABOUT:");
setfillstyle(LINE_FILL,15);
rectangle(300,120,305,470);
floodfill(301,121,15);
setcolor(3);
settextstyle(3,HORIZ_DIR,3);
outtextxy(lTextx+40,lTexty,"GAME FEATURES");
setcolor(2);
settextstyle(1,HORIZ_DIR,1);
outtextxy(lTextx,lTexty+=yMov,"KEYBOARD:");
yMov=20;setcolor(9);
outtextxy(lTextx,lTexty+=yMov,"To move up -> UPARROW");
outtextxy(lTextx,lTexty+=yMov,"To move down -> DOWNARROW");
outtextxy(lTextx,lTexty+=yMov,"To move left -> LEFTARROW");
outtextxy(lTextx,lTexty+=yMov,"To move right-> RIGHTARROW");
outtextxy(lTextx,lTexty+=yMov,"Move to main menu -> ESC");
yMov=40;setcolor(2);
outtextxy(lTextx,lTexty+=yMov,"OTHER:");
yMov=20;setcolor(9);
outtextxy(lTextx,lTexty+=yMov,"The game runs at 640x480");
outtextxy(lTextx,lTexty+=yMov,"mode. Game version 1.0. ");
outtextxy(lTextx,lTexty+=yMov,"If there is any suggestions");
outtextxy(lTextx,lTexty+=yMov,"about how to make it better ");
outtextxy(lTextx,lTexty+=yMov,"you can contact with creators.");
lTextx=315,lTexty=150,yMov=30;
setcolor(3);
settextstyle(3,HORIZ_DIR,3);
outtextxy(lTextx+40,lTexty,"ABOUT CREATORS");
setcolor(2);
settextstyle(1,HORIZ_DIR,1);
outtextxy(lTextx,lTexty+=yMov,"CONTACTS:");
yMov=20;setcolor(9);
outtextxy(lTextx,lTexty+=yMov,"e-mail: ivanok-sokol@rambler.ru");
outtextxy(lTextx,lTexty+=yMov,"icq: 221-498-093 ");
outtextxy(lTextx,lTexty+=yMov,"visit us: http://oshmiany.eu");
yMov=40;setcolor(2);
settextstyle(1,HORIZ_DIR,1);
outtextxy(lTextx,lTexty+=yMov,"HISTORY:");
yMov=20;setcolor(9);
outtextxy(lTextx,lTexty+=yMov,"This game is a academic year pro-");
outtextxy(lTextx,lTexty+=yMov,"ject of a student of Belorussian");
outtextxy(lTextx,lTexty+=yMov,"state university of informatics");
outtextxy(lTextx,lTexty+=yMov,"and radioelectronics. A student of");
outtextxy(lTextx,lTexty+=yMov,"600502 group. It took about -//- ");
outtextxy(lTextx,lTexty+=yMov,"days to write that programm");
yMov=30;
setcolor(12);
settextstyle(1,HORIZ_DIR,1);
outtextxy(lTextx+50,lTexty+=yMov,"HOPE YOU ENJOY IT!!");
while(bioskey(1)==0);
getch();
Menu();
int sxP=195,syP=360,smallPacmanSize=10,smPEye=2;
drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
return 1;
}
int Main::Exit()
{
cleardevice();
setcolor(3);
settextstyle(1,HORIZ_DIR,10);
outtextxy(30,100,"BYE BYE!");
while(bioskey(1)==0);
exit(1);
return 0;
}
Main &Main::LevelBgrd() //Main::LevelBgrd()
{
cleardevice();
int i;
int sxP=40,syP=25,smallPacmanSize=15,smPEye=3,xMov=13;
setcolor(14);
ellipse(sxP,syP,220,180,smallPacmanSize,smallPacmanSize);
line(sxP-smallPacmanSize,syP,sxP,syP);
line(sxP,syP,sxP-10,syP+9);
circle(sxP-5,syP-5,smPEye);
setfillstyle(SOLID_FILL,14);
floodfill(sxP+1,syP,14);
int textXpos=sxP+16,textYpos=syP-12;
setcolor(15);
settextstyle(1,HORIZ_DIR,2);
outtextxy(textXpos,textYpos+7,"x"); //
textYpos+=4;
settextstyle(1,HORIZ_DIR,3);
drawLife(); //
textXpos-=7;
outtextxy(textXpos+=xMov*4,textYpos,"LEVEL ");
drawLevel(); //
textXpos+=xMov*6;
outtextxy(textXpos+=xMov*3,textYpos,"SCORE ");
drawScore(); //
textXpos+=(xMov*4)+2;
outtextxy(textXpos+=xMov*8,textYpos,"TIME ");
clock_t start,end;
start=clock();
end=clock();
us.time=(end-start)/CLK_TCK;
drawTime();
setcolor(8);
rectangle(25,50,606,470);
rectangle(30,55,601,465);
setfillstyle(SOLID_FILL,7);
floodfill(26,52,8);
setcolor(8);
setfillstyle(1,7);
int x=35,y=60;
for(i=0;i<2;i++){
for(;x<=575;x+=20){
rectangle(x,y,x+20,y+20);
floodfill(x+1,y+1,8);
}
x=35;y+=380;
}
x=35;y=60;
for(i=0;i<2;i++){
for(;y<=440;y+=20){
rectangle(x,y,x+20,y+20);
floodfill(x+1,y+1,8);
}
x+=540;y=60;
}
return *this;
} //Main::Level()
Main &Main::Level()
{
int i;
ifstream levelFile(level[us.level]);
levelFile.read((char*)&al,sizeof(all));
//LOCK
levelFile.read((char*)&lo,sizeof(lock));
mass[lo.y/20-3][lo.x/20-2]=6;
drawLock(lo.x,lo.y,lo.size,lo.r);
//BRICS
levelFile.read((char*)&cr,sizeof(coord));
for(i=1;i<al.coor;i++){
drawBrick(cr.x,cr.y,cr.xx,cr.yy);
levelFile.read((char*)&cr,sizeof(coord));
}
drawBrick(cr.x,cr.y,cr.xx,cr.yy);
//STARS
tmp.starcounter=-1;
levelFile.read((char*)&str,sizeof(star));
for(i=1;i<al.stars;i++){
drawStar(str.x+1,str.y-1,str.size-1);
levelFile.read((char*)&str,sizeof(star));
tmp.starcounter++;
}
drawStar(str.x+1,str.y-1,str.size-1);
tmp.starcounter++;
//ENEMIES
int MAX=0;
levelFile.read((char*)&ene,sizeof(enemy));
for(i=1;i<al.enemies;i++){
drawEnemy(ene.x,ene.y,ene.size-1,ene.eye);//DRAW
levelFile.read((char*)&ene,sizeof(enemy));
killers.setXY(ene.x,ene.y,MAX);
MAX++;
}
drawEnemy(ene.x,ene.y,ene.size-1,ene.eye);
//PACMAN
levelFile.read((char*)&pac,sizeof(pacman));
drawLpacman(pac.x,pac.y,pac.size,pac.eye);
//EXIT
levelFile.read((char*)&ex,sizeof(ExiT));
drawExit(ex.x,ex.y,ex.r);
//MAS
levelFile.read((char*)&ms2,sizeof(mas));
for(i=1;i<al.mas;i++){
mass[ms2.y][ms2.x]=ms2.val;
levelFile.read((char*)&ms2,sizeof(mas));
}
//
levelFile.close();
//CLEAN UP
int xD=0,yD=3,rD=20;
setcolor(BLACK);
circle(xD,yD,rD);
setfillstyle(1,BLACK);
floodfill(xD,yD,BLACK);
return *this;
}
Main &Main::beforeStart()
{
cleardevice();
char level[10];
itoa(us.level,level,10);
setcolor(1);
settextstyle(1,HORIZ_DIR,10);
outtextxy(50,140,"LEVEL ");
outtextxy(450,140,level);
delay(2000);
return *this;
}
Main &Main::saveGame()
{
if(us.level!=11){
cleardevice();
int key,true=1,cursorX,cursorY,choise=0;
char nameForSave[20]="\0",dispScor[10],dispLevel[10];
double timeForSave,levelForSave,lifeForSave;
levelForSave=us.level;
lifeForSave=us.life;
timeForSave=us.time;
cleardevice();
setcolor(7);
rectangle(180,50,440,430);
rectangle(185,55,435,425);
setfillstyle(1,8);
floodfill(181,51,7);
setcolor(9);
settextstyle(1,HORIZ_DIR,4);
outtextxy(225,80,"SAVE GAME");
cursorX=195,cursorY=151;
settextstyle(1,HORIZ_DIR,2);
outtextxy(205,150,"NAME");
outtextxy(300,150,"SCORE");
outtextxy(395,150,"LVL");
setcolor(15);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
fstream save(userF,ios::in|ios::out);
for(int i=0;i<10;i++){
save.read((char*)&us,sizeof(User));
itoa(us.score,dispScor,10);
itoa(us.level,dispLevel,10);
outtextxy(cursorX+5,cursorY+=24,us.name);
outtextxy(cursorX+130,cursorY,dispScor);
outtextxy(cursorX+210,cursorY,dispLevel);
}
save.close();
cursorX=195,cursorY=151;
while(true){
key=bioskey(0);
switch(key){
case 20480://DOWN
setcolor(0);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
cursorY+=24;
choise++;choise=choise<10?choise:9;
cursorY=cursorY<=367?cursorY:367;
setcolor(15);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
break;
case 18432://UP
setcolor(0);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
cursorY-=24;
choise--;choise=choise>=0?choise:0;
cursorY=cursorY>=151?cursorY:151;
setcolor(15);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
break;
case 7181://ENTER
fstream saving(userF,ios::in|ios::out);
us.score=tmp.score;
us.level=levelForSave;
us.life=lifeForSave;
us.time=timeForSave+tmp.loadedtime;
setcolor(14);
settextstyle(2,HORIZ_DIR,5);
outtextxy(220,126,"ENTER YOUR NAME:");
gotoxy(45,9);cin.getline(nameForSave,20);
int len=strlen(nameForSave);
len=len<9?len:8;
strncpy(us.name,nameForSave,len);
us.name[len]='\0';
for(int i=0;i<len;i++){
us.name[i]=toupper(us.name[i]);
}
switch(choise){
case 0:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 1:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 2:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 3:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 4:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 5:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 6:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 7:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 8:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
case 9:
saving.seekp(choise*sizeof(User));
saving.write((char*)&us,sizeof(User));
break;
}
saving.close();
cleardevice();
setcolor(7);
rectangle(180,50,440,430);
rectangle(185,55,435,425);
setfillstyle(1,8);
floodfill(181,51,7);
setcolor(9);
settextstyle(1,HORIZ_DIR,4);
outtextxy(225,80,"SAVE GAME");
cursorX=195,cursorY=151;
settextstyle(1,HORIZ_DIR,2);
outtextxy(205,150,"NAME");
outtextxy(300,150,"SCORE");
outtextxy(395,150,"LVL");
setcolor(15);
ifstream displ(userF);
for(i=0;i<10;i++){
displ.read((char*)&us,sizeof(User));
itoa(us.score,dispScor,10);
itoa(us.level,dispLevel,10);
outtextxy(cursorX+5,cursorY+=24,us.name);
outtextxy(cursorX+130,cursorY,dispScor);
outtextxy(cursorX+210,cursorY,dispLevel);
}
displ.close();
getch();
true=0;
break;
case 283:true=0;break;
}
}
}
return *this;
}
int Main::loadGame()
{
cleardevice();
int key,true=1,cursorX,cursorY,choise=0;
char dispScor[10],dispLevel[10];
cleardevice();
setcolor(7);
rectangle(180,50,440,430);
rectangle(185,55,435,425);
setfillstyle(1,8);
floodfill(181,51,7);
setcolor(9);
settextstyle(1,HORIZ_DIR,4);
outtextxy(225,80,"LOAD GAME");
cursorX=195,cursorY=151;
settextstyle(1,HORIZ_DIR,2);
outtextxy(205,145,"NAME");
outtextxy(300,145,"SCORE");
outtextxy(395,145,"LVL");
setcolor(15);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
fstream save(userF,ios::in|ios::out);
for(int i=0;i<10;i++){
save.read((char*)&us,sizeof(User));
itoa(us.score,dispScor,10);
itoa(us.level,dispLevel,10);
outtextxy(cursorX+5,cursorY+=24,us.name);
outtextxy(cursorX+130,cursorY,dispScor);
outtextxy(cursorX+210,cursorY,dispLevel);
}
save.close();
cursorX=195,cursorY=151;
while(true){
key=bioskey(0);
switch(key){
case 20480://DOWN
setcolor(0);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
cursorY+=24;
choise++;choise=choise<10?choise:9;
cursorY=cursorY<=367?cursorY:367;
setcolor(15);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
break;
case 18432://UP
setcolor(0);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
cursorY-=24;
choise--;choise=choise>=0?choise:0;
cursorY=cursorY>=151?cursorY:151;
setcolor(15);
rectangle(cursorX-5,cursorY+24,cursorX+235,cursorY+48);
break;
case 7181://ENTER
ifstream load(userF);
switch(choise){
case 0:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 1:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 2:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 3:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 4:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 5:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 6:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 7:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 8:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
case 9:
load.seekg(choise*sizeof(User));
load.read((char*)&us,sizeof(User));
break;
}
load.close();
tmp.loadedlevel=us.level;
tmp.loadedtime=us.time;
if(us.time==0)
return 0;
else
return 1;
break;
case 283:true=0;break;
}
}
return 0;
}
Main &Main::Game()
{
int xP=pac.x,yP=pac.y,pacmanSize=pac.size,eye=pac.eye;
int true=1,key;
double t=0;
clock_t start,end;
start=clock();
while(true){ //KILLERS MOVEMENT
killers.enemyMove(xP,yP);
t++;
if(t==2000000){
end=clock();
us.time=(end-start)/CLK_TCK;
drawTime();
t=0;
}
if(bioskey(1)!=0){
key=bioskey(0);
switch(key){
case 18432://UPARROW
int txU=xP/20-2,tyU=yP/20-3;
if(mass[tyU][txU]==4){
us.life--;
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
yP-=20;
destroyGamePacman(xP,yP+20,pacmanSize);
txU=xP/20-2,tyU=yP/20-3;
if(mass[tyU][txU]==4){
us.life--;
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
yP=mass[tyU][txU]==1||mass[tyU][txU]==6?yP+20:yP;
if(mass[tyU][txU]==2){
pacmanEats(xP,yP);
us.score+=10;
drawScore();
mass[tyU][txU]=0;
tmp.starcounter--;
}
if(tmp.starcounter==0){
destroyLock();
}
drawUpacman(xP,yP,pacmanSize,eye);
if(mass[tyU][txU]==5){
us.level++;
if(us.level<=10){
setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(xP,yP,pacmanSize,pacmanSize);
tmp.score=us.score;
beforeStart().LevelBgrd().Level();
xP=pac.x;
yP=pac.y;
}
else{
true=0;
highScore(1);
}
}
break;
case 20480://DOWNARROW
int txD=xP/20-2,tyD=yP/20-3;
if(mass[tyD][txD]==4){
us.life--;
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
yP+=20;
destroyGamePacman(xP,yP-20,pacmanSize);
txD=xP/20-2,tyD=yP/20-3;
if(mass[tyD][txD]==4){
us.life--;
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
yP=mass[tyD][txD]==1||mass[tyD][txD]==6?yP-20:yP;
if(mass[tyD][txD]==2){
pacmanEats(xP,yP);
us.score+=10;
drawScore();
mass[tyD][txD]=0;
tmp.starcounter--;
}
if(tmp.starcounter==0){
destroyLock();
}
drawRpacman(xP,yP,pacmanSize,eye);
if(mass[tyD][txD]==5){
us.level++;
if(us.level<=10){
setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(xP,yP,pacmanSize,pacmanSize);
tmp.score=us.score;
beforeStart().LevelBgrd().Level();
xP=pac.x;
yP=pac.y;
}
else{
true=0;
highScore(1);
}
}
break;
case 19200://LEFTARROW
int txL=xP/20-2,tyL=yP/20-3;
if(mass[tyL][txL]==4){
us.life--;
pacmanDie(xP,yP);
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
xP-=20;
destroyGamePacman(xP+20,yP,pacmanSize);
txL=xP/20-2,tyL=yP/20-3;
if(mass[tyL][txL]==4){
us.life--;
pacmanDie(xP,yP);
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
xP=mass[tyL][txL]==1||mass[tyL][txL]==6?xP+20:xP;
if(mass[tyL][txL]==2){
pacmanEats(xP,yP);
us.score+=10;
drawScore();
mass[tyL][txL]=0;
tmp.starcounter--;
destroyObj(xP,yP);
}
if(tmp.starcounter==0){
destroyLock();
}
drawLpacman(xP,yP,pacmanSize,eye);
if(mass[tyL][txL]==5){
us.level++;
if(us.level<=10){
setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(xP,yP,pacmanSize,pacmanSize);
tmp.score=us.score;
beforeStart().LevelBgrd().Level();
xP=pac.x;
yP=pac.y;
}
else{
true=0;
highScore(1);
}
}
break;
case 19712://RIGHTARROW
int txR=xP/20-2,tyR=yP/20-3;
if(mass[tyR][txR]==4){
us.life--;
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
xP+=20;
destroyGamePacman(xP-20,yP,pacmanSize);
txR=xP/20-2,tyR=yP/20-3;
if(mass[tyR][txR]==4){
us.life--;
us.score=tmp.score;
if(pacmanDie(xP,yP)){
xP=pac.x;
yP=pac.y;
LevelBgrd().Level();
}
else true=0;
}
xP=mass[tyR][txR]==1||mass[tyR][txR]==6?xP-20:xP;
if(mass[tyR][txR]==2){
pacmanEats(xP,yP);
us.score+=10;
drawScore();
mass[tyR][txR]=0;
tmp.starcounter--;
}
if(tmp.starcounter==0){
destroyLock();
}
drawDpacman(xP,yP,pacmanSize,eye);
if(mass[tyR][txR]==5){
us.level++;
if(us.level<=10){
setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(xP,yP,pacmanSize,pacmanSize);
tmp.score=us.score;
beforeStart().LevelBgrd().Level();
xP=pac.x;
yP=pac.y;
}
else{
true=0;
highScore(1);
}
}
break;
case 283:
if(us.level>1&&us.level!=tmp.loadedlevel){
drawTime();
saveGame();
}
true=0;
break;
}//SWITCH
}//if(bioskey(1)!=0)
}//WHILE
Menu();
int sxP=195,syP=240,smallPacmanSize=10,smPEye=2;
drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
return *this;
}
int main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
int sxP=195,syP=240,smallPacmanSize=10,smPEye=2;
int yDist=40;
int menuPos=1;
int true=1,key;
mkdir("levels");
system("cd levels");
User blank={3,0,0," <FREE>",0};
ofstream userFile(userF,ios::noreplace);
for(int i=0;i<10;i++)
userFile.write((char*)&blank,sizeof(User));
userFile.close();
Hscore fill={0,0,""};
ofstream scorFile(scorF,ios::noreplace);
for(i=0;i<14;i++)
scorFile.write((char*)&fill,sizeof(Hscore));
scorFile.close();
us.life=3;
us.score=0;
us.time=0;
tmp.loadedlevel=us.level;
tmp.loadedtime=us.time;
mai.Menu();
mai.drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
while(true){
key=bioskey(0);
switch(key){
case 20480: //DOWN
syP+=yDist;
mai.destroyMenuPac(sxP,syP-yDist,smallPacmanSize);
menuPos++;menuPos=menuPos<=5?menuPos:1;
syP=syP<=400?syP:240;
mai.drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
break;
case 18432: //UP
syP-=yDist;
mai.destroyMenuPac(sxP,syP+yDist,smallPacmanSize);
menuPos--;menuPos=menuPos>=1?menuPos:5;
syP=syP>=240?syP:400;
mai.drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
break;
case 7181: //ENTER
switch(menuPos){
case 1: //NEW GAME
us.level=1;
tmp.loadedtime=0;
us.score=0;
us.life=3;
mai.beforeStart().LevelBgrd().Level().Game();
break;
case 2: //LOAD GAME
if(mai.loadGame()){
syP-=yDist;
menuPos--;
mai.beforeStart().LevelBgrd().Level().Game();
}
else mai.Menu();
mai.destroyMenuPac(sxP,syP+yDist,smallPacmanSize);
mai.drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
break;
case 3: //HIGH SCORE
mai.highScore(0);
mai.Menu();
mai.drawMenuPac(sxP,syP,smallPacmanSize,smPEye);
break;
case 4: //ABOUT
mai.about();
break;
case 5: //EXIT
true=mai.Exit();
break;
}
break;
case 283: //ESC
exit(1);
break;
}
}
cleardevice();
closegraph();
return 0;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////