System background "tiled" mode is not working #479

Closed
fdelapena opened this Issue May 14, 2015 · 4 comments

Projects

None yet

3 participants

@fdelapena
Member

This test case game uses tiled system background but shows it as stretched:
https://easy-rpg.org/play/?game=ae_en

@fdelapena fdelapena added this to the 0.3.1 milestone May 14, 2015
@Ghabry Ghabry modified the milestone: 0.3.1, 0.4 Sep 6, 2015
@carstene1ns
Member

This seems to fix it, however I do not know if this has any drawbacks this way:

diff --git a/src/game_interpreter_map.cpp b/src/game_interpreter_map.cpp
index 45c0eeb..7a95be7 100644
--- a/src/game_interpreter_map.cpp
+++ b/src/game_interpreter_map.cpp
@@ -869,6 +869,8 @@ bool Game_Interpreter_Map::CommandChangeSystemGraphics(RPG::EventCommand const&
    request->SetImportantFile(true);
    request->Start();

+   Game_System::SetMessageStretch(com.parameters[0] == 1 ? 0 : 1);
+
    return true;
 }

diff --git a/src/game_system.cpp b/src/game_system.cpp
index 59c5f9f..2ab0875 100644
--- a/src/game_system.cpp
+++ b/src/game_system.cpp
@@ -101,6 +101,16 @@ void Game_System::SetSystemName(std::string const& new_system_name) {
    DisplayUi->SetBackcolor(Cache::System()->GetBackgroundColor());
 }

+
+int Game_System::GetMessageStretch() {
+   return data.message_stretch;
+}
+
+void Game_System::SetMessageStretch(int const& new_message_stretch) {
+   data.message_stretch = new_message_stretch;
+}
+
+
 RPG::Music& Game_System::GetSystemBGM(int which) {
    switch (which) {
        case BGM_Battle:        return data.battle_music;
diff --git a/src/game_system.h b/src/game_system.h
index 814a160..57fb50b 100644
--- a/src/game_system.h
+++ b/src/game_system.h
@@ -126,6 +126,11 @@ namespace Game_System {
     */
    void SetSystemName(std::string const& system_name);

+
+   int GetMessageStretch();
+   void SetMessageStretch(int const& new_message_stretch);
+
+
    /**
     * Gets the system music.
     *
diff --git a/src/window.cpp b/src/window.cpp
index 42dbb8a..1cb377a 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -195,7 +195,7 @@ void Window::RefreshBackground() {
    if (stretch) {
        bitmap->StretchBlit(*windowskin, Rect(0, 0, 32, 32), 255);
    } else {
-       bitmap->TiledBlit(Rect(0, 0, 16, 16), *windowskin, bitmap->GetRect(), 255);
+       bitmap->TiledBlit(Rect(0, 0, 32, 32), *windowskin, bitmap->GetRect(), 255);
    }

    background = bitmap;
diff --git a/src/window_base.cpp b/src/window_base.cpp
index 3acd6e5..aecae8b 100644
--- a/src/window_base.cpp
+++ b/src/window_base.cpp
@@ -40,6 +40,7 @@ Window_Base::Window_Base(int x, int y, int width, int height) {
    SetY(y);
    SetWidth(width);
    SetHeight(height);
+   SetStretch(Game_System::GetMessageStretch());
    SetZ(3000);
 }

@@ -50,6 +51,7 @@ void Window_Base::Update() {
        SetWindowskin(Cache::System(windowskin_name));
        contents->SetTransparentColor(windowskin->GetTransparentColor());
    }
+   SetStretch(Game_System::GetMessageStretch());
 }

 void Window_Base::OnFaceReady(FileRequestResult* result, int face_index, int cx, int cy, bool flip) {

http://p.f4ke.de/k8aclfMq6Y-issue479.webm

@carstene1ns
Member

one small problem: the message window background gets updated immediately (you can see it while closing), in rpg_rt the current window is not changed.

@Ghabry
Member
Ghabry commented Nov 8, 2015

Good patch.
i don't think the too early updating is a big problem, only a very minor visual issue.

@Ghabry
Member
Ghabry commented Dec 17, 2015

The patch does not work correctly. I think the default value of message_stretch is wrong in liblcf. But this needs more time to check for side effects then... (if different value depending on engine e.g.)

@Ghabry Ghabry modified the milestone: 0.4.1, 0.4 Dec 18, 2015
@fdelapena fdelapena closed this in 2546191 Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment