/* DigiBand (c)2005 Seijinohki PC Services and Software, This code written by Joe Wall with assitance from Velex * Loutzenhiser, and respected other parties. This code is protected under the GPL License. For any questions * regarding this code, please contact Joe @ www.seijinohki.net. * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the: * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307, USA */ void autoplayscreen(){ #ifdef EXCESSIVE printf("autoplayscreen\n"); #endif static int screenstart; if (!screenfaddingout){ if (currscreen!=prevscreen){ screenstart=SDL_GetTicks(); srand(time(0)); thesong=int((double(rand())/double(RAND_MAX))*double(gbsongcount)); while(thesong==presong){ thesong=int((double(rand())/double(RAND_MAX))*double(gbsongcount)); } #ifdef DEBUG printf("I have determined song:%i will be played.\n",thesong); #endif playpreview(true); char playstring[512]; jukeboxmode=true; guit1diff=2; guit2diff=2; drumdiff=2; if (drumdiff==2&&songs[thesong].drumextdiff<1)drumdiff=1; if (guit1diff==2&&songs[thesong].guitextdiff<1)guit1diff=1; if (guit2diff==2&&songs[thesong].guitextdiff<1)guit2diff=1; if (drumdiff==1&&songs[thesong].drumadvdiff<1)drumdiff=0; if (guit1diff==1&&songs[thesong].guitadvdiff<1)guit1diff=0; if (guit2diff==1&&songs[thesong].guitadvdiff<1)guit2diff=0; newsong=true; songs[0].reloadsong(); songs[thesong].resetplayed(); currbpm=songs[thesong].basebpm; loadscores(); } } if (thesong<0||thesong>gbsongcount){ printf("something changed the song var."); appisrunning=false; return; } if (screenfaddingin||screenfaddingout){ songposition=-240000; } if (currbpm==0) currbpm=150; playrender(); if (!screenfaddingin&&!screenfaddingout){ #ifndef EXCESSIVE if ( songposition > ((songs[thesong].highestmeasure+3)*240000) || SDL_GetTicks()>screenstart+60000){ #else if ( songposition > ((songs[thesong].highestmeasure+3)*240000) || SDL_GetTicks()>screenstart+10000){ #endif //songs[thesong].resetplayed(); nextscreen=21; screenfaddingout=true; screenchangenow=false; screenfaddingin=false; } }else{ sprintf(curravi, "NULL"); } draw_quadt2(0,801,601,0,223,167,255,255,255,255,0,0,backgroundtexture); if (songposition>0){ if(!screenfaddingin&&!screenfaddingout){ if (gpavi.isloaded()){ gpavi.drawavi(289,384,8000,289,384); }else{ draw_quadt2(0,289,384,0,289,384,255,255,255,255,0,0,previewtexture); } } }else{ draw_quadt2(0,289,384,0,289,384,255,255,255,255,0,0,previewtexture); } draw_quad(0,512,384,1000,640,400,255,255,255,255,0,0,67); static char option1[256]; sprintf(option1, "Coins %i/%i Credits (%i)", coinsinserted,coinsperplay,credits); static drawtext option1s; option1s.load(option1,"font.ttf",255,255,255,20); option1s.draw(400,2,5000,255,255,255,255,false,true); const int O1C=16; char osd1text[O1C][256]; int osd1colors[O1C][3]; static drawtext osd1[O1C]; sprintf(osd1text[0], "Title: %s", songs[thesong].name); osd1colors[0][0]=255;osd1colors[0][1]=255;osd1colors[0][2]=255; sprintf(osd1text[1], "Artist: %s", songs[thesong].artist); osd1colors[1][0]=255;osd1colors[1][1]=255;osd1colors[1][2]=255; sprintf(osd1text[2], "Genre: %s", songs[thesong].genre); osd1colors[2][0]=255;osd1colors[2][1]=255;osd1colors[2][2]=255; sprintf(osd1text[3], "From: %s", songs[thesong].cat); osd1colors[3][0]=255;osd1colors[3][1]=255;osd1colors[3][2]=255; sprintf(osd1text[4], "Standard Stats: (D-%i, G-%i,A-%i)",songs[thesong].drumbasdiff,songs[thesong].guitbasdiff,songs[thesong].guitbbasdiff); osd1colors[4][0]=0;osd1colors[4][1]=255;osd1colors[4][2]=0; sprintf(osd1text[5], "Drum Hi-Score: %i (combo:%i)", songs[thesong].basdrumhs,songs[thesong].basdrummc); osd1colors[5][0]=192;osd1colors[5][1]=255;osd1colors[5][2]=192; sprintf(osd1text[6], "Guitar 1 Hi-Score: %i (combo:%i)", songs[thesong].basguitar1hs,songs[thesong].basguitar1mc); osd1colors[6][0]=192;osd1colors[6][1]=255;osd1colors[6][2]=192; sprintf(osd1text[7], "Guitar 2 Hi-Score: %i (combo:%i)", songs[thesong].basguitar2hs,songs[thesong].basguitar2mc); osd1colors[7][0]=192;osd1colors[7][1]=255;osd1colors[7][2]=192; sprintf(osd1text[8], "Advanced Stats: (D-%i, G-%i,A-%i)",songs[thesong].drumadvdiff,songs[thesong].guitadvdiff,songs[thesong].guitbadvdiff); osd1colors[8][0]=255;osd1colors[8][1]=255;osd1colors[8][2]=0; sprintf(osd1text[9], "Drum Hi-Score: %i (combo:%i)", songs[thesong].advdrumhs,songs[thesong].advdrummc); osd1colors[9][0]=255;osd1colors[9][1]=255;osd1colors[9][2]=192; sprintf(osd1text[10], "Guitar 1 Hi-Score: %i (combo:%i)", songs[thesong].advguitar1hs,songs[thesong].advguitar1mc); osd1colors[10][0]=255;osd1colors[10][1]=255;osd1colors[10][2]=192; sprintf(osd1text[11], "Guitar 2 Hi-Score: %i (combo:%i)", songs[thesong].advguitar2hs,songs[thesong].advguitar2mc); osd1colors[11][0]=255;osd1colors[11][1]=255;osd1colors[11][2]=192; sprintf(osd1text[12], "Extreme Stats: (D-%i, G-%i,A-%i)",songs[thesong].drumextdiff,songs[thesong].guitextdiff,songs[thesong].guitbextdiff); osd1colors[12][0]=255;osd1colors[12][1]=0;osd1colors[12][2]=0; sprintf(osd1text[13], "Drum Hi-Score: %i (combo:%i)", songs[thesong].extdrumhs,songs[thesong].extdrummc); osd1colors[13][0]=255;osd1colors[13][1]=192;osd1colors[13][2]=192; sprintf(osd1text[14], "Guitar 1 Hi-Score: %i (combo:%i)", songs[thesong].extguitar1hs,songs[thesong].extguitar1mc); osd1colors[14][0]=255;osd1colors[14][1]=192;osd1colors[14][2]=192; sprintf(osd1text[15], "Guitar 2 Hi-Score: %i (combo:%i)", songs[thesong].extguitar2hs,songs[thesong].extguitar2mc); osd1colors[15][0]=255;osd1colors[15][1]=192;osd1colors[15][2]=192; for (int a=0;a<O1C;a++){ osd1[a].load(osd1text[a],"unicode.ttf",osd1colors[a][0],osd1colors[a][1],osd1colors[a][2],24); osd1[a].draw(593,735-a*19,8000,255,255,255,255,false,true); } static double atimer=0; atimer+=double(steptime)/5000.0; int alpha=int(sin(atimer)*2048.0); if (alpha<0)alpha=0; if (alpha>255)alpha=255; const int O2C=11; static char osd2[O2C][256]; sprintf(osd2[0], "Best Drum Players"); for (int a=0;a<O2C-1;a++){ sprintf(osd2[a+1], " %s %i", dmscorenames[a],dmscores[a]); } for (int a=0;a<O2C;a++){ int s=18; if (a==0) draw_number(osd2[a],643+s,394-(a*(s*2)),8000,s,0,255,0,alpha); else draw_number(osd2[a],643+s,394-(a*(s*2)),8000,s,255,255,255,alpha); } alpha=-int(sin(atimer)*2048.0); if (alpha<0)alpha=0; if (alpha>255)alpha=255; const int O3C=11; static char osd3[O3C][256]; sprintf(osd3[0], "Best Guitar Players"); for (int a=0;a<O3C-1;a++){ sprintf(osd3[a+1], " %s %i", gscorenames[a],gscores[a]); } for (int a=0;a<O3C;a++){ int s=18; if (a==0) draw_number(osd3[a],625+s,394-(a*(s*2)),8000,s,255,0,0,alpha); else draw_number(osd3[a],625+s,394-(a*(s*2)),8000,s,255,255,255,alpha); } }
//screen number: 13 void highscore(){ #ifdef EXCESSIVE printf("gamecreditsscreen\n"); #endif if (currscreen!=prevscreen){ dmpos=0; g1pos=0; g2pos=0; dmhs=false; g1hs=false; g2hs=false; loadscores(); dmrank=11; g1rank=11; g2rank=11; for (int a=9;a>-1;a--){ if (gptscore>dmscores[a]){ dmrank=a; dmhs=true; } if (gpg1tscore>gscores[a]){ g1rank=a; g1hs=true; } if (gpg2tscore>gscores[a]){ g2rank=a; g2hs=true; } } sprintf(dminitials, " "); sprintf(g1initials, " "); sprintf(g2initials, " "); dmoptionselected='A'; g1optionselected='A'; g2optionselected='A'; } static long totalframes; totalframes+=int(steptime); static char dmsccap[60]; if (dmrank==0) sprintf(dmsccap, "1st place"); if (dmrank==1) sprintf(dmsccap, "2nd place"); if (dmrank==2) sprintf(dmsccap, "3rd place"); if (dmrank>2) sprintf(dmsccap, "%ith place", dmrank+1); static char g1sccap[60]; if (g1rank==0) sprintf(g1sccap, "1st place"); if (g1rank==1) sprintf(g1sccap, "2nd place"); if (g1rank==2) sprintf(g1sccap, "3rd place"); if (g1rank>2) sprintf(g1sccap, "%ith place", g1rank+1); static char g2sccap[60]; if (g2rank==0) sprintf(g2sccap, "1st place"); if (g2rank==1) sprintf(g2sccap, "2nd place"); if (g2rank==2) sprintf(g2sccap, "3rd place"); if (g2rank>2) sprintf(g2sccap, "%ith place", g2rank+1); static drawtext dmrankt; static drawtext g1rankt; static drawtext g2rankt; dmrankt.load(dmsccap,"grade.ttf",255,255,255,20); g1rankt.load(g1sccap,"grade.ttf",255,255,255,20); g2rankt.load(g2sccap,"grade.ttf",255,255,255,20); if (dmrank<10)dmrankt.draw(733,552,100,255,255,255,255,true,true);//52px apart. if (g1rank<10)g1rankt.draw(733,352,100,255,255,255,255,true,true); if (g2rank<10)g2rankt.draw(733,152,100,255,255,255,255,true,true); if (dmoptionselected<'A') dmoptionselected='Z'+2; if (dmoptionselected>'Z'+2) dmoptionselected='A'; if (dmpos>2){ if (dmoptionselected<'Z'+1) dmoptionselected='Z'+2; if (dmoptionselected>'Z'+2) dmoptionselected='Z'+1; } if (g1optionselected<'A') g1optionselected='Z'+2; if (g1optionselected>'Z'+2) g1optionselected='A'; if (g1pos>2){ if (g1optionselected<'Z'+1) g1optionselected='Z'+2; if (g1optionselected>'Z'+2) g1optionselected='Z'+1; } if (g2optionselected<'A') g2optionselected='Z'+2; if (g2optionselected>'Z'+2) g2optionselected='A'; if (g2pos>2){ if (g2optionselected<'Z'+1) g2optionselected='Z'+2; if (g2optionselected>'Z'+2) g2optionselected='Z'+1; } if (dmhs)dminitials[dmpos]=dmoptionselected; if (g1hs)g1initials[g1pos]=g1optionselected; if (g2hs)g2initials[g2pos]=g2optionselected; if (dmrank<10)draw_number(dminitials,753,492,8000,50); if (g1rank<10)draw_number(g1initials,753,292,8000,50); if (g2rank<10)draw_number(g2initials,753,92,8000,50); }
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); }
int mainprog(void) { int16_t frame,t; struct monster_obj *nobbin, *hobbin; struct digger_obj odigger; struct obj_position newpos; loadscores(); escape=false; nobbin = NULL; hobbin = NULL; do { soundstop(); creatembspr(); detectjoy(); ddap->gclear(); ddap->gtitle(); outtext(ddap, "D I G G E R",100,0,3); shownplayers(); showtable(ddap); started=false; frame=0; newframe(); teststart(); while (!started) { started=teststart(); if ((akeypressed==27 || akeypressed=='n' || akeypressed=='N') && !gauntlet && diggers==1) { switchnplayers(); shownplayers(); akeypressed=0; } if (frame==0) for (t=54;t<174;t+=12) outtext(ddap, " ",164,t,0); if (frame==50) { if (nobbin != NULL) { CALL_METHOD(nobbin, dtor); } nobbin = monster_obj_ctor(0, MON_NOBBIN, DIR_LEFT, 292, 63); CALL_METHOD(nobbin, put); } if (frame>50 && frame<=77) { CALL_METHOD(nobbin, getpos, &newpos); newpos.x -= 4; if (frame == 77) { newpos.dir = DIR_RIGHT; } CALL_METHOD(nobbin, setpos, &newpos); } if (frame > 50) { CALL_METHOD(nobbin, animate); } if (frame==83) outtext(ddap, "NOBBIN",216,64,2); if (frame==90) { if (hobbin != NULL) { CALL_METHOD(hobbin, dtor); } hobbin = monster_obj_ctor(1, MON_NOBBIN, DIR_LEFT, 292, 82); CALL_METHOD(hobbin, put); } if (frame>90 && frame<=117) { CALL_METHOD(hobbin, getpos, &newpos); newpos.x -= 4; if (frame == 117) { newpos.dir = DIR_RIGHT; } CALL_METHOD(hobbin, setpos, &newpos); } if (frame == 100) { CALL_METHOD(hobbin, mutate); } if (frame > 90) { CALL_METHOD(hobbin, animate); } if (frame==123) outtext(ddap, "HOBBIN",216,83,2); if (frame==130) { digger_obj_init(&odigger, 0, DIR_LEFT, 292, 101); CALL_METHOD(&odigger, put); } if (frame>130 && frame<=157) { odigger.x -= 4; } if (frame>157) { odigger.dir = DIR_RIGHT; } if (frame >= 130) { CALL_METHOD(&odigger, animate); } if (frame==163) outtext(ddap, "DIGGER",216,102,2); if (frame==178) { movedrawspr(FIRSTBAG,184,120); drawgold(0,0,184,120); } if (frame==183) outtext(ddap, "GOLD",216,121,2); if (frame==198) drawemerald(184,141); if (frame==203) outtext(ddap, "EMERALD",216,140,2); if (frame==218) drawbonus(184,158); if (frame==223) outtext(ddap, "BONUS",216,159,2); if (frame == 235) { CALL_METHOD(nobbin, damage); } if (frame == 239) { CALL_METHOD(nobbin, kill); } if (frame == 242) { CALL_METHOD(hobbin, damage); } if (frame == 246) { CALL_METHOD(hobbin, kill); } newframe(); frame++; if (frame>250) frame=0; } if (savedrf) { if (gotgame) { recsavedrf(); gotgame=false; } savedrf=false; continue; } if (escape) break; recinit(); game(); gotgame=true; if (gotname) { recsavedrf(); gotgame=false; } savedrf=false; escape=false; } while (!escape); finish(); return 0; }
int mainprog(void) { Sint4 frame,t,x; loadscores(); escape=false; do { soundstop(); creatembspr(); detectjoy(); gclear(); gtitle(); outtext("D I G G E R",100,0,3); shownplayers(); showtable(); started=false; frame=0; newframe(); teststart(); while (!started) { started=teststart(); if ((akeypressed==27 || akeypressed=='n' || akeypressed=='N') && !gauntlet && diggers==1) { switchnplayers(); shownplayers(); akeypressed=0; } if (frame==0) for (t=54;t<174;t+=12) outtext(" ",164,t,0); if (frame==50) { movedrawspr(FIRSTMONSTER,292,63); x=292; } if (frame>50 && frame<=77) { x-=4; drawmon(0,1,DIR_LEFT,x,63); } if (frame>77) drawmon(0,1,DIR_RIGHT,184,63); if (frame==83) outtext("NOBBIN",216,64,2); if (frame==90) { movedrawspr(FIRSTMONSTER+1,292,82); drawmon(1,0,DIR_LEFT,292,82); x=292; } if (frame>90 && frame<=117) { x-=4; drawmon(1,0,DIR_LEFT,x,82); } if (frame>117) drawmon(1,0,DIR_RIGHT,184,82); if (frame==123) outtext("HOBBIN",216,83,2); if (frame==130) { movedrawspr(FIRSTDIGGER,292,101); drawdigger(0,DIR_LEFT,292,101,1); x=292; } if (frame>130 && frame<=157) { x-=4; drawdigger(0,DIR_LEFT,x,101,1); } if (frame>157) drawdigger(0,DIR_RIGHT,184,101,1); if (frame==163) outtext("DIGGER",216,102,2); if (frame==178) { movedrawspr(FIRSTBAG,184,120); drawgold(0,0,184,120); } if (frame==183) outtext("GOLD",216,121,2); if (frame==198) drawemerald(184,141); if (frame==203) outtext("EMERALD",216,140,2); if (frame==218) drawbonus(184,158); if (frame==223) outtext("BONUS",216,159,2); newframe(); frame++; if (frame>250) frame=0; } if (savedrf) { if (gotgame) { recsavedrf(); gotgame=false; } savedrf=false; continue; } if (escape) break; recinit(); game(); gotgame=true; if (gotname) { recsavedrf(); gotgame=false; } savedrf=false; escape=false; } while (!escape); finish(); return 0; }