Ejemplo n.º 1
0
void CCameraHandler::UpdateController(CPlayer* player, bool fpsMode, bool fsEdgeMove, bool wnEdgeMove)
{
	CCameraController& camCon = GetCurrentController();
	FPSUnitController& fpsCon = player->fpsController;

	const bool fusEdgeMove = ( globalRendering->fullScreen && fsEdgeMove);
	const bool winEdgeMove = (!globalRendering->fullScreen && wnEdgeMove);

	// We have to update transition both before and after updating the controller:
	// before: if the controller makes a new begincam, it needs to take into account previous transitions
	// after: apply changes made by the controller with 0 time transition.
	UpdateTransition();

	if (fpsCon.oldDCpos != ZeroVector) {
		camCon.SetPos(fpsCon.oldDCpos);
		fpsCon.oldDCpos = ZeroVector;
	}

	if (!fpsMode)
		UpdateController(camCon, true, true, fusEdgeMove || winEdgeMove);

	camCon.Update();

	UpdateTransition();
}
Ejemplo n.º 2
0
void Input::Update()
{
    inputstate_t inputState;
    if (GetKeyboardState(inputState.keyboardState))
    {
        UpdateKeyboard(&inputState);
    }

    UpdateController();
}
Ejemplo n.º 3
0
void Input::Tick()
{
    InputState inputState;
    if (GetKeyboardState(inputState.KeyboardState))
    {
        UpdateKeyboard(&inputState);
    }

    UpdateController();
}
Ejemplo n.º 4
0
void VerticalBlank()
{
    // update sprites
    ham_CopyObjToOAM();

    // update controller
    UpdateController();

    // update count
    g_vertBlankCount = (g_vertBlankCount == 60) ? 0 : g_vertBlankCount + 1;

    // signal vertical blank proc done
    g_vertBlankState = TRUE;
}
Ejemplo n.º 5
0
void PhysXVehicle::Update( float delta )
{
	UpdateController(delta);

	//optimization: update all cars by one call. make sense?

	PxVehicleWheels* vehicles[1];
	vehicles[0] = vehicleDrive;
	PxVehicleSuspensionRaycasts(sceneQueryData->batchQuery, 1, vehicles, wheelCount, sceneQueryData->raycastQueryResults);

	if(surfaceTirePairsUsedMaterialsVersion != world->vehicleDrivableMaterialsVersionCounter)
	{
		UpdateSurfaceTirePairs();
		surfaceTirePairsUsedMaterialsVersion = world->vehicleDrivableMaterialsVersionCounter;
	}

	//Update the vehicle for which we want to record debug data.
	//PxVehicleUpdateSingleVehicleAndStoreTelemetryData(delta, scene->mScene->getGravity(), *mSurfaceTirePairs, 
	//	vehicleDrive, *telemetryData);
	PxVehicleUpdates(delta, scene->mScene->getGravity(), *surfaceTirePairs, 1, vehicles);
}
Ejemplo n.º 6
0
static struct DriversInfo* GetDriversInfo(int driver_index)
{
	if (drivers_info == NULL)
	{
		int ndriver;
		drivers_info = (DriversInfo*)malloc(sizeof(struct DriversInfo) * GetNumGames());
		for (ndriver = 0; ndriver < GetNumGames(); ndriver++)
		{
			const game_driver *gamedrv = drivers[ndriver];
			struct DriversInfo *gameinfo = &drivers_info[ndriver];
			const rom_entry *region, *rom;
			machine_config *config;
			const rom_source *source;
			int num_speakers;

			/* Allocate machine config */
			config = global_alloc(machine_config(gamedrv->machine_config));

			gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1);
			gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0);
			gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0);
			gameinfo->isHarddisk = FALSE;
			gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE;
			for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source))
			{
				for (region = rom_first_region(gamedrv, source); region; region = rom_next_region(region))
				{
					if (ROMREGION_ISDISKDATA(region))
						gameinfo->isHarddisk = TRUE;
				}
			}
			gameinfo->hasOptionalBIOS = FALSE;
			if (gamedrv->rom != NULL)
			{
				for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++)
				{
					if (ROMENTRY_ISSYSTEM_BIOS(rom))
					{
						gameinfo->hasOptionalBIOS = TRUE;
						break;
					}
				}
			}

			num_speakers = numberOfSpeakers(config);

			gameinfo->isStereo = (num_speakers > 1);
			gameinfo->screenCount = numberOfScreens(config);
			gameinfo->isVector = isDriverVector(config); // ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0);
			gameinfo->usesRoms = FALSE;
			for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source))
			{
				for (region = rom_first_region(gamedrv, source); region; region = rom_next_region(region))
				{
					for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
					{
						gameinfo->usesRoms = TRUE; 
						break; 
					}
				}
			}
			gameinfo->usesSamples = FALSE;
			
			{
				const device_config_sound_interface *sound;
				const char * const * samplenames = NULL;
				for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) {
					if (sound->devconfig().type() == SOUND_SAMPLES)
					{
						const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config();
						samplenames = intf->samplenames;

						if (samplenames != 0 && samplenames[0] != 0)
						{
							gameinfo->usesSamples = TRUE;
							break;
						}			
					}				
				}
			}
			gameinfo->numPlayers = 0;
			gameinfo->numButtons = 0;
			memset(gameinfo->usesController, 0, sizeof gameinfo->usesController);

			gameinfo->parentIndex = -1;
			if (gameinfo->isClone)
			{
				int i;

				for (i = 0; i < GetNumGames(); i++)
				{
					if (GetParentRomSetIndex(gamedrv) == i)
					{
						gameinfo->parentIndex = i;
						break;
					}
				}
			}

			gameinfo->biosIndex = -1;
			if (DriverIsBios(ndriver))
				gameinfo->biosIndex = ndriver;
			else if (gameinfo->hasOptionalBIOS)
			{
				int parentIndex;

				if (gameinfo->isClone)
					parentIndex = gameinfo->parentIndex;
				else
					parentIndex = ndriver;

				while (1)
				{
					parentIndex = GetGameNameIndex(drivers[parentIndex]->parent);
					if (parentIndex == -1)
					{
						dprintf("bios for %s is not found", drivers[ndriver]->name);
						break;
					}

					if (DriverIsBios(parentIndex))
					{
						gameinfo->biosIndex = parentIndex;
						break;
					}
				}
			}
			/* Free the structure */
			global_free(config);

			gameinfo->usesTrackball = FALSE;
			gameinfo->usesLightGun = FALSE;
			if (gamedrv->ipt != NULL)
			{
				const input_port_config *port;
				ioport_list portlist;
				
				input_port_list_init(portlist, gamedrv->ipt, NULL, 0, FALSE);
				
				for (port = portlist.first(); port != NULL; port = port->next())
				{
					const input_field_config *field;
					for (field = port->fieldlist; field != NULL; field = field->next)
 					{
						UINT32 type;
						type = field->type;
						if (type == IPT_END)
							break;
						if (type == IPT_DIAL || type == IPT_PADDLE || 
							type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y ||
							type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y)
							gameinfo->usesTrackball = TRUE;
						if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y)
							gameinfo->usesLightGun = TRUE;
						if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y)
							gameinfo->usesMouse = TRUE;
					}
				}
			}
		}
		UpdateController();
	}
	return &drivers_info[driver_index];
}
Ejemplo n.º 7
0
static struct DriversInfo* GetDriversInfo(int driver_index)
{
	if (drivers_info == NULL)
	{
		UINT16 ndriver;
		drivers_info = (DriversInfo*)malloc(sizeof(struct DriversInfo) * GetNumGames());
		for (ndriver = 0; ndriver < GetNumGames(); ndriver++)
		{
			const game_driver *gamedrv = &driver_list::driver(ndriver);
			struct DriversInfo *gameinfo = &drivers_info[ndriver];
			const rom_entry *region, *rom;
			machine_config config(*gamedrv, MameUIGlobal());
			const rom_source *source;
			int num_speakers;

			gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1);
			gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0);
			gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0);
			gameinfo->isHarddisk = FALSE;
			gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE;
			for (source = rom_first_source(config); source != NULL; source = rom_next_source(*source))
				for (region = rom_first_region(*source); region; region = rom_next_region(region))
					if (ROMREGION_ISDISKDATA(region))
						gameinfo->isHarddisk = TRUE;

			gameinfo->hasOptionalBIOS = FALSE;
			if (gamedrv->rom != NULL)
				for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++)
					if (ROMENTRY_ISSYSTEM_BIOS(rom))
					{
						gameinfo->hasOptionalBIOS = TRUE;
						break;
					}

			num_speakers = numberOfSpeakers(&config);

			gameinfo->isStereo = (num_speakers > 1);
			gameinfo->screenCount = numberOfScreens(&config);
			gameinfo->isVector = isDriverVector(&config); // ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0);
			gameinfo->usesRoms = FALSE;
			for (source = rom_first_source(config); source != NULL; source = rom_next_source(*source))
				for (region = rom_first_region(*source); region; region = rom_next_region(region))
					for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
					{
						gameinfo->usesRoms = TRUE;
						break;
					}

			gameinfo->usesSamples = FALSE;
			samples_device_iterator iter(config.root_device());
			if (iter.first() != NULL)
				gameinfo->usesSamples = TRUE;

			gameinfo->numPlayers = 0;
			gameinfo->numButtons = 0;
			memset(gameinfo->usesController, 0, sizeof gameinfo->usesController);

			gameinfo->parentIndex = -1;
			if (gameinfo->isClone)
			{
				int i;

				for (i = 0; i < GetNumGames(); i++)
				{
					if (GetParentRomSetIndex(gamedrv) == i)
					{
						gameinfo->parentIndex = i;
						break;
					}
				}
			}

			gameinfo->biosIndex = -1;
			if (DriverIsBios(ndriver))
				gameinfo->biosIndex = ndriver;
			else if (gameinfo->hasOptionalBIOS)
			{
				int parentIndex;

				if (gameinfo->isClone)
					parentIndex = gameinfo->parentIndex;
				else
					parentIndex = ndriver;

				while (1)
				{
					parentIndex = GetGameNameIndex(driver_list::driver(parentIndex).parent);
					if (parentIndex == -1)
					{
						dprintf("bios for %s is not found", driver_list::driver(ndriver).name);
						break;
					}

					if (DriverIsBios(parentIndex))
					{
						gameinfo->biosIndex = parentIndex;
						break;
					}
				}
			}

			gameinfo->usesTrackball = FALSE;
			gameinfo->usesLightGun = FALSE;
			if (gamedrv->ipt != NULL)
			{
				input_port_config *port;
				ioport_list portlist;
				astring errors;
				device_iterator iter(config.root_device());
				for (device_t *device = iter.first(); device != NULL; device = iter.next())
					if (device->input_ports()!=NULL)
						input_port_list_init(*device, portlist, errors);

				for (port = portlist.first(); port != NULL; port = port->next())
				{
					const input_field_config *field;
					for (field = port->first_field(); field != NULL; field = field->next())
 					{
						UINT32 type;
						type = field->type;
						if (type == IPT_END)
							break;
						if (type == IPT_DIAL || type == IPT_PADDLE ||
							type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y ||
							type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y)
							gameinfo->usesTrackball = TRUE;
						if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y)
							gameinfo->usesLightGun = TRUE;
						if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y)
							gameinfo->usesMouse = TRUE;
					}
				}
			}
		}
		UpdateController();
	}
	return &drivers_info[driver_index];
}