Example #1
0
void intro_tick()
{
	if (blanktimer > 0)
	{
		ClearScreen(BLACK);
		
		if (--blanktimer == 0)
			game.setmode(GM_TITLE);
		return;
	}
	
	game_tick_normal();
	player->y = 0;
	
	// when script ends with WAI9999, detect it and move on to title screen
	ScriptInstance *script = GetCurrentScriptInstance();
	if ((script && script->delaytimer == 9999) || buttonjustpushed() || VJoy::ModeAware::wasTap())
	{
		StopScripts();
		blanktimer = EXIT_DELAY;
	}
	
	// lower time for startup
	if (script && script->delaytimer && script->ip == 5)
	{
		game.showmapnametime = 0;
		if (script->delaytimer > 20)
			script->delaytimer = 20;
	}
}
Example #2
0
void TB_SaveSelect::Run_Input()
{
int start;

	if (justpushed(DOWNKEY))
	{
		start = fCurSel;
		for(;;)
		{
			fCurSel++;
			if (fCurSel >= fNumFiles) fCurSel = 0;
			
			if (fSaving) break;
			if (fHaveProfile[fCurSel]) break;
			if (fCurSel == start) break;
		}
		
		sound(SND_MENU_MOVE);
		fPicXOffset = -24;
	}
	
	if (justpushed(UPKEY))
	{
		start = fCurSel;
		for(;;)
		{
			fCurSel--;
			if (fCurSel < 0) fCurSel = fNumFiles - 1;
			
			if (fSaving) break;
			if (fHaveProfile[fCurSel]) break;
			if (fCurSel == start) break;
		}
		
		sound(SND_MENU_MOVE);
		fPicXOffset = -24;
	}
	
	if (buttonjustpushed())
	{
		// when shown in a replay, the box is shown and everything just like what was done
		// originally, but we won't actually overwrite any save files.
		if (!Replay::IsPlaying())
		{
			if (fSaving)
				game_save(fCurSel);
			
			settings->last_save_slot = fCurSel;
			settings_save();		// record new save/load slot
		}
		
		SetVisible(false);
		
		// when the script hit the <SVP, it froze itself in an artifical <WAI9999
		// waiting for us to complete. Now unfreeze it so can say "Game saved.",
		// or for loading, just end.
		ScriptInstance *s = GetCurrentScriptInstance();
		if (s) s->delaytimer = 0;
	}
}
Example #3
0
static void handle_input()
{
    bool button_pressed = false;
#ifdef CONFIG_USE_TAPS
    // tap controls
    {
        int cx = (Graphics::SCREEN_WIDTH / 2) - (sprites[SPR_MENU].w / 2) - 8;
        int cy = (Graphics::SCREEN_HEIGHT / 2) - 8;
        for(int i=0;i<sprites[SPR_MENU].nframes;i++)
        {
            RectI r = Sprites::get_sprite_rect(cx, cy, SPR_MENU, i);
            if (VJoy::ModeAware::wasTap(r))
            {
                if (title.cursel == i)
                {
                    button_pressed = true;
                    
                }
                else
                {
                    sound(SND_MENU_MOVE);
                    title.cursel = i;
                }
                
                break;
            }

            cy += (sprites[SPR_MENU].h + 18);
        }
    }
#endif
    
    // pad control
    {
        if (justpushed(DOWNKEY))
        {
            sound(SND_MENU_MOVE);
            if (++title.cursel >= sprites[SPR_MENU].nframes)
                title.cursel = 0;
        }
        else if (justpushed(UPKEY))
        {
            sound(SND_MENU_MOVE);
            if (--title.cursel < 0)
                title.cursel = sprites[SPR_MENU].nframes - 1;
        }
        
        button_pressed = button_pressed || buttonjustpushed();
	}
    
    
	if (button_pressed)
	{
		sound(SND_MENU_SELECT);
		int choice = title.cursel;
		
		// handle case where user selects Load but there is no savefile,
		// or the last_save_file is deleted.
		if (title.cursel == 1)
		{
			if (!ProfileExists(settings->last_save_slot))
			{
				bool foundslot = false;
				for(int i=0;i<MAX_SAVE_SLOTS;i++)
				{
					if (ProfileExists(i))
					{
						stat("Last save file %d missing. Defaulting to %d instead.", settings->last_save_slot, i);
						settings->last_save_slot = i;
						foundslot = true;
					}
				}
				
				// there are no save files. Start a new game instead.
				if (!foundslot)
				{
					stat("No save files found. Starting new game instead.");
					choice = 0;
				}
			}
		}
		
		if (choice == 1 && settings->multisave)
		{
			title.selchoice = 2;
			title.seldelay = SELECT_MENU_DELAY;
		}
		else
		{
			title.selchoice = choice;
			title.seldelay = SELECT_DELAY;
			music(0);
		}
	}
	
	run_konami_code();
}
Example #4
0
static void handle_input()
{
	if (justpushed(DOWNKEY))
	{
		sound(SND_MENU_MOVE);
		if (++title.cursel >= sprites[SPR_MENU].nframes)
			title.cursel = 0;
	}
	else if (justpushed(UPKEY))
	{
		sound(SND_MENU_MOVE);
		if (--title.cursel < 0)
			title.cursel = sprites[SPR_MENU].nframes - 1;
	}
	
	if (buttonjustpushed())
	{
		sound(SND_MENU_SELECT);
		int choice = title.cursel;
		
		// handle case where user selects Load but there is no savefile,
		// or the last_save_file is deleted.
		if (title.cursel == 1)
		{
			if (!ProfileExists(settings->last_save_slot))
			{
				bool foundslot = false;
				for(int i=0;i<MAX_SAVE_SLOTS;i++)
				{
					if (ProfileExists(i))
					{
						stat("Last save file %d missing. Defaulting to %d instead.", settings->last_save_slot, i);
						settings->last_save_slot = i;
						foundslot = true;
					}
				}
				
				// there are no save files. Start a new game instead.
				if (!foundslot)
				{
					stat("No save files found. Starting new game instead.");
					choice = 0;
				}
			}
		}
		
		if (choice == 1 && settings->multisave)
		{
			title.selchoice = 2;
			title.seldelay = SELECT_MENU_DELAY;
		}
		else
		{
			title.selchoice = choice;
			title.seldelay = SELECT_DELAY;
			music(0);
		}
	}
	
	run_konami_code();
}
Example #5
0
static void RunSelector(stSelector *selector)
{
int nrows;
int currow, curcol;
char toggle = 0;

	if (inv.lockinput)
	{
		if (GetCurrentScript()==-1) inv.lockinput = 0;
		else return;
	}
	
	if (selector->nitems)
	{
		nrows = (selector->nitems - 1) / selector->rowlen;
		currow = (selector->cursel / selector->rowlen);
		curcol = (selector->cursel % selector->rowlen);
	}
	else
	{
		nrows = currow = curcol = 0;
	}
	
	if (justpushed(LEFTKEY))
	{
		sound(selector->sound);
		
		// at beginning of row?
		if (curcol == 0)
		{	// wrap to end of row
			if (currow < nrows)
				selector->cursel += (selector->rowlen - 1);
			else if (selector->nitems > 0)
				selector->cursel = selector->nitems - 1;
		}
		else selector->cursel--;
	}
	
	if (justpushed(RIGHTKEY))
	{
		sound(selector->sound);
		
		// at end of row?
		if (curcol==selector->rowlen-1 || selector->cursel+1 >= selector->nitems)
		{	// wrap to beginning of row
			selector->cursel = (currow * selector->rowlen);
		}
		else selector->cursel++;
	}
	
	if (justpushed(DOWNKEY))
	{
		// on last row?
		if (currow >= nrows) toggle = 1;
		else
		{
			selector->cursel += selector->rowlen;
			
			// don't go past last item
			if (selector->cursel >= selector->nitems)
				selector->cursel = (selector->nitems - 1);
				
			sound(selector->sound);
		}
	}
	
	if (justpushed(UPKEY))
	{
		// on top row?
		if (currow == 0) toggle = 1;
		else
		{
			selector->cursel -= selector->rowlen;
			sound(selector->sound);
		}
	}
	
	// switch to other selector
	if (toggle)
	{
		if (selector == &inv.itemsel)
		{
			selector = &inv.armssel;
		}
		else
		{
			selector = &inv.itemsel;
		}
		
		inv.curselector = selector;
		
		sound(selector->sound);
		selector->lastsel = -9999;
	}
	
	// bring up scripts
	if (selector->cursel != selector->lastsel)
	{
		selector->lastsel = selector->cursel;
		
		StartScript(selector->items[selector->cursel] + selector->scriptbase, SP_ARMSITEM);
	}
	
	
	if (selector == &inv.armssel)		// selecting a weapon
	{
		if (buttonjustpushed())
		{	// select the new weapon
			weapon_slide(LEFT, selector->items[selector->cursel]);
			ExitInventory();
		}
	}
	else									// selecting an item
	{
		if (justpushed(JUMPKEY))
		{	// bring up "more info" or "equip" script for this item
			StartScript(selector->items[selector->cursel] + selector->scriptbase + 1000, SP_ARMSITEM);
			inv.lockinput = 1;
		}
		
		if (justpushed(FIREKEY))
			ExitInventory();
	}

   if (justpushed(INVENTORYKEY))
			ExitInventory();
}