void ms_tick(void)
{
	DrawScene();
	draw_banner();
	
	if (ms.state == MS_EXPANDING)
	{
		ms.expandframe++;
		
		if (ms.expandframe > EXPAND_LENGTH)
			ms.state = MS_DISPLAYED;
		else
			draw_expand();
	}
	
	if (ms.state == MS_DISPLAYED)
	{
		// scan down effect
		if (ms.current_row < map.ysize)
		{
			draw_row(ms.current_row++);
			
			if (ms.current_row < map.ysize)
				draw_row(ms.current_row++);
		}
		
		// draw map
		DrawRect(ms.x - 1, ms.y - 1, ms.x + ms.w, ms.y + ms.h, DK_BLUE);
		DrawSurface(ms.sfc, ms.x, ms.y);
		
		// you-are-here dot
		if (++ms.timer & 8)
			draw_sprite(ms.px, ms.py, SPR_MAP_PIXELS, 4);
		
		// dismissal
		if (ms.lastbuttondown)
		{
			if (!buttondown())
				ms.lastbuttondown = false;
		}
		else if (buttondown())
		{
			ms.state = MS_CONTRACTING;
		}
	}
	else if (ms.state == MS_CONTRACTING)
	{
		ms.expandframe--;
		
		if (ms.expandframe <= 0)
		{
			int param = (ms.return_gm == GM_INVENTORY) ? 1 : 0;
			game.setmode(ms.return_gm, param);
		}
		else
		{
			draw_expand();
		}
	}
}
示例#2
0
void TB_StageSelect::HandleInput()
{
	bool button_down = false;

	if (textbox.YesNoPrompt.IsVisible() || fMadeSelection)
		return;
	
#ifdef CONFIG_USE_TAPS
	// taps control
	{
		int nslots = CountActiveSlots();
		int total_spacing = ((nslots - 1) * LOCS_SPACING);
		int total_width = total_spacing + (nslots * sprites[SPR_STAGEIMAGE].w);
		int x = (Graphics::SCREEN_WIDTH / 2) - (total_width / 2);
		
		for (int i = 0; i < nslots; ++i)
		{
			RectI rect = Sprites::get_sprite_rect(x, LOCS_Y, SPR_STAGEIMAGE);
			if (VJoy::ModeAware::wasTap(rect))
			{
				if (fSelectionIndex == i)
				{
					button_down = true;
					fLastButtonDown = false;
					
					VJoy::ModeAware::specScreenChanged(VJoy::ModeAware::EStageSelect1, false);
					VJoy::ModeAware::specScreenChanged(VJoy::ModeAware::EStageSelect2, true);
				}
				else
				{
					fSelectionIndex = i;
					sound(SND_MENU_MOVE);
					UpdateText();
				}
				
				break;
			}
			
			x += (sprites[SPR_STAGEIMAGE].w + LOCS_SPACING);
		}
	}
#endif 
	
	// pad control
	{
		if (justpushed(LEFTKEY))
		{
			MoveSelection(LEFT);
		}
		else if (justpushed(RIGHTKEY))
		{
			MoveSelection(RIGHT);
		}
		
		// when user picks a location return the new script to execute
		button_down = button_down || buttondown();
	}
	
	if (button_down && !fLastButtonDown)
	{
		int scriptno;
		if (!GetSlotByIndex(fSelectionIndex, NULL, &scriptno))
		{
			stat("StageSelect: starting activation script %d", scriptno);
			JumpScript(scriptno, SP_MAP);
		}
		else
		{	// dismiss "no permission to teleport"
			StopScripts();
		}
		
		fMadeSelection = true;
	}
	
	fLastButtonDown = button_down;
}