1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-16 01:54:38 +02:00

fix FMV in VR mode; more buttons to skip FMV; remove gamepad selection for SNES (CLOVER) platform; do not play FMV for level restart and title screen;

This commit is contained in:
XProger
2018-07-15 03:33:33 +03:00
parent a94e0193a5
commit a079eacaba
5 changed files with 29 additions and 18 deletions

View File

@@ -949,9 +949,10 @@ namespace Core {
void endFrame() { void endFrame() {
GAPI::endFrame(); GAPI::endFrame();
active.targetOp |= RT_STORE_COLOR; if (active.target != defaultTarget) {
GAPI::setTarget(NULL, RT_STORE_COLOR); GAPI::setTarget(NULL, 0);
validateRenderState(); validateRenderState();
}
Core::stats.stop(); Core::stats.stop();
} }

View File

@@ -14,10 +14,20 @@ namespace Game {
Stream *nextLevel; Stream *nextLevel;
void startLevel(Stream *lvl) { void startLevel(Stream *lvl) {
TR::LevelID id = TR::LVL_MAX;
if (level)
id = level->level.id;
Input::stopJoyVibration(); Input::stopJoyVibration();
delete level; delete level;
level = new Level(*lvl); level = new Level(*lvl);
level->init();
bool playVideo = id != level->level.id;
if (level->level.isTitle() && id != TR::LVL_MAX)
playVideo = false;
level->init(playVideo);
UI::game = level; UI::game = level;
#if !defined(_OS_PSP) && !defined(_OS_CLOVER) #if !defined(_OS_PSP) && !defined(_OS_CLOVER)
UI::helpTipTime = 5.0f; UI::helpTipTime = 5.0f;

View File

@@ -153,8 +153,10 @@ static const OptionItem optControls[] = {
OptionItem( OptionItem::TYPE_TITLE, STR_SET_CONTROLS ), OptionItem( OptionItem::TYPE_TITLE, STR_SET_CONTROLS ),
OptionItem( ), OptionItem( ),
OptionItem( OptionItem::TYPE_PARAM, STR_NOT_IMPLEMENTED , SETTINGS( playerIndex ), STR_PLAYER_1, 0, 1 ), OptionItem( OptionItem::TYPE_PARAM, STR_NOT_IMPLEMENTED , SETTINGS( playerIndex ), STR_PLAYER_1, 0, 1 ),
#ifndef _OS_CLOVER
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_GAMEPAD , SETTINGS( controls[0].joyIndex ), STR_GAMEPAD_1, 0, 3 ), OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_GAMEPAD , SETTINGS( controls[0].joyIndex ), STR_GAMEPAD_1, 0, 3 ),
#ifdef _OS_WIN #endif
#if defined(_OS_WIN) || defined(_OS_LINUX) || defined(_OS_RPI)
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_VIBRATION , SETTINGS( controls[0].vibration ), STR_OFF, 0, 1 ), OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_VIBRATION , SETTINGS( controls[0].vibration ), STR_OFF, 0, 1 ),
#endif #endif
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_RETARGET , SETTINGS( controls[0].retarget ), STR_OFF, 0, 1 ), OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_RETARGET , SETTINGS( controls[0].retarget ), STR_OFF, 0, 1 ),
@@ -543,8 +545,8 @@ struct Inventory {
delete background[i]; delete background[i];
} }
void init() { void init(bool playVideo) {
new Stream(TR::getGameVideo(game->getLevel()->id), loadVideo, this); new Stream(playVideo ? TR::getGameVideo(game->getLevel()->id) : NULL, loadVideo, this);
} }
bool isActive() { bool isActive() {
@@ -926,7 +928,9 @@ struct Inventory {
} }
void update() { void update() {
if (video && (Input::state[0][cInventory] || Input::state[1][cInventory])) if (video && (Input::state[0][cInventory] || Input::state[0][cAction] || Input::state[0][cJump] ||
Input::state[1][cInventory] || Input::state[1][cAction] || Input::state[1][cJump] ||
Input::down[ikCtrl] || Input::down[ikEnter] || Input::down[ikAlt]))
skipVideo(); skipVideo();
if (video) { if (video) {
@@ -1438,11 +1442,9 @@ struct Inventory {
vertices[10].texCoord = vertices[10].texCoord =
vertices[11].texCoord = short4(0, 0, 0, 0); vertices[11].texCoord = short4(0, 0, 0, 0);
if (Core::settings.detail.stereo == Core::Settings::STEREO_VR || !background[0]) { if ((Core::settings.detail.stereo == Core::Settings::STEREO_VR && !video) || !background[0])
for (int i = 0; i < 4; i++) Core::blackTex->bind(sDiffuse); // black background
vertices[i].light.x = vertices[i].light.y = vertices[i].light.z = 0; else
Core::whiteTex->bind(sDiffuse); // black background
} else
background[0]->bind(sDiffuse); background[0]->bind(sDiffuse);
game->setShader(Core::passFilter, Shader::FILTER_UPSCALE, false, false); game->setShader(Core::passFilter, Shader::FILTER_UPSCALE, false, false);

View File

@@ -759,8 +759,8 @@ struct Level : IGame {
Sound::stopAll(); Sound::stopAll();
} }
void init() { void init(bool playVideo) {
inventory->init(); inventory->init(playVideo);
} }
void addPlayer(int index) { void addPlayer(int index) {
@@ -2636,9 +2636,6 @@ struct Level : IGame {
} }
void render() { void render() {
if (inventory->video)
return;
bool title = inventory->isActive() || level.isTitle(); bool title = inventory->isActive() || level.isTitle();
bool copyBg = title && lastTitle != title; bool copyBg = title && lastTitle != title;
lastTitle = title; lastTitle = title;

View File

@@ -1454,6 +1454,7 @@ static const uint32 BIT_MASK[] = {
0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF,
}; };
// TODO: refactor for LE, BE, byte and word reading
struct BitStream { struct BitStream {
uint8 *data; uint8 *data;
uint8 *end; uint8 *end;