upright_sprite: Fix texture position for players Fixes #6471
authorSmallJoker <mk939@ymail.com>
Mon, 9 Apr 2018 12:58:35 +0000 (14:58 +0200)
committerSmallJoker <mk939@ymail.com>
Sun, 3 Jun 2018 15:32:00 +0000 (17:32 +0200)
src/content_cao.cpp

index 994f0492acdbeba648d1f5145fe1d6f5bb67ed05..994ff5bb53c6fff0a81177cd9a0cb1d7062d20d5 100644 (file)
@@ -835,6 +835,11 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr,
                                video::S3DVertex( dx,  dy, 0, 0,0,0, c, 0,0),
                                video::S3DVertex(-dx,  dy, 0, 0,0,0, c, 1,0),
                        };
+                       if (m_is_player) {
+                               // Move minimal Y position to 0 (feet position)
+                               for (video::S3DVertex &vertex : vertices)
+                                       vertex.Pos.Y += dy;
+                       }
                        u16 indices[] = {0,1,2,2,3,0};
                        buf->append(vertices, 4, indices, 6);
                        // Set material
@@ -854,6 +859,11 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr,
                                video::S3DVertex(-dx, dy, 0, 0,0,0, c, 0,0),
                                video::S3DVertex( dx, dy, 0, 0,0,0, c, 1,0),
                        };
+                       if (m_is_player) {
+                               // Move minimal Y position to 0 (feet position)
+                               for (video::S3DVertex &vertex : vertices)
+                                       vertex.Pos.Y += dy;
+                       }
                        u16 indices[] = {0,1,2,2,3,0};
                        buf->append(vertices, 4, indices, 6);
                        // Set material