From ebcbb085d2a6f2aaeab5bc3fe3cee5cadaa210a0 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 2 Jul 2016 12:06:29 +0100 Subject: [PATCH] add ride previews --- src/object/RideObject.cpp | 14 ++++++++++++++ src/object/RideObject.h | 2 ++ src/windows/editor_object_selection.c | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/object/RideObject.cpp b/src/object/RideObject.cpp index 482f66d2d2..e665026388 100644 --- a/src/object/RideObject.cpp +++ b/src/object/RideObject.cpp @@ -327,6 +327,20 @@ void RideObject::Unload() gfx_object_free_images(_legacyType.images_offset, GetImageTable()->GetCount()); } +void RideObject::DrawPreview(rct_drawpixelinfo * dpi) const +{ + uint32 imageId = _legacyType.images_offset; + if (_legacyType.ride_type[0] == 0xFF) + { + imageId++; + if (_legacyType.ride_type[1] == 0xFF) + { + imageId++; + } + } + gfx_draw_sprite(dpi, imageId, 0, 0, 0); +} + const utf8 * RideObject::GetName() const { const utf8 * name = GetStringTable()->GetString(OBJ_STRING_ID_NAME); diff --git a/src/object/RideObject.h b/src/object/RideObject.h index 982907de96..d3f7383229 100644 --- a/src/object/RideObject.h +++ b/src/object/RideObject.h @@ -40,6 +40,8 @@ public: void Load() override; void Unload() override; + void DrawPreview(rct_drawpixelinfo * dpi) const; + const utf8 * GetName() const override; const utf8 * GetDescription() const; const utf8 * GetCapacity() const; diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 9c41226321..03392287fb 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -1335,8 +1335,8 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf widget = &w->widgets[WIDX_PREVIEW]; { rct_drawpixelinfo clipDPI; - x = w->x + widget->left; - y = w->y + widget->top; + x = w->x + widget->left + 1; + y = w->y + widget->top + 1; int width = widget->right - widget->left; int height = widget->bottom - widget->top; if (clip_drawpixelinfo(&clipDPI, dpi, x, y, width, height)) { @@ -1949,7 +1949,7 @@ static bool filter_chunks(const ObjectRepositoryItem * item) break; } } - if (_filter_flags & (1 << (gRideCategories[get_ride_type_string_id(item)] + 5))) + if (_filter_flags & (1 << (gRideCategories[rideType] + 5))) return true; } return false;