Пример #1
0
/** rct2: 0x00768A3B */
static void paint_space_rings_structure(rct_ride * ride, uint8 direction,  uint32 segment, sint32 height)
{
    rct_map_element * savedMapElement = g_currently_drawn_item;

    uint32 vehicleIndex = (segment - direction) & 0x3;

    if (ride->num_stations == 0 || vehicleIndex < ride->num_vehicles) {
        rct_ride_entry * ride_type = get_ride_entry(ride->subtype);
        rct_vehicle * vehicle = NULL;

        sint32 frameNum = direction;

        uint32 baseImageId = ride_type->vehicles[0].base_image_id;

        if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK
            && ride->vehicles[0] != SPRITE_INDEX_NULL) {
            gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
            vehicle = GET_VEHICLE(ride->vehicles[vehicleIndex]);
            g_currently_drawn_item = vehicle;
            frameNum += (sint8) vehicle->vehicle_sprite_type * 4;
        }

        uint32 imageColourFlags = gTrackColours[SCHEME_MISC];
        if ((ride->colour_scheme_type & 3) != RIDE_COLOUR_SCHEME_DIFFERENT_PER_TRAIN) {
            vehicleIndex = 0;
        }

        if (imageColourFlags == IMAGE_TYPE_REMAP) {
            imageColourFlags = SPRITE_ID_PALETTE_COLOUR_2(ride->vehicle_colours[vehicleIndex].body_colour, ride->vehicle_colours[0].trim_colour);
        }

        uint32 imageId = (baseImageId + frameNum) | imageColourFlags;
        sub_98197C(imageId, 0, 0, 20, 20, 23, height, -10, -10, height, get_current_rotation());

        if (vehicle != NULL && vehicle->num_peeps > 0) {
            rct_peep * rider = GET_PEEP(vehicle->peep[0]);
            imageColourFlags = SPRITE_ID_PALETTE_COLOUR_2(rider->tshirt_colour, rider->trousers_colour);
            imageId = ((baseImageId & 0x7FFFF) + 352 + frameNum) | imageColourFlags;
            sub_98199C(imageId, 0, 0, 20, 20, 23, height, -10, -10, height, get_current_rotation());
        }
    }

    g_currently_drawn_item = savedMapElement;
    gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
}
Пример #2
0
static void paint_magic_carpet_vehicle(rct_ride *ride, uint8 direction, uint32 swingImageId,
                                       rct_xyz16 offset, rct_xyz16 bbOffset, rct_xyz16 bbSize)
{
    rct_ride_entry *rideEntry = get_ride_entry_by_ride(ride);
    uint32 vehicleImageId = rideEntry->vehicles[0].base_image_id + direction;

    // Vehicle
    uint32 imageColourFlags = gTrackColours[SCHEME_MISC];
    if (imageColourFlags == IMAGE_TYPE_REMAP)
    {
        imageColourFlags = SPRITE_ID_PALETTE_COLOUR_2(ride->vehicle_colours[0].body_colour, ride->vehicle_colours[0].trim_colour);
    }

    sint8 directionalOffset = MagicCarpetOscillationXY[swingImageId];
    switch (direction) {
    case 0: offset.x -= directionalOffset; break;
    case 1: offset.y += directionalOffset; break;
    case 2: offset.x += directionalOffset; break;
    case 3: offset.y -= directionalOffset; break;
    }
    offset.z += MagicCarpetOscillationZ[swingImageId];

    sub_98199C(vehicleImageId | imageColourFlags, (sint8)offset.x, (sint8)offset.y, bbSize.x, bbSize.y, 127, offset.z, bbOffset.x, bbOffset.y, bbOffset.z, get_current_rotation());

    // Riders
    rct_drawpixelinfo *dpi = unk_140E9A8;
    if (dpi->zoom_level <= 1 && (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) {
        rct_vehicle *vehicle = get_first_vehicle(ride);
        if (vehicle != NULL) {
            uint32 baseImageId = IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS | (vehicleImageId + 4);
            for (uint8 peepIndex = 0; peepIndex < vehicle->num_peeps; peepIndex += 2) {
                uint32 imageId = baseImageId + (peepIndex * 2);
                imageId |= (vehicle->peep_tshirt_colours[peepIndex + 0] << 19);
                imageId |= (vehicle->peep_tshirt_colours[peepIndex + 1] << 24);
                sub_98199C(imageId, (sint8)offset.x, (sint8)offset.y, bbSize.x, bbSize.y, 127, offset.z, bbOffset.x, bbOffset.y, bbOffset.z, get_current_rotation());
            }
        }
    }
}
Пример #3
0
/**
 *
 *  rct2: 0x0076750D
 */
static void top_spin_paint_vehicle(
    paint_session *          session,
    sint8                    al,
    sint8                    cl,
    uint8                    rideIndex,
    uint8                    direction,
    sint32                   height,
    const rct_tile_element * tileElement)
{
    uint16 boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ;
    // As we will be drawing a vehicle we need to backup the tileElement that
    // is assigned to the drawings.
    const rct_tile_element * curTileElement = static_cast<const rct_tile_element *>(session->CurrentlyDrawnItem);

    height += 3;

    Ride *           ride      = get_ride(rideIndex);
    rct_ride_entry * rideEntry = get_ride_entry(ride->subtype);
    rct_vehicle *    vehicle   = nullptr;

    uint8 seatRotation = 0;
    sint8 armRotation  = 0;

    if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride->vehicles[0] != SPRITE_INDEX_NULL)
    {
        vehicle = GET_VEHICLE(ride->vehicles[0]);

        session->InteractionType    = VIEWPORT_INTERACTION_ITEM_SPRITE;
        session->CurrentlyDrawnItem = vehicle;

        armRotation  = vehicle->vehicle_sprite_type;
        seatRotation = vehicle->bank_rotation;
    }

    boundBoxOffsetX = al + 16;
    boundBoxOffsetY = cl + 16;
    boundBoxOffsetZ = height;

    // di
    uint8 lengthX = 24;
    // si
    uint8 lengthY = 24;

    uint32 image_id = session->TrackColours[SCHEME_MISC];
    if (image_id == IMAGE_TYPE_REMAP)
    {
        image_id = SPRITE_ID_PALETTE_COLOUR_2(ride->track_colour_main[0], ride->track_colour_supports[0]);
    }

    image_id += (direction & 1) << 1;
    image_id += rideEntry->vehicles[0].base_image_id;
    // Left back bottom support
    image_id += 572;
    sub_98197C(session, image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ);

    image_id = session->TrackColours[SCHEME_MISC];
    if (image_id == IMAGE_TYPE_REMAP)
    {
        image_id = SPRITE_ID_PALETTE_COLOUR_2(ride->track_colour_main[0], ride->track_colour_additional[0]);
    }

    sint32 var_1F = armRotation;
    if (direction & 2)
    {
        var_1F = -var_1F;
        if (var_1F != 0)
            var_1F += 48;
    }
    image_id += var_1F;
    image_id += (direction & 1) * 48;
    image_id += rideEntry->vehicles[0].base_image_id;
    // Left hand arm
    image_id += 380;

    sub_98199C(session, image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ);

    uint32 seatImageId;

    if (vehicle != nullptr && vehicle->restraints_position >= 64)
    {
        // Open Restraints
        image_id = (vehicle->restraints_position - 64) >> 6;
        image_id += direction * 3;
        image_id += rideEntry->vehicles[0].base_image_id;
        image_id += 64;
        seatImageId = image_id;
    }
Пример #4
0
/**
 *
 *  rct2: 0x006D5B48
 */
void vehicle_visual_virginia_reel(paint_session * session, sint32 x, sint32 imageDirection, sint32 y, sint32 z,
                                  rct_vehicle * vehicle, const rct_ride_entry_vehicle * vehicleEntry)
{
    sint32      image_id;
    sint32      baseImage_id = imageDirection;
    const uint8 rotation     = session->CurrentRotation;
    sint32      ecx          = ((vehicle->spin_sprite / 8) + (rotation * 8)) & 31;
    sint32      j            = 0;
    if (vehicle->vehicle_sprite_type == 0)
    {
        baseImage_id = ecx & 7;
    }
    else
    {
        if (vehicle->vehicle_sprite_type == 1 || vehicle->vehicle_sprite_type == 5)
        {
            if (vehicle->vehicle_sprite_type == 5)
            {
                baseImage_id = imageDirection ^ 16;
            }
            baseImage_id &= 24;
            j = (baseImage_id / 8) + 1;
            baseImage_id += (ecx & 7);
            baseImage_id += 8;
        }
        else if (vehicle->vehicle_sprite_type == 2 || vehicle->vehicle_sprite_type == 6)
        {
            if (vehicle->vehicle_sprite_type == 6)
            {
                baseImage_id = imageDirection ^ 16;
            }
            baseImage_id &= 24;
            j = (baseImage_id / 8) + 5;
            baseImage_id += (ecx & 7);
            baseImage_id += 40;
        }
        else
        {
            baseImage_id = ecx & 7;
        }
    }
    baseImage_id += vehicleEntry->base_image_id;

    const vehicle_boundbox * bb = &_virginiaReelBoundbox[j];
    image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour);
    sub_98197C(
        session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z);

    if (session->Unk140E9A8->zoom_level < 2 && vehicle->num_peeps > 0)
    {
        uint8 riding_peep_sprites[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
        for (sint32 i = 0; i < vehicle->num_peeps; i++)
        {
            riding_peep_sprites[((ecx / 8) + i) & 3] = vehicle->peep_tshirt_colours[i];
        }
        sint32 draw_order[4] = { 0, 1, 3, 2 };
        for (auto i : draw_order)
        {
            if (riding_peep_sprites[i] != 0xFF)
            {
                image_id = (baseImage_id + ((i + 1) * 72)) |
                           SPRITE_ID_PALETTE_COLOUR_1(riding_peep_sprites[i]);
                sub_98199C(
                    session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y,
                    bb->offset_z + z);
            }
        }
    }

    assert(vehicleEntry->effect_visual == 1);
}
Пример #5
0
/**
 *
 *  rct2: 0x006DFF47
 */
void scenery_paint(uint8 direction, sint32 height, rct_map_element* mapElement) {
    //RCT2_CALLPROC_X(0x6DFF47, 0, 0, direction, height, (sint32)mapElement, 0, 0); return;
    gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_SCENERY;
    rct_xyz16 boxlength;
    rct_xyz16 boxoffset;
    boxoffset.x = 0;
    boxoffset.y = 0;
    boxoffset.z = height;
    sint32 baseImageid = 0;
    const sint32 rotation = get_current_rotation();
    if (gTrackDesignSaveMode) {
        if (!track_design_save_contains_map_element(mapElement)) {
            baseImageid = 0x21700000;
        }
    }
    if (mapElement->flags & MAP_ELEMENT_FLAG_GHOST) {
        gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
        baseImageid = construction_markers[gConfigGeneral.construction_marker_colour];
    }
    uint32 dword_F64EB0 = baseImageid;

    rct_scenery_entry *entry = get_small_scenery_entry(mapElement->properties.scenery.type);
    baseImageid = entry->image + direction;
    boxlength.x = 2;
    boxlength.y = 2;
    sint8 x_offset = 0;
    sint8 y_offset = 0;
    if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) {
        if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HALF_SPACE) {
            // 6DFFE3:
            boxoffset.x = offsets[direction].x;
            boxoffset.y = offsets[direction].y;
            boxlength.x = lengths[direction].x;
            boxlength.y = lengths[direction].y;
            x_offset = 3;
            y_offset = 3;
        } else {
            x_offset = 15;
            y_offset = 15;
            if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) {
                x_offset = 3;
                y_offset = 3;
                boxlength.x = 26;
                boxlength.y = 26;
                if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS) {
                    x_offset = 1;
                    y_offset = 1;
                    boxlength.x = 30;
                    boxlength.y = 30;
                }
            }
            boxoffset.x = x_offset;
            boxoffset.y = y_offset;
        }
    } else {
        // 6DFFC2:
        uint8 ecx = (map_element_get_scenery_quadrant(mapElement) + rotation) & 3;
        x_offset = ScenerySubTileOffsets[ecx].x;
        y_offset = ScenerySubTileOffsets[ecx].y;
        boxoffset.x = x_offset;
        boxoffset.y = y_offset;
    }
    // 6E007F:
    boxlength.z = entry->small_scenery.height - 4;
    if (boxlength.z > 128 || boxlength.z < 0) {
        boxlength.z = 128;
    }
    if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_WITHER) {
        if (mapElement->properties.scenery.age >= 40) {
            baseImageid += 4;
        }
        if (mapElement->properties.scenery.age >= 55) {
            baseImageid += 4;
        }
    }
    if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
    {
        if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)
        {
            baseImageid |= SPRITE_ID_PALETTE_COLOUR_2(scenery_small_get_primary_colour(mapElement),
                                                      scenery_small_get_secondary_colour(mapElement));
        }
        else
        {
            baseImageid |= SPRITE_ID_PALETTE_COLOUR_1(scenery_small_get_primary_colour(mapElement));
        }
    }
    if (dword_F64EB0 != 0) {
        baseImageid = (baseImageid & 0x7FFFF) | dword_F64EB0;
    }
    if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)) {
        sub_98197C(baseImageid, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
    }

    if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_GLASS) {
        if (dword_F64EB0 == 0) {
            // Draw translucent overlay:
            // TODO: Name palette entries
            sint32 image_id = (baseImageid & 0x7FFFF) + (GlassPaletteIds[scenery_small_get_primary_colour(mapElement)] << 19) + 0x40000004;
            sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
        }
    }

    if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED) {
        rct_drawpixelinfo* dpi = unk_140E9A8;
        if ( (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED) || (dpi->zoom_level <= 1) ) {
            // 6E01A9:
            if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1) {
                // 6E0512:
                sint32 image_id = ((gCurrentTicks / 2) & 0xF) + entry->image + 4;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
            } else
            if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4) {
                // 6E043B:
                sint32 image_id = ((gCurrentTicks / 2) & 0xF) + entry->image + 8;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);

                image_id = direction + entry->image + 4;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);

                image_id = ((gCurrentTicks / 2) & 0xF) + entry->image + 24;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
            } else
            if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_IS_CLOCK) {
                // 6E035C:
                sint32 minuteImageOffset = ((gRealTimeOfDay.minute + 6) * 17) / 256;
                sint32 timeImageBase = gRealTimeOfDay.hour;
                while (timeImageBase >= 12) {
                    timeImageBase -= 12;
                }
                timeImageBase = (timeImageBase * 4) + minuteImageOffset;
                if (timeImageBase >= 48) {
                    timeImageBase -= 48;
                }
                sint32 image_id = timeImageBase + (direction * 12);
                if (image_id >= 48) {
                    image_id -= 48;
                }

                image_id = image_id + entry->image + 68;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);

                image_id = gRealTimeOfDay.minute + (direction * 15);
                if (image_id >= 60) {
                    image_id -= 60;
                }
                image_id = image_id + entry->image + 8;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
            } else
            if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_SWAMP_GOO) {
                // 6E02F6:
                sint32 image_id = gCurrentTicks;
                image_id += gUnk9DE568 / 4;
                image_id += gUnk9DE56C / 4;
                image_id = (image_id / 4) & 15;
                image_id += entry->image;
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
            }
            else if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS)
            {
                sint32 frame = gCurrentTicks;
                if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_COG)) {
                    // 6E01F8:
                    frame += ((gUnk9DE568 / 4) + (gUnk9DE56C / 4));
                    frame += (mapElement->type & 0xC0) / 16;
                }
                // 6E0222:
                uint16 delay = entry->small_scenery.animation_delay & 0xFF;
                frame >>= delay;
                frame &= entry->small_scenery.animation_mask;
                sint32 image_id = 0;
                if (frame < entry->small_scenery.num_frames) {
                    image_id = entry->small_scenery.frame_offsets[frame];
                }
                image_id = (image_id * 4) + direction + entry->image;
                if (entry->small_scenery.flags & (SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED | SMALL_SCENERY_FLAG17)) {
                    image_id += 4;
                }
                if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
                {
                    if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) {
                        image_id |= SPRITE_ID_PALETTE_COLOUR_2(scenery_small_get_primary_colour(mapElement),
                                                               scenery_small_get_secondary_colour(mapElement));
                    }
                    else
                    {
                        image_id |= SPRITE_ID_PALETTE_COLOUR_1(scenery_small_get_primary_colour(mapElement));
                    }
                }
                if (dword_F64EB0 != 0) {
                    image_id = (image_id & 0x7FFFF) | dword_F64EB0;
                }
                if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED) {
                    sub_98197C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
                }
                else {
                    sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
                }
            }
        }