mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
TWP: Fix sound position
This commit is contained in:
parent
687dbc7d4b
commit
c5346fa0d2
@ -19,10 +19,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "twp/debugtools.h"
|
||||
#include "backends/imgui/imgui.h"
|
||||
#include "common/debug-channels.h"
|
||||
#include "twp/twp.h"
|
||||
#include "twp/debugtools.h"
|
||||
#include "twp/detection.h"
|
||||
#include "twp/dialog.h"
|
||||
#include "twp/hud.h"
|
||||
@ -35,6 +34,7 @@
|
||||
#include "twp/squtil.h"
|
||||
#include "twp/thread.h"
|
||||
#include "twp/tsv.h"
|
||||
#include "twp/twp.h"
|
||||
|
||||
namespace Twp {
|
||||
|
||||
@ -58,7 +58,7 @@ typedef struct ImGuiState {
|
||||
int _selectedObject = 0;
|
||||
} ImGuiState;
|
||||
|
||||
ImGuiState* _state = nullptr;
|
||||
ImGuiState *_state = nullptr;
|
||||
|
||||
ImVec4 gray(0.6f, 0.6f, 0.6f, 1.f);
|
||||
|
||||
@ -90,7 +90,7 @@ static void drawThreads() {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%-56s", thread->getName().c_str());
|
||||
ImGui::TableNextColumn();
|
||||
if(thread->getId() != g_twp->_cutscene.id) {
|
||||
if (thread->getId() != g_twp->_cutscene.id) {
|
||||
ImGui::Text("%-6s", thread->isGlobal() ? "global" : "local");
|
||||
} else {
|
||||
ImGui::Text("%-6s", "cutscene");
|
||||
@ -311,7 +311,7 @@ static void drawAudio() {
|
||||
ImGui::Text("# sounds: %d/%d", count, NUM_AUDIO_SLOTS);
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::BeginTable("Threads", 7, ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg)) {
|
||||
if (ImGui::BeginTable("Threads", 8, ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg)) {
|
||||
ImGui::TableSetupColumn("");
|
||||
ImGui::TableSetupColumn("Id");
|
||||
ImGui::TableSetupColumn("Category");
|
||||
@ -319,6 +319,7 @@ static void drawAudio() {
|
||||
ImGui::TableSetupColumn("Loops");
|
||||
ImGui::TableSetupColumn("Volume");
|
||||
ImGui::TableSetupColumn("Pan");
|
||||
ImGui::TableSetupColumn("Object");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
for (int i = 0; i < NUM_AUDIO_SLOTS; i++) {
|
||||
@ -345,6 +346,9 @@ static void drawAudio() {
|
||||
if (ImGui::SmallButton("STOP")) {
|
||||
g_twp->_audio->stop(sound.id);
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
Common::SharedPtr<Object> obj(sqobj(sound.objId));
|
||||
ImGui::Text("%s", obj ? g_twp->getTextDb().getText(obj->getName()).c_str() : "(none)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,7 +369,7 @@ static void drawGeneral() {
|
||||
ImGui::Text("%lld", size);
|
||||
ImGui::TextColored(gray, "Cutscene:");
|
||||
ImGui::SameLine();
|
||||
if(g_twp->_cutscene.id) {
|
||||
if (g_twp->_cutscene.id) {
|
||||
Common::SharedPtr<Thread> cutscene(sqthread(g_twp->_cutscene.id));
|
||||
ImGui::Text("%s", cutscene->getName().c_str());
|
||||
} else {
|
||||
@ -452,8 +456,7 @@ static void drawGeneral() {
|
||||
ImGui::TextColored(gray, "moving:");
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("%s", g_twp->_camera->isMoving() ? "yes" : "no");
|
||||
auto halfScreenSize = g_twp->_room->getScreenSize() / 2.0f;
|
||||
auto camPos = g_twp->cameraPos() - halfScreenSize;
|
||||
auto camPos = g_twp->cameraPos();
|
||||
if (ImGui::DragFloat2("Camera pos", camPos.getData())) {
|
||||
g_twp->follow(nullptr);
|
||||
g_twp->cameraAt(camPos);
|
||||
|
@ -488,9 +488,9 @@ void TwpEngine::update(float elapsed) {
|
||||
// if cursor is in the margin of the screen and if camera can move again
|
||||
// then show a left arrow or right arrow
|
||||
Math::Vector2d screenSize = _room->getScreenSize();
|
||||
if ((scrPos.getX() < SCREEN_MARGIN) && (cameraPos().getX() >= 1.f)) {
|
||||
if ((scrPos.getX() < SCREEN_MARGIN) && (_gfx.cameraPos().getX() >= 1.f)) {
|
||||
_inputState.setCursorShape(CursorShape::Left);
|
||||
} else if ((scrPos.getX() > (SCREEN_WIDTH - SCREEN_MARGIN)) && cameraPos().getX() < (_room->_roomSize.getX() - screenSize.getX())) {
|
||||
} else if ((scrPos.getX() > (SCREEN_WIDTH - SCREEN_MARGIN)) && _gfx.cameraPos().getX() < (_room->_roomSize.getX() - screenSize.getX())) {
|
||||
_inputState.setCursorShape(CursorShape::Right);
|
||||
} else if (_room->_fullscreen == FULLSCREENROOM && _noun1) {
|
||||
// if the object is a door, it has a flag indicating its direction: left, right, front, back
|
||||
@ -876,7 +876,6 @@ Common::Error TwpEngine::run() {
|
||||
Common::Event e;
|
||||
uint time = _system->getMillis();
|
||||
while (!shouldQuit()) {
|
||||
Math::Vector2d camPos = _gfx.cameraPos();
|
||||
while (_system->getEventManager()->pollEvent(e)) {
|
||||
switch (e.type) {
|
||||
case Common::EVENT_CUSTOM_ENGINE_ACTION_START: {
|
||||
@ -1025,8 +1024,6 @@ Common::Error TwpEngine::run() {
|
||||
}
|
||||
}
|
||||
|
||||
_gfx.cameraPos(camPos);
|
||||
|
||||
uint32 newTime = _system->getMillis();
|
||||
uint32 delta = newTime - time;
|
||||
time = newTime;
|
||||
@ -1497,10 +1494,6 @@ void TwpEngine::cameraAt(const Math::Vector2d &at) {
|
||||
}
|
||||
|
||||
Math::Vector2d TwpEngine::cameraPos() {
|
||||
if (_room) {
|
||||
Math::Vector2d screenSize = _room->getScreenSize();
|
||||
return _camera->getAt() + screenSize / 2.0f;
|
||||
}
|
||||
return _camera->getAt();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user