示例#1
0
文件: menu.c 项目: shanfl/Shmup
void Action_BackToHomeAfterGameOver(void* tag)
{
	
	
	NET_Free();
	MENU_Set(MENU_HOME);
	dEngine_RequireSceneId(0);
	
}
示例#2
0
文件: menu.c 项目: shanfl/Shmup
void Action_GoToTutorial(void* tag)
{
	int i;
	
	PL_ResetPlayersScore();
	for(i=0 ; i < MAX_NUM_PLAYERS ; i++)
		players[i].respawnCounter = numPlayerRespawn[DIFFICULTY_NORMAL];
	
	if (engine.controlMode == CONTROL_MODE_SWIP)
	{	
		dEngine_RequireSceneId(14);
		MENU_Set(MENU_NONE);
	}
	else 
	{
		dEngine_RequireSceneId(15);
		MENU_Set(MENU_NONE);
	}

		
}
示例#3
0
文件: menu.c 项目: shanfl/Shmup
void Action_PreGoToGameCenter(void* tag)
{
	MENU_Set(MENU_OTHERS);
	
	if (engine.gameCenterEnabled)
		Action_ShowGameCenter(tag);
	else 
	{
		Native_LoginGameCenter();
	}

}
示例#4
0
文件: menu.c 项目: shanfl/Shmup
void Action_PlayDemo(void* tag)
{
	int i;
	char* actId = (char*)tag;
	
	PL_ResetPlayersScore();
	for(i=0 ; i < MAX_NUM_PLAYERS ; i++)
		players[i].respawnCounter = numPlayerRespawn[DIFFICULTY_NORMAL];
	
	engine.difficultyLevel = DIFFICULTY_NORMAL;
	
	dEngine_RequireSceneId(*actId);
	MENU_Set(MENU_NONE);
}
示例#5
0
文件: menu.c 项目: shanfl/Shmup
void Action_ConfigureMultiplayer(void* tag)
{
	int i;
	
	MENU_Set(MENU_MULTIPLAYER);
	engine.mode = DE_MODE_MULTIPLAYER;
	NET_Init();
	PL_ResetPlayersScore();
	
	for(i=0 ; i < MAX_NUM_PLAYERS ; i++)
		players[i].respawnCounter = numPlayerRespawn[DIFFICULTY_NORMAL];
	
	engine.difficultyLevel = DIFFICULTY_NORMAL;
}
示例#6
0
文件: dEngine.c 项目: slarti88/Shmup
void dEngine_InitDisplaySystem(uchar rendererType)
{
	SCR_BindMethods(rendererType);
	
	P_InitPlayers();
	FX_InitMem();
	
	TITLE_AllocRessources();
	COM_Init();
	
	P_CreatePointerCoordinates();
	
	engine.menuVisible = 0;
	MENU_Set(MENU_HOME);
}
示例#7
0
文件: menu.c 项目: shanfl/Shmup
void Action_ReplayAct(void* tag)
{
	menu_button_t* button;
	int actToPlay;
	int* buttonPressed = (int*)tag;
	
	button = &menuScreens[currentMenuId].buttons[*buttonPressed];
	
	actToPlay = '0' - button->text[5];
	
	engine.playback.play = 1;
	
	dEngine_RequireSceneId(actToPlay);
//	engine.requiredSceneId = actToPlay;
	MENU_Set(MENU_NONE);	
	//Use lastButtonPressed
}
示例#8
0
文件: dEngine.c 项目: slarti88/Shmup
void dEngine_Pause(void)
{
	//Timer_Pause();
	
	
	title_mode = MODE_UNKNOWN;
	
	NET_Free();
	COM_StopRecording();
	engine.playback.play = 0;
	
	
	
	engine.menuVisible = 0;
	MENU_Set(MENU_HOME);
	SND_StopSoundTrack();
	SND_FinalizeRecord();
	//dEngine_RequireSceneId(0);
	engine.sceneId = -1;
}
示例#9
0
文件: menu.c 项目: shanfl/Shmup
void Action_startNewGame(void* tag)
{
	int i;
	uchar difficultyLevel;
	
	difficultyLevel = *(char*)tag; 
	
	MENU_Set(MENU_NONE);
	dEngine_RequireSceneId(1);
	
	//Parameter set the difficulty level
	
	engine.mode = DE_MODE_SINGLEPLAYER;
	PL_ResetPlayersScore();
	numPlayers = 1;
	
	
	for(i=0 ; i < MAX_NUM_PLAYERS ; i++)
		players[i].respawnCounter = numPlayerRespawn[difficultyLevel];
	
	engine.difficultyLevel = difficultyLevel;
}
示例#10
0
/**
 * Process the next input event.
 */
static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) {
	struct engine* androidEngine = (struct engine*)app->userData;

	int touchCount = 0;
	static int previousTouchCount;
	int numButton;
	touch_t* touch;
	touch_t* currentTouchSet;

	struct TOUCHSTATE *touchstate = 0;
	struct TOUCHSTATE *prev_touchstate = 0;

	int nSourceId = AInputEvent_getSource( event );

	if (nSourceId == AINPUT_SOURCE_TOUCHPAD)
   		touchstate = engine.touchstate_pad; // GJT: For Xperia Play...and other devices?
	else if (nSourceId == AINPUT_SOURCE_TOUCHSCREEN)
    	touchstate = engine.touchstate_screen;
    else
    	return 0; // GJT: Volume? Keyboard? Let the system handle it...

	if (engine.menuVisible)
	{
		numButton = MENU_GetNumButtonsTouches();
		currentTouchSet = MENU_GetCurrentButtonTouches();		
	}
	else 
	{
		numButton = NUM_BUTTONS;
		currentTouchSet = touches;
	}

	if (engine.menuVisible || engine.controlMode == CONTROL_MODE_VIRT_PAD)
	{
		size_t pointerCount =  AMotionEvent_getPointerCount(event);
		size_t i;
		for (i = 0; i < pointerCount; i++) 
		{
            size_t pointerId = AMotionEvent_getPointerId(event, i);
	        size_t action = AMotionEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK;
		
			touchstate[pointerId].x = AMotionEvent_getX( event, i );
			touchstate[pointerId].y = AMotionEvent_getY( event, i );
			
			LOGI("DEBUG BEFORE x %f y %f", touchstate[pointerId].x, touchstate[pointerId].y);

			// Transforming from whatever screen resolution we have to the original iPhone 320*480
			touchstate[pointerId].x = ( touchstate[pointerId].x - renderer.viewPortDimensions[VP_X] ) * commScale[X] ;
			touchstate[pointerId].y = ( touchstate[pointerId].y - renderer.viewPortDimensions[VP_Y] ) * commScale[Y] ;

			LOGI("DEBUG AFTER  x %f y %f", touchstate[pointerId].x, touchstate[pointerId].y);

			touchCount++;

			// find which one it is closest to
			int		minDist = INT_MAX; // allow up to 64 unit moves to be drags
			int		minIndex = -1;
			int dist;
			touch_t	*t2 = currentTouchSet;
			int i;

			for ( i = 0 ; i < numButton ; i++ ) 
			{
				dist = SQUARE( t2->iphone_coo_SysPos[X] - touchstate[pointerId].x )  + SQUARE( t2->iphone_coo_SysPos[Y] - touchstate[pointerId].y ) ;

				LOGI("DEBUG dist %i minDist %i", dist, minDist);
				if ( dist < minDist ) {
					minDist = dist;
					minIndex = i;
					touch = t2;
				}
				t2++;
			}

			if ( minIndex != -1 ) 
			{
				if (action == AMOTION_EVENT_ACTION_UP) 
				{
					touch->down = 0;
				}
				else 
				{
					if (action == AMOTION_EVENT_ACTION_DOWN) 
					{
					}
					touch->down = 1;
					touch->dist[X] = MIN(1,(touchstate[pointerId].x - touches[minIndex].iphone_coo_SysPos[X])/touches[minIndex].iphone_size);
					touch->dist[Y] = MIN(1,(touches[minIndex].iphone_coo_SysPos[Y] - touchstate[pointerId].y)/touches[minIndex].iphone_size);
					LOGI("DEBUG minIndexIphone %i", touches[minIndex].iphone_size);
				}
			}
		}

		LOGI("DEBUG touchcount %i previous %i", touchCount, previousTouchCount);
		if ( touchCount == 5 && previousTouchCount != 5 ) 
		{
			MENU_Set(MENU_HOME);
			engine.requiredSceneId = 0;
		}
	
		previousTouchCount = touchCount;

		return 1;
	}

	else
	{
		size_t pointerCount =  AMotionEvent_getPointerCount(event);
		size_t i;

		for (i = 0; i < pointerCount; i++) 
		{
			size_t pointerCount =  AMotionEvent_getPointerCount(event);
			size_t pointerId = AMotionEvent_getPointerId(event, i);
	        size_t action = AMotionEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK;
	        size_t pointerIndex = i;
		
			int historySize = AMotionEvent_getHistorySize(event);

			touchstate[pointerId].x = AMotionEvent_getX( event, pointerIndex );
			touchstate[pointerId].y = AMotionEvent_getY( event, pointerIndex );

			LOGI("DEBUG history %i", historySize);

			LOGI("DEBUG nomenu x %f y %f", touchstate[pointerId].x, touchstate[pointerId].y);
			if (historySize > 0)
			{
				//prev_touchstate[pointerId].x = AMotionEvent_getX( event, pointerIndex );
				//prev_touchstate[pointerId].y = AMotionEvent_getY( event, pointerIndex );

				LOGI("DEBUG nomenu prevx %f prevy %f", prev_touchstate[pointerId].x, prev_touchstate[pointerId].y);
			}
			//Transforming from whatever screen resolution we have to the original iPHone 320*480
			/*touchstate[pointerId].x = ( touchstate[pointerId].x- renderer.viewPortDimensions[VP_X] ) * commScale[X] ;//* renderer.resolution ;
			touchstate[pointerId].y = ( touchstate[pointerId].y- renderer.viewPortDimensions[VP_Y] ) * commScale[Y] ;//* renderer.resolution;
			
			prev_touchstate[pointerId].x = ( prev_touchstate[pointerId].x- renderer.viewPortDimensions[VP_X] ) * commScale[X] ;//* renderer.resolution ;
			prev_touchstate[pointerId].y = ( prev_touchstate[pointerId].y- renderer.viewPortDimensions[VP_Y] ) * commScale[Y] ;//* renderer.resolution;*/
			
			
			touchCount++;					

			if (action == AMOTION_EVENT_ACTION_UP) 
			{
				if (touchCount == 1) //Last finger ended
					touches[BUTTON_FIRE].down = 0;
			}
			else 
			{
				if (action == AMOTION_EVENT_ACTION_MOVE) 
				{
					//printf("m\n");
								LOGI("DEBUG MOVE x %f y %f", touchstate[pointerId].x, touchstate[pointerId].y);
			//LOGI("DEBUG MOVE prevx %f prevy %f", prev_touchstate[pointerId].x, prev_touchstate[pointerId].y);

					touches[BUTTON_MOVE].down = 1;
					//touches[BUTTON_MOVE].dist[X] = (touchstate[pointerId].x - prev_touchstate[pointerId].x)*40/(float)320;
					//touches[BUTTON_MOVE].dist[Y] = (touchstate[pointerId].y - prev_touchstate[pointerId].y)*-40/(float)480;
					
				}
				if (action == AMOTION_EVENT_ACTION_DOWN)
				{
					int currTime = E_Sys_Milliseconds();
					if (currTime-lastTouchBegan < 200)
						touches[BUTTON_GHOST].down = 1;
					
					lastTouchBegan = currTime ;
					
					touches[BUTTON_FIRE].down = 1;
				}
				
				
			}
		}

		if ( touchCount == 5 && previousTouchCount != 5 ) 
		{
			MENU_Set(MENU_HOME);
			engine.requiredSceneId=0;
		}
	
		previousTouchCount = touchCount;

		return 1;
	}
	return 0;
}
示例#11
0
文件: dEngine.c 项目: slarti88/Shmup
void dEngine_LoadScene(int sceneId)
{
	event_t* ev;
	
	COM_StopRecording();

	engine.showFingers=0;
	engine.controlVisible=0;
	
	// Reset variables state (only usefull when we are not loading the first level
	EV_InitForScene();
	
	P_ResetPlayers();
	ENE_Reset();
	ENPAR_Reset();
	DYN_TEXT_Init();
	ENE_ReleaseAll();
	
	COM_ResetTouchesBuffer();
	
	numBackgroundEntities=0;
	
	engine.sceneId = sceneId;
	
		
	engine.musicStartAt= 0;
	
	// Now actually start loading things
	World_OpenScene(engine.scenes[engine.sceneId].path);
	
	MENU_Set(engine.scenes[engine.sceneId].defaultMenuId);
	
	COM_StartScene();
	
	
	
	
	ENE_Precache();
	
	if (engine.musicFilename[0] != '\0')
	{
		//SND_InitSoundTrack(engine.musicFilename,engine.musicStartAt);
		//SND_StartSoundTrack();
	}
	
	
	
	
	CAM_LoadPath();
	CAM_StartPlaying();
	
#ifdef GENERATE_VIDEO
		Timer_ForceTimeIncrement(16);
#endif	
	
	Timer_resetTime();
	
	//In single player we start right away, in multiplayer the go is given by the netchannel
	if (engine.mode == DE_MODE_SINGLEPLAYER)
		Timer_Resume();
		
	VIS_Update();
	
	if (engine.sceneId == 1 && engine.licenseType == LICENSE_LIMITED)
	{
		ev = calloc(1, sizeof(event_t));
		ev->time = 130000;
		ev->type = EV_LIMITED_EVENT;
		EV_AddEvent(ev);
	}
    
    //We are back to main menu, init a few things
    if (sceneId == 0 )
    {
        numPlayers = 1;
        PL_ResetPlayersScore();
    }
    
    
}
示例#12
0
  enum MENU_code fInterface( void )
{
    MENU_Set( &InterfaceMenu );

    return MENU_CHANGE;
}
示例#13
0
  enum MENU_code fPower( void )
{
    MENU_Set( &PowerMenu );

    return MENU_CHANGE;
}
示例#14
0
文件: menu.c 项目: shanfl/Shmup
void Action_BackToOptions(void* tag)
{
	NET_Free();
	MENU_Set(MENU_OTHERS);
}
示例#15
0
文件: menu.c 项目: shanfl/Shmup
void Action_BackToHome(void* tag)
{
	NET_Free();
	MENU_Set(MENU_HOME);
}
示例#16
0
文件: menu.c 项目: shanfl/Shmup
void Action_GoToReplayScreen(void* tag)
{
	MENU_Set(MENU_REPLAY);
}
示例#17
0
文件: menu.c 项目: shanfl/Shmup
void Action_ShowOthersMenu(void* tag)
{
	MENU_Set(MENU_OTHERS);
}
示例#18
0
文件: menu.c 项目: shanfl/Shmup
void Action_ShowHomeMenu(void* tag)
{
	MENU_Set(MENU_HOME);
}
示例#19
0
文件: menu.c 项目: shanfl/Shmup
void Action_ShowCreditsMenu(void* tag)
{
	MENU_Set(MENU_CREDITS);
}
示例#20
0
enum MENU_code fSetInput( void )
{
    MENU_Set( &InputMenu );

    return MENU_CHANGE;
}
示例#21
0
文件: menu.c 项目: shanfl/Shmup
void Action_GoToAct(void* tag)
{
	char* actId = (char*)tag;
	dEngine_RequireSceneId(*actId);
	MENU_Set(MENU_NONE);
}
示例#22
0
文件: menu.c 项目: shanfl/Shmup
void Action_SpecifyDifficulty(void* tag)
{
	MENU_Set(MENU_SELECT_DIFFICULTY);
}