int initgame(){ loadtexture("all", "px.jpg", 4,0,8); loadtexture("all", "speed.jpg", 4,0,11); loadtexture(course[loadc].dir, "lf.jpg", 4,0,2); loadtexture(course[loadc].dir, "rt.jpg", 4,0,3); loadtexture(course[loadc].dir, "dn.jpg", 4,0,4); loadtexture(course[loadc].dir, "up.jpg", 4,0,5); loadtexture(course[loadc].dir, "ft.jpg", 4,0,6); loadtexture(course[loadc].dir, "bk.jpg", 4,0,7); loadtexture(course[loadc].dir, "terrain.jpg", 4,0,9); loadtexture(course[loadc].dir, "map.bmp", 4,0,13); loadmap (&course[loadc]); player.rotvel = 0; player.vel = 0; player.dir = 0; player.rotdir = 0; player.rot = 180; player.x = -600; player.z = -1000; debugf("Reset Player Variables"); playmusic("data/music/growler.mp3"); newgame = 0; timestart = SDL_GetTicks(); printf("\nLoaded Map:\n %s (data/%s)\n %s\n\n", course[loadc].name, course[loadc].dir, course[loadc].description); return 1; }
int loadmenu(void){ menu = 1; loadtexture("all","loading.jpg", 1,0,10); loadtexture("all","font.png", 4,0,0); loadtexture("all","fontoutline.png", 4,0,12); loadtexture("all","menu.jpg", 4,0,1); initmenu(); return 1; }
void init_opengl() { extern t_client t; extern GLuint texture_ground; extern GLuint type1; extern GLuint type2; extern GLuint type3; extern GLuint type4; extern GLuint type5; extern GLuint type6; extern GLuint type7; SDL_Init(SDL_INIT_VIDEO); atexit(SDL_Quit); t.ecran = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL); SDL_WM_SetCaption("Zappy", NULL); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(70,(double)640/480, 1, 1000); glEnable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); texture_ground = loadtexture("./image/ground.jpg", 1); type1 = loadtexture("./image/type1.jpg", 1); type2 = loadtexture("./image/type2.jpg", 1); type3 = loadtexture("./image/type3.jpg", 1); type4 = loadtexture("./image/type4.jpg", 1); type5 = loadtexture("./image/type5.jpg", 1); type6 = loadtexture("./image/type6.jpg", 1); type7 = loadtexture("./image/type7.jpg", 1); SDL_EnableKeyRepeat(100, 100); SDL_WarpMouse(t.ecran->w / 2, t.ecran->h / 2); t.z_cam = t.y_cam; }
void tekstur() { int i,size,j; char c[64]; unsigned char t; unsigned char *p; /* allocate space for texture in graphics card */ glGenTextures(7,texture); for(i=0;i<7;i++) { sprintf(c,"t%d.bmp",i+1); /* fprintf(debug,"%s\n",c);*/ img[i]=LoadBMP(c); buf[i]=(unsigned char*)malloc(512*512*3); memcpy(buf[i],img[i]->pixels,512*512*3); p=buf[i]; /* fprintf(debug,"bits: %d\n",(int)img[i]->format->BytesPerPixel);*/ size=3*512*512; /* reverser */ for(j=0;j<size/2;j++) { t=p[j]; p[j]=p[size-j-1]; p[size-j-1]=t; } loadtexture(&texture[i],512,512,buf[i]); } glEnable(GL_TEXTURE_2D); }
COpenGLTexture* CTexture::addtexture(string fname, string name, bool transparent) { COpenGLTexture txt; CBitMap bmp; bmp.LoadBMP(fname.c_str()); txt.has_alpha = false; if (transparent) loadtexture_transparent(&bmp, &txt,0); else loadtexture(&bmp, &txt); t.push_back(txt); names.push_back(name); return &(t[t.size()-1]); }
void CTexture::create_sphere(string name, int w, CVector col1, CVector col2, double mul, bool typ, double dec) { CBitMap bmp; COpenGLTexture txt; double val; bmp.width = w; bmp.height= w; bmp.data = new unsigned char[3*w*w]; for (int i=0;i<w; i++) { for (int j=0;j<w; j++) { double x = (i-w/2)/(double)w; double y = (j-w/2)/(double)w; if (typ) val = mul/sqrt(x*x + y*y); else val = mul*sqrt(x*x + y*y); if (typ) { val = (val + 0.9*(1-sqrt(x*x + y*y)))*0.7; } val = val - 4*dec; if (val>1.0) val=1.0; if (val<0.00) val=0.0; bmp.data[3*i + 3*w*j +0] = (unsigned char)(255.0*(col1.x * val + col2.x*(1-val))); bmp.data[3*i + 3*w*j +1] = (unsigned char)(255.0*(col1.y * val + col2.y*(1-val))); bmp.data[3*i + 3*w*j +2] = (unsigned char)(255.0*(col1.z * val + col2.z*(1-val))); } } loadtexture(&bmp, &txt); t.push_back(txt); names.push_back(name); }
int loadmenu(void){ menu = 1; loadtexture("all","loading.jpg", 1,0,10); loadtexture("all","font.png", 4,0,0); loadtexture("all","fontoutline.png", 4,0,12); if(!sayan) { loadtexture("all","menu.jpg", 4,0,1); initmenu(); }else if(sayan==1) { loadtexture("all","lose.jpg",4,0,1); initmenu1(); } else if(sayan==2) { loadtexture("all","win.jpg",4,0,1); initmenu2(); } return 1; }
void loadanimations(void) { int count,count2; int changeddir; char filename[32]="bibatk01.png"; changeddir=chdir("animation"); count2=0; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"bibsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"bibwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"bibatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"nibdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=1; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"nibsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"nibwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"nibatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"nibdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=2; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"ribsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"ribwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"ribatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"ribdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=3; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"mumsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"mumwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"mumatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"mumdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2+=32; animation[count2].stand[0]=numofanimations; loadtexture(numofanimations,"mumhed01.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].walk[0]=numofanimations; loadtexture(numofanimations,"mumhed02.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].attack[0]=numofanimations; loadtexture(numofanimations,"mumhed03.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].stand[1]=numofanimations; loadtexture(numofanimations,"mumhed05.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].die[0]=numofanimations; loadtexture(numofanimations,"mumhed06.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2=4; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"sklsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"sklwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"sklatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"skldie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2+=32; animation[count2].stand[0]=numofanimations; loadtexture(numofanimations,"sklhed01.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].walk[0]=numofanimations; loadtexture(numofanimations,"sklhed02.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].attack[0]=numofanimations; loadtexture(numofanimations,"sklhed03.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].stand[1]=numofanimations; loadtexture(numofanimations,"sklhed05.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].die[0]=numofanimations; loadtexture(numofanimations,"sklhed06.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2=5; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"zomsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"zomwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"zomatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"zomdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2+=32; animation[count2].stand[0]=numofanimations; loadtexture(numofanimations,"zomhed01.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].walk[0]=numofanimations; loadtexture(numofanimations,"zomhed02.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].attack[0]=numofanimations; loadtexture(numofanimations,"zomhed03.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].stand[1]=numofanimations; loadtexture(numofanimations,"zomhed05.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].die[0]=numofanimations; loadtexture(numofanimations,"zomhed06.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2=6; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"gimsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"gimwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"gimatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"gimdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2+=32; animation[count2].stand[0]=numofanimations; loadtexture(numofanimations,"gimhed01.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].walk[0]=numofanimations; loadtexture(numofanimations,"gimhed02.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].attack[0]=numofanimations; loadtexture(numofanimations,"gimhed03.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].stand[1]=numofanimations; loadtexture(numofanimations,"gimhed05.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].die[0]=numofanimations; loadtexture(numofanimations,"gimhed06.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2=7; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"vissta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"viswlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"visatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"visdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=8; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"aibsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"aibwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"aibatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"aibdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=9; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"altsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"altwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"altatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"altdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2+=32; animation[count2].stand[0]=numofanimations; loadtexture(numofanimations,"gimhed01.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].walk[0]=numofanimations; loadtexture(numofanimations,"gimhed02.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].attack[0]=numofanimations; loadtexture(numofanimations,"gimhed03.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].stand[1]=numofanimations; loadtexture(numofanimations,"gimhed05.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].die[0]=numofanimations; loadtexture(numofanimations,"gimhed06.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2=10; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"frksta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"frkwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"frkatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"frkdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2+=32; animation[count2].stand[0]=numofanimations; loadtexture(numofanimations,"frkhed01.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].walk[0]=numofanimations; loadtexture(numofanimations,"frkhed02.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].attack[0]=numofanimations; loadtexture(numofanimations,"frkhed03.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].stand[1]=numofanimations; loadtexture(numofanimations,"frkhed05.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; animation[count2].die[0]=numofanimations; loadtexture(numofanimations,"frkhed06.png",0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } count2=11; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"pibsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"pibwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"pibatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"pibdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=12; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"sepsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"sepspw"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=8; strcpy(filename,"sepatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"sepdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=13; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"sissta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"siswlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"sisatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"sisdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=14; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=5; strcpy(filename,"ghosta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=5; strcpy(filename,"ghowlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=8; strcpy(filename,"ghoatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"ghodie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=15; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"bassta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"baswlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"basatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"basdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } count2=16; if (animation[count2].loaded==2) { animation[count2].loaded=1; animation[count2].stand[0]=numofanimations; animation[count2].stand[1]=6; strcpy(filename,"satsta"); for (count=1;count<=animation[count2].stand[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].walk[0]=numofanimations; animation[count2].walk[1]=9; strcpy(filename,"satwlk"); for (count=1;count<=animation[count2].walk[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].attack[0]=numofanimations; animation[count2].attack[1]=9; strcpy(filename,"satatk"); for (count=1;count<=animation[count2].attack[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } animation[count2].die[0]=numofanimations; animation[count2].die[1]=9; strcpy(filename,"ribdie"); for (count=1;count<=animation[count2].die[1];count++) { filename[6]=48+(count/10)%10; filename[7]=48+count%10; loadtexture(numofanimations,filename,0,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,GL_LINEAR,GL_LINEAR); numofanimations++; } } if (changeddir==0) chdir(".."); }
bumpmaphdl::bumpmaphdl() { type = "bumpmap"; shininess = 1.0; if (vertex == 0 && fragment == 0 && program == 0) { /* TODO Assignment 3: Load and link the shaders and load the texture Keep in mind that vertex, fragment, * and program are static variables meaning they are *shared across all instances of * this class. So you only have to initialize them once when the first instance of * the class is created. */ glEnable(GL_DEPTH_TEST); vertex = load_shader_file("res/bumpmap.vx", GL_VERTEX_SHADER); fragment = load_shader_file("res/bumpmap.ft", GL_FRAGMENT_SHADER); program = glCreateProgram(); progmap.insert(pair<string, int>("bumpmap", program)); printProgramInfoLog(program); glAttachShader(program, vertex); glAttachShader(program, fragment); GLint pok = 0; glGetProgramiv(program, GL_LINK_STATUS, &pok); if (pok == GL_FALSE) cout << "program bad" << endl; if (pok == GL_TRUE) cout << "program good" << endl; glAttachShader(program, vertex); glAttachShader(program, fragment); GLint vok = 0; GLint fok = 0; glGetShaderiv(vertex, GL_COMPILE_STATUS, &vok); glGetShaderiv(fragment, GL_COMPILE_STATUS, &fok); if (vok == GL_FALSE) cout << "Something in the vertex shader fed up"; if (vok == GL_TRUE) cout << "normmap V shader is good"; if (fok == GL_FALSE) cout << "Something in the fragment shader fed up"; if (vok == GL_TRUE) cout << "F shader is good"; printShaderInfoLog(vertex); printShaderInfoLog(fragment); glLinkProgram(program); pok = 0; glGetProgramiv(program, GL_LINK_STATUS, &pok); if (pok == GL_FALSE) cout << "program bad" << endl; if (pok == GL_TRUE) cout << "program good" << endl; unsigned width, height ,w2, h2; vector<unsigned char> image,other; loadtexture(width, height, image, "res/img/chest.png"); loadtexture(w2, h2, other, "res/img/chest_nm.png"); glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.data()); glGenerateMipmap(GL_TEXTURE_2D); glGenTextures(1, &normalmap); glBindTexture(GL_TEXTURE_2D, normalmap); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w2, h2, 0, GL_RGBA, GL_UNSIGNED_BYTE, other.data()); glGenerateMipmap(GL_TEXTURE_2D); } }
int main (int argc,char *argv[]) { int count; int flags; const char *temp; #ifdef DATAPATH chdir(DATAPATH); #endif checkbigendian(); loadconfig(); loadscores(); loadplayers(); flags=SDL_INIT_VIDEO|SDL_INIT_TIMER; if (config.joystick) flags|=SDL_INIT_JOYSTICK; SDL_Init(flags); sdlvideoinfo=SDL_GetVideoInfo(); sdlpixelformat=sdlvideoinfo->vfmt; if (sdlpixelformat->BitsPerPixel==16) config.bitsperpixel=16; for (count=1;count<argc;count++) { if (strcmp("-nosound",argv[count])==0) { config.sound=0; option.sound=0; option.music=0; } if (strcmp("-sound",argv[count])==0) config.sound=1; if (strcmp("-nomusic",argv[count])==0) option.music=0; } saveconfig(); SDL_ShowCursor(SDL_DISABLE); listvideomodes(); SDL_WM_SetCaption("Gish","SDL"); SDL_WM_SetIcon(SDL_LoadBMP("gish.bmp"),iconmask); if (windowinfo.bitsperpixel==16) { SDL_GL_SetAttribute(SDL_GL_RED_SIZE,5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,6); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,5); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,0); } if (windowinfo.bitsperpixel==32) { SDL_GL_SetAttribute(SDL_GL_RED_SIZE,8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,8); } SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,windowinfo.depthbits); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,windowinfo.stencilbits); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1); if (windowinfo.fullscreen) SDL_SetVideoMode(windowinfo.resolutionx,windowinfo.resolutiony,windowinfo.bitsperpixel,SDL_OPENGL|SDL_FULLSCREEN); else SDL_SetVideoMode(windowinfo.resolutionx,windowinfo.resolutiony,windowinfo.bitsperpixel,SDL_OPENGL); loadglextentions(); for (count=0;count<2048;count++) glGenTextures(1,&texture[count].glname); glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); if (config.joystick) { numofjoysticks=SDL_NumJoysticks(); for (count=0;count<numofjoysticks;count++) { joy[count]=SDL_JoystickOpen(count); temp=SDL_JoystickName(count); strcpy(joystick[count].name,temp); joystick[count].numofbuttons=SDL_JoystickNumButtons(joy[count]); joystick[count].numofhats=SDL_JoystickNumHats(joy[count]); } SDL_JoystickEventState(SDL_IGNORE); } font.texturenum=0; font.cursornum=0; font.sizex=640; font.sizey=480; loadtexture(1000,"font00.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR); loadtexture(1001,"font01.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR); loadtexture(768,"mouse00.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR); loadtexture(769,"mouse00.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR); setupmenuitems(); if (!glext.multitexture) { notsupportedmenu(); SDL_WM_IconifyWindow(); SDL_Quit(); return(0); } if (config.sound) setupaudio(); mainmenu(); saveconfig(); savescores(); saveplayers(); if (config.sound) shutdownaudio(); SDL_WM_IconifyWindow(); SDL_Quit(); return(0); }