void CameraFPS::Event(SDL_Event* event) {
	if (_disableCamera) {
		if (event->type == SDL_KEYDOWN && event->key.keysym.sym == SDLK_t) {
				_disableCamera = false;
		}
		return;
	}

	switch (event->type) {
	case SDL_MOUSEMOTION: if (_captureMouse) { mouseMotionCaptured(event); } break;
	case SDL_KEYDOWN:
		switch (event->key.keysym.sym){
		case SDLK_t:	 disabledCamera(true); break;
		case SDLK_s:	 move(Z, NEGATIVE); break;
		case SDLK_w:	 move(Z, POSITIVE); break;
		case SDLK_a:	 move(X, NEGATIVE); break;
		case SDLK_d:	 move(X, POSITIVE); break;
		case SDLK_LCTRL: move(Y, NEGATIVE); break;
		case SDLK_SPACE: move(Y, POSITIVE); break;
		case SDLK_z:	 turbo(!turbo());	break;

		case SDLK_PLUS:
		case SDLK_KP_PLUS:		boost(10);	  break;
		case SDLK_MINUS:
		case SDLK_KP_MINUS:		boost(-10);	  break;
		case SDLK_KP_MULTIPLY:	boost(1000); break;
		case SDLK_KP_DIVIDE:	boost(-1000); break;

		case SDLK_q:	 rotate(Y, NEGATIVE); break;
		case SDLK_e:	 rotate(Y, POSITIVE); break;
		case SDLK_r:	 rotate(X, NEGATIVE); break;
		case SDLK_f:	 rotate(X, POSITIVE); break;
		default:;
		}
		break;
	case SDL_KEYUP:
		switch (event->key.keysym.sym){
		case SDLK_s:	 move(Z, ZERO); break;
		case SDLK_w:	 move(Z, ZERO); break;
		case SDLK_a:	 move(X, ZERO); break;
		case SDLK_d:	 move(X, ZERO); break;
		case SDLK_SPACE: move(Y, ZERO); break;
		case SDLK_LCTRL: move(Y, ZERO); break;

		case SDLK_q:	 rotate(Y, ZERO); break;
		case SDLK_e:	 rotate(Y, ZERO); break;
		case SDLK_r:	 rotate(X, ZERO); break;
		case SDLK_f:	 rotate(X, ZERO); break;
		default:;
		}
		break;
	default:
		break;
	}
}
Beispiel #2
0
void set_clk(void)
{
	switch(comp.ts.zclk)
	{
		case 0: turbo(1); break;
		case 1: turbo(2); break;
		case 2: turbo(4); break;
		case 3: turbo(4); break;
	}
	comp.ts.intctrl.frame_len = (conf.intlen * cpu.rate) >> 8;
}
Beispiel #3
0
int check_and_fix_level_increase (int using_pin, int test_pin, \
int level){
	/*
	  If the value after increasing is higher than the highest level for 
	  rotating (254) then sets the level to 254
	*/
	if (g_throttle_stick_level + level > HIGHEST_LEVEL){
		turbo (using_pin, test_pin);	
		/*
		  Test code
		*/
		#if defined AUDIBLE_TEST
		test_Too_high (test_pin);	
		#endif
		return 1;	
	/*
	  If the value after increasing is between 155 and 254 then this 
	  function adds the increasing value to the previous level.
	*/
	}else if (g_throttle_stick_level + level < LOWEST_LEVEL){
		normal (using_pin, test_pin);	
		/*
		  Test code
		*/
		#if defined AUDIBLE_TEST
\		test_Too_low (test_pin);
		#endif
		return 2;
	}else 	{
		g_throttle_stick_level =g_throttle_stick_level + level;		
		set_fixed_level (using_pin, test_pin);
		return 0;
	}
}
Beispiel #4
0
/*!
@brief Prevent the motor from unexpected stop due to violate boundary values
in PWM signal.  
@param[in] using_pin This parameter is the Arduino pin number which is used
for sending PWM signal for driving the motor.
@param[in] test_pin This parameter is the Arduino pin number which is used
for audible testing. This parameter is set but not used when using stub.
@return 0 on correct value
@return 1 on too high value
@return 2 on too low value
*/
int check_and_fix_level (int using_pin,int test_pin){
	/*
	  If the setting value is less than the lowest level for rotating
	  (155) then sets the level to 155
	*/
	if (g_throttle_stick_level < LOWEST_LEVEL){
		normal (using_pin, test_pin);
		/*
		  Test code
		*/
		#if defined AUDIBLE_TEST
			test_Too_low (test_pin);
		#endif
		return 2;
	/*
	  If the setting value is higher than the highest level for rotating
	  (254) then sets the level to 254
	*/
	}else if (g_throttle_stick_level > HIGHEST_LEVEL){		
		turbo (using_pin, test_pin);
		/*
		  Test code
		*/
		#if defined AUDIBLE_TEST
			test_Too_high (test_pin);
		#endif
		return 1;
	/*
	  If the setting value is between 155 and 254 then this function
	  does nothing.
	*/	
	}else {
		return 0;
	}
}
void set_preference_display_settings()
{
	set_grid(grid());
	set_turbo(turbo());
	set_turbo_speed(turbo_speed());
	set_color_cursors(preferences::get("color_cursors", true));
}
Beispiel #6
0
display_manager::display_manager(display* d)
{
	disp = d;

	load_hotkeys();

	set_grid(grid());
	set_turbo(turbo());
	set_turbo_speed(turbo_speed());
	set_scroll_to_action(scroll_to_action());
	set_color_cursors(preferences::get("color_cursors", false));
}
Beispiel #7
0
void reset(ROM_MODE mode)
{
   comp.pEFF7 &= conf.EFF7_mask;
   comp.pEFF7 |= EFF7_GIGASCREEN; // [vv] disable turbo
   {
        conf.frame = frametime;
        cpu.SetTpi(conf.frame);
//                if ((conf.mem_model == MM_PENTAGON)&&(comp.pEFF7 & EFF7_GIGASCREEN))conf.frame = 71680; //removed 0.37
        apply_sound();
   } //Alone Coder 0.36.4
   comp.t_states = 0; comp.frame_counter = 0;
   comp.p7FFD = comp.pDFFD = comp.pFDFD = comp.p1FFD = 0;
   comp.p7EFD = comp.p78FD = comp.p7AFD = comp.p7CFD = comp.gmx_config = comp.gmx_magic_shift = 0;
   comp.pLSY256 = 0;

   comp.ulaplus_mode=0;
   comp.ulaplus_reg=0;

   tsinit();

   if (conf.mem_model == MM_TSL)
		set_clk();		// turbo 2x (7MHz) for TS-Conf
   else
		turbo(1);		// turbo 1x (3.5MHz) for all other clones
        
   if (conf.mem_model == MM_LSY256)
        mode = RM_SYS;
   
   switch (mode)
   {
	case RM_SYS: {comp.ts.memconf = 4; break;}
	case RM_DOS: {comp.ts.memconf = 0; break;}
	case RM_128: {comp.ts.memconf = 0; break;}
	case RM_SOS: {comp.ts.memconf = 0; break;}
   }

   comp.p00 = comp.p80FD = 0; 	// quorum

   comp.pBF = 0; // ATM3
   comp.pBE = 0; // ATM3

   if (conf.mem_model == MM_ATM710 || conf.mem_model == MM_ATM3)
   {
       switch(mode)
       {
       case RM_DOS:
           // Запрет палитры, запрет cpm, включение диспетчера памяти
           // Включение механической клавиатуры, разрешение кадровых прерываний
           set_atm_FF77(0x4000 | 0x200 | 0x100, 0x80 | 0x40 | 0x20 | 3);
           comp.pFFF7[0] = 0x100 | 1; // trdos
           comp.pFFF7[1] = 0x200 | 5; // ram 5
           comp.pFFF7[2] = 0x200 | 2; // ram 2
           comp.pFFF7[3] = 0x200;     // ram 0

           comp.pFFF7[4] = 0x100 | 1; // trdos
           comp.pFFF7[5] = 0x200 | 5; // ram 5
           comp.pFFF7[6] = 0x200 | 2; // ram 2
           comp.pFFF7[7] = 0x200;     // ram 0
       break;
       default:
           set_atm_FF77(0,0);
       }
   }

   if (conf.mem_model == MM_ATM450)
   {
       switch(mode)
       {
       case RM_DOS:
           set_atm_aFE(0x80|0x60);
           comp.aFB = 0;
       break;
       default:
           set_atm_aFE(0x80);
           comp.aFB = 0x80;
       }
   }

   comp.flags = 0;
   comp.active_ay = 0;

   cpu.reset();
   reset_tape();
   reset_sound();

   #ifdef MOD_VID_VD
   comp.vdbase = 0; comp.pVD = 0;
   #endif

   load_spec_colors();

   comp.ide_hi_byte_r = 0;
   comp.ide_hi_byte_w = 0;
   comp.ide_hi_byte_w1 = 0;
   hdd.reset();
   input.atm51.reset();
   input.buffer.Enable(false);

   if ((!conf.trdos_present && mode == RM_DOS) ||
       (!conf.cache && mode == RM_CACHE))
       mode = RM_SOS;

   set_mode(mode);
}