Пример #1
0
void pregamemenu(void)
  {
  int count,count2;
  int simtimer;
  int simcount;
  int startdelay;

  game.exit=GAMEEXIT_NONE;

  startdelay=0;
  simtimer=SDL_GetTicks();

  resetmenuitems();

  joymenunum=1;

  while (!menuitem[0].active && !windowinfo.shutdown)
    {
    glClearColor(0.0f,0.0f,0.0f,0.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    numofmenuitems=0;
    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);
    setmenuitem(MO_HOTKEY,SCAN_ESC);

    createmenuitem(TXT_START,(320|TEXT_CENTER),320,16,1.0f,1.0f,1.0f,1.0f);
    setmenuitem(MO_HOTKEY,SCAN_S);

    checksystemmessages();
    checkkeyboard();
    checkmouse();
    checkjoystick();
    checkmenuitems();

    setuptextdisplay();

    glColor4f(1.0f,1.0f,1.0f,1.0f);
    displaybackground(540);

    if (game.levelnum<35)
      {
      count=(game.levelnum-1)/7+1;
      count2=(game.levelnum-1)%7+1;
      if (count==1)
        drawbackground(521,(320|TEXT_CENTER),48,192,192,640,480);
      if (count==2)
        drawbackground(522,(320|TEXT_CENTER),48,192,192,640,480);
      if (count==3)
        drawbackground(523,(320|TEXT_CENTER),48,192,192,640,480);
      if (count==4)
        drawbackground(524,(320|TEXT_CENTER),48,192,192,640,480);
      if (count==5)
        drawbackground(525,(320|TEXT_CENTER),48,192,192,640,480);

      drawtext("/i-/i",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f,count,count2);
      drawtext(TXT_LIVES" /i",(320|TEXT_CENTER),272,16,1.0f,1.0f,1.0f,1.0f,game.numoflives);
      drawtext(TXT_POINTS" /i",(320|TEXT_CENTER),288,16,1.0f,1.0f,1.0f,1.0f,game.totalscore);
      }
    if (game.levelnum==64)
      {
      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);
      drawtext(" -1",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);
      }
    if (game.levelnum==65)
      {
      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);
      drawtext(" -2",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);
      }
    if (game.levelnum==66)
      {
      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);
      drawtext(" -3",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);
      }
    if (game.levelnum==67)
      {
      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);
      drawtext(TXT_ISLE_OF_THE,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);
      drawtext(TXT_DEAD,(320|TEXT_CENTER),272,16,1.0f,1.0f,1.0f,1.0f);
      }
    if (game.levelnum==68)
      {
      drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480);
      drawtext(TXT_SATANS_LAIR,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f);
      }

    drawmenuitems();

    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);

    SDL_GL_SwapBuffers();

    if (menuitem[1].active)// || startdelay>=150)
      {
      loadstorylevel(game.levelnum);

      gameloop();

      if (game.exit==GAMEEXIT_EXITGAME || game.exit==GAMEEXIT_DIED)
      if (game.levelnum<64)
        {
        if (game.numoflives<99)
          game.numoflives--;
        if (game.numoflives<0)
          {
          if (player[playernum].highscore<game.totalscore)
            player[playernum].highscore=game.totalscore;

          game.totalscore=0;
          game.numoflives=5;
          if (game.difficulty==1)
            {
            count2=(game.levelnum-1)%7+1;
            if (count2!=7)
              {
              count=(game.levelnum-1)/7;
              game.levelnum=count*7+1;
              }
            }
          if (game.difficulty>=2)
            game.levelnum=0;

          gameovermenu();

          goto changelevelbypass;
          }
        }

      if (game.levelnum==34)
      if (game.exit==GAMEEXIT_WON || game.exit==GAMEXIT_WARPZONE)
        {
        game.score[0]=10000;
        if (game.levelnum==34 && game.exit==GAMEEXIT_WON)
          game.score[0]+=1;

        game.score[0]+=(object[0].hitpoints/50)*10;
        postgamemenu();
        game.totalscore+=game.score[0];

        endingmenu();
        menuitem[0].active=1;

        game.levelnum=35;

        goto changelevelbypass;
        }

      if (game.exit==GAMEEXIT_WON)
        {
        //if (!game.bosslevel)
        if (game.levelnum!=68 || game.dialog==0)
          {
          if (game.levelnum==6)
            game.score[0]=1000;
          if (game.levelnum==13)
            game.score[0]=2000;
          if (game.levelnum==20)
            game.score[0]=3000;
          if (game.levelnum==27)
            game.score[0]=4000;
          if (game.levelnum==33)
            game.score[0]=5000;
          if (game.levelnum==34)
            game.score[0]=10000;
          if (game.levelnum==68)
            game.score[0]=20000;

          //if (game.levelnum==34 && game.exit==won)
          //  game.score[0]+=10;

          game.oldschool=0;
          game.score[0]+=(object[0].hitpoints/50)*10;
          postgamemenu();
          game.totalscore+=game.score[0];
          if (game.exit==GAMEEXIT_EXITGAME)
            {
            game.exit=GAMEEXIT_WON;
            menuitem[0].active=1;
            }
          }
        if (game.levelnum<35)
          game.levelnum++;
        }
      if (game.levelnum==64)
        {
        game.levelnum=4;
        if (game.over==3)
          game.levelnum=22;
        if (game.over==4)
          game.levelnum=15;
        if (game.over==5)
          game.levelnum=8;

        goto changelevelbypass;
        }
      if (game.levelnum==65)
        {
        game.levelnum=9;

        goto changelevelbypass;
        }
      if (game.levelnum==66)
        {
        game.levelnum=26;

        goto changelevelbypass;
        }
      if (game.levelnum==67)
        {
        if (game.exit==GAMEEXIT_EXITGAME || game.exit==GAMEEXIT_DIED)
          game.levelnum=19;
        else
          game.levelnum=68;

        goto changelevelbypass;
        }
      if (game.levelnum==68)
        {
        game.levelnum=19;

        goto changelevelbypass;
        }
      if (game.exit==GAMEXIT_WARPZONE)
        {
        game.totalscore+=game.score[0];

        if (game.levelnum==3)
          game.levelnum=64;
        if (game.levelnum==4)
          game.levelnum=24;
        if (game.levelnum==8)
          game.levelnum=65;
        if (game.levelnum==18)
          game.levelnum=67;
        if (game.levelnum==25)
          game.levelnum=66;

        goto changelevelbypass;
        }

      changelevelbypass:;

      simtimer=SDL_GetTicks();
      startdelay=0;

      joymenunum=1;
      }

    simcount=0;
    while (SDL_GetTicks()-simtimer>20 && simcount<5)
      {
      simcount++;
      count=SDL_GetTicks()-simtimer-20;
      simtimer=SDL_GetTicks()-count;

      //startdelay++;
      }

    if (game.exit==GAMEEXIT_EXITGAME)
      menuitem[0].active=1;
    }

  resetmenuitems();
  }
Пример #2
0
void singlelevelmenu(void)
  {
  int count;

  resetmenuitems();

  joymenunum=1;

  while (!menuitem[0].active && !windowinfo.shutdown)
    {
    glClearColor(0.0f,0.0f,0.0f,0.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    numofmenuitems=0;
    createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f);
    setmenuitem(MO_HOTKEY,SCAN_ESC);

    count=320;
    createmenuitem(TXT_LEVEL" 1-1",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 1-2",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 1-3",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 1-4",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 1-5",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 1-6",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 1-7",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 2-1",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 2-2",64,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;

    count=320;
    createmenuitem(TXT_LEVEL" 2-3",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 2-4",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 2-5",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 2-6",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 2-7",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 3-1",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 3-2",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 3-3",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 3-4",192,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;

    count=320;
    createmenuitem(TXT_LEVEL" 3-5",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 3-6",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 3-7",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 4-1",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 4-2",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 4-3",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 4-4",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 4-5",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 4-6",320,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;

    count=320;
    createmenuitem(TXT_LEVEL" 4-7",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 5-1",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 5-2",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 5-3",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 5-4",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 5-5",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;
    createmenuitem(TXT_LEVEL" 5-6",448,count,12,1.0f,1.0f,1.0f,1.0f);
    count+=12;

    checksystemmessages();
    checkkeyboard();
    checkmouse();
    checkjoystick();
    checkmenuitems();

    updateogg();
    checkmusic();
    game.songnum=8;
    soundsimulation(view.position,view.orientation);

    setuptextdisplay();

    glColor4f(1.0f,1.0f,1.0f,1.0f);
    displaybackground(620);

    drawtext(TXT_SINGLE_LEVEL,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f);

    drawmenuitems();

    drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f);

    SDL_GL_SwapBuffers();

    for (count=1;count<=34;count++)
    if (menuitem[count].active)
      {
      game.songnum=-1;
      checkmusic();

      game.editing=0;
      game.levelnum=0;

      loadstorylevel(count);

      gameloop();

      savereplay(count+100);

      joymenunum=count;
      }
    }

  resetmenuitems();
  }