upright_sprite: Fix texture position for players
authorSmallJoker <mk939@ymail.com>
Mon, 9 Apr 2018 12:58:35 +0000 (14:58 +0200)
committerSmallJoker <mk939@ymail.com>
Mon, 9 Apr 2018 13:06:40 +0000 (15:06 +0200)
Fixes #6471

src/content_cao.cpp

index 64109375147add73ac2862ad53c2060186e5de6e..4dde1b0985465db8a9a706f6b7520aaaa2520d1d 100644 (file)
@@ -516,6 +516,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
                                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
@@ -535,6 +540,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
                                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