diff options
author | frosch <frosch@openttd.org> | 2021-02-27 13:56:15 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-27 14:52:11 +0100 |
commit | dfa141818be5c6ac91adaebfd2641f23b3bbbf39 (patch) | |
tree | b832a0133a15648e319e3f552df48919f3df713d /src/video | |
parent | d236c576008da14669c33ba4b628c81e4e486ec1 (diff) | |
download | openttd-dfa141818be5c6ac91adaebfd2641f23b3bbbf39.tar.xz |
Fix: OpenGL cursor did not consider sprite offsets of cursor sprites.
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/opengl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index e466e506d..4d590facc 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -1028,6 +1028,7 @@ void OpenGLBackend::DrawMouseCursor() _cur_dpi = &_screen; for (uint i = 0; i < _cursor.sprite_count; ++i) { SpriteID sprite = _cursor.sprite_seq[i].sprite; + const Sprite *spr = GetSprite(sprite, ST_NORMAL); if (!this->cursor_cache.Contains(sprite)) { Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, ST_NORMAL, &SimpleSpriteAlloc, this)); @@ -1038,7 +1039,10 @@ void OpenGLBackend::DrawMouseCursor() } } - this->RenderOglSprite((OpenGLSprite *)this->cursor_cache.Get(sprite)->data, _cursor.sprite_seq[i].pal, _cursor.pos.x + _cursor.sprite_pos[i].x, _cursor.pos.y + _cursor.sprite_pos[i].y, ZOOM_LVL_GUI); + this->RenderOglSprite((OpenGLSprite *)this->cursor_cache.Get(sprite)->data, _cursor.sprite_seq[i].pal, + _cursor.pos.x + _cursor.sprite_pos[i].x + UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI), + _cursor.pos.y + _cursor.sprite_pos[i].y + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI), + ZOOM_LVL_GUI); } } |