Ejemplo n.º 1
0
void O_Control(player_t *player)
{
   int buttons, oldbuttons;

   buttons    = ticbuttons[playernum];
   oldbuttons = oldticbuttons[playernum];

   if((buttons & BT_OPTION) && !(oldbuttons & BT_OPTION))
   {
      cursorpos = 0;
      player->automapflags ^= AF_OPTIONSACTIVE;
      if(player->automapflags & AF_OPTIONSACTIVE)
      {
         hal_appstate.setGrabState(HAL_FALSE); // CALICO: don't grab input
         DoubleBufferSetup();
      }
      else
      {
         hal_appstate.setGrabState(HAL_TRUE); // CALICO: grab input
         WriteEEProm(); // save new settings
      }
   }
   if(!(player->automapflags & AF_OPTIONSACTIVE))
      return;

   // clear buttons so game player isn't moving aroung
   ticbuttons[playernum] &= BT_OPTION; // leave option status alone

   if (playernum != consoleplayer)
      return;

   // animate skull
   if(++cursorcount == 4)
   {
      cursorframe ^= 1;
      cursorcount = 0;
   }

   // check for movement
   if(!(buttons & (JP_UP|JP_DOWN|JP_LEFT|JP_RIGHT)))
      movecount = 0; // move immediately on next press
   else
   {
      if(buttons & JP_RIGHT)
      {
         if(menuitem[cursorpos].hasslider)
         {
            slider[cursorpos].curval++;
            if(slider[cursorpos].curval > slider[cursorpos].maxval)
               slider[cursorpos].curval = slider[cursorpos].maxval;
            if(cursorpos == 0)
            {
               sfxvolume = 255*slider[0].curval / slider[0].maxval;
               S_StartSound(NULL, sfx_pistol);
            }
         }
      }
      if(buttons & JP_LEFT)
      {
         if(menuitem[cursorpos].hasslider)
         {
            slider[cursorpos].curval--;
            if(slider[cursorpos].curval < 0)
               slider[cursorpos].curval = 0;
            if(cursorpos == 0)
            {
               sfxvolume = 255*slider[0].curval / slider[0].maxval;
               S_StartSound(NULL, sfx_pistol);
            }
         }
      }

      if(movecount == MOVEWAIT)
         movecount = 0; // repeat move
      if(++movecount == 1)
      {
         if(buttons & JP_DOWN)
         {
            cursorpos++;
            if(cursorpos == NUMMENUITEMS)
               cursorpos = 0;
         }

         if(buttons & JP_UP)
         {
            cursorpos--;
            if(cursorpos == -1)
               cursorpos = NUMMENUITEMS-1;
         }
         if(buttons & JP_RIGHT)
         {
            if(cursorpos == controls)
            {
               controltype++;
               if(controltype == NUMCONTROLOPTIONS)
                  controltype = (NUMCONTROLOPTIONS - 1); 
            }
         }
         if(buttons & JP_LEFT)
         {
            if(cursorpos == controls)
            {
               controltype--;
               if(controltype == -1)
                  controltype = 0; 
            }
         }
      }
   }
}
Ejemplo n.º 2
0
void G_RunGame (void)
{
	int		i;
	
	while (1)
	{
	/* load a level */
		G_DoLoadLevel ();   
	
	/* run a level until death or completion */
		MiniLoop (P_Start, P_Stop, P_Ticker, P_Drawer);
	
	/* take away cards and stuff */
			
		for (i=0 ; i<MAXPLAYERS ; i++) 
			if (playeringame[i]) 
				G_PlayerFinishLevel (i);	 

		if (gameaction == ga_died)
			continue;			/* died, so restart the level */
	
		if (gameaction == ga_warped)
			continue;			/* skip intermission */
					
	/* decide which level to go to next */
#ifdef MARS
		if (gameaction == ga_secretexit)
			nextmap = 24;
		else
		{
			switch (gamemap)
			{
			case 15: nextmap = 23; break;
			case 24: nextmap = 4; break;
			default: nextmap = gamemap+1; break;
			}
		}
#else
		if (gameaction == ga_secretexit)
		{
			 nextmap = 24;
		}
		else
		{
			switch (gamemap)
			{
			case 24: nextmap = 4; break;
			case 23: nextmap = 23; break;	/* don't add secret level to eeprom */
			default: nextmap = gamemap+1; break;
			}
#ifdef JAGUAR
			if (nextmap > maxlevel)
			{	/* allow higher menu selection now */
				void WriteEEProm (void);
				maxlevel = nextmap;
				WriteEEProm ();
			}
#endif

		}
#endif

	/* run a stats intermission */
		MiniLoop (IN_Start, IN_Stop, IN_Ticker, IN_Drawer);
	
	/* run the finale if needed */
		if (gamemap == 23)
			MiniLoop (F_Start, F_Stop, F_Ticker, F_Drawer);
			
		gamemap = nextmap;
	}
}