mirror of https://github.com/OpenRCT2/OpenRCT2.git
Pass paint session to sprite_paint_setup
This commit is contained in:
parent
a60a33e665
commit
3b9a86500a
|
@ -660,15 +660,15 @@ void paint_session_generate(paint_session * session)
|
||||||
|
|
||||||
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
||||||
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
sprite_paint_setup(mapTile.x - 32, mapTile.y + 32);
|
sprite_paint_setup(session, mapTile.x - 32, mapTile.y + 32);
|
||||||
|
|
||||||
map_element_paint_setup(session, mapTile.x, mapTile.y + 32);
|
map_element_paint_setup(session, mapTile.x, mapTile.y + 32);
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y + 32);
|
sprite_paint_setup(session, mapTile.x, mapTile.y + 32);
|
||||||
|
|
||||||
mapTile.x += 32;
|
mapTile.x += 32;
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
mapTile.y += 32;
|
mapTile.y += 32;
|
||||||
}
|
}
|
||||||
|
@ -682,15 +682,15 @@ void paint_session_generate(paint_session * session)
|
||||||
|
|
||||||
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
||||||
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
sprite_paint_setup(mapTile.x - 32, mapTile.y - 32);
|
sprite_paint_setup(session, mapTile.x - 32, mapTile.y - 32);
|
||||||
|
|
||||||
map_element_paint_setup(session, mapTile.x - 32, mapTile.y);
|
map_element_paint_setup(session, mapTile.x - 32, mapTile.y);
|
||||||
sprite_paint_setup(mapTile.x - 32, mapTile.y);
|
sprite_paint_setup(session, mapTile.x - 32, mapTile.y);
|
||||||
|
|
||||||
mapTile.y += 32;
|
mapTile.y += 32;
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
mapTile.x -= 32;
|
mapTile.x -= 32;
|
||||||
}
|
}
|
||||||
|
@ -704,16 +704,16 @@ void paint_session_generate(paint_session * session)
|
||||||
|
|
||||||
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
||||||
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
sprite_paint_setup(mapTile.x + 32, mapTile.y - 32);
|
sprite_paint_setup(session, mapTile.x + 32, mapTile.y - 32);
|
||||||
|
|
||||||
map_element_paint_setup(session, mapTile.x, mapTile.y - 32);
|
map_element_paint_setup(session, mapTile.x, mapTile.y - 32);
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y - 32);
|
sprite_paint_setup(session, mapTile.x, mapTile.y - 32);
|
||||||
|
|
||||||
mapTile.x -= 32;
|
mapTile.x -= 32;
|
||||||
|
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
mapTile.y -= 32;
|
mapTile.y -= 32;
|
||||||
}
|
}
|
||||||
|
@ -727,16 +727,16 @@ void paint_session_generate(paint_session * session)
|
||||||
|
|
||||||
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
||||||
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
map_element_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
sprite_paint_setup(mapTile.x + 32, mapTile.y + 32);
|
sprite_paint_setup(session, mapTile.x + 32, mapTile.y + 32);
|
||||||
|
|
||||||
map_element_paint_setup(session, mapTile.x + 32, mapTile.y);
|
map_element_paint_setup(session, mapTile.x + 32, mapTile.y);
|
||||||
sprite_paint_setup(mapTile.x + 32, mapTile.y);
|
sprite_paint_setup(session, mapTile.x + 32, mapTile.y);
|
||||||
|
|
||||||
mapTile.y -= 32;
|
mapTile.y -= 32;
|
||||||
|
|
||||||
sprite_paint_setup(mapTile.x, mapTile.y);
|
sprite_paint_setup(session, mapTile.x, mapTile.y);
|
||||||
|
|
||||||
mapTile.x += 32;
|
mapTile.x += 32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,11 +70,11 @@ static const litter_sprite litter_sprites[] = {
|
||||||
* Litter Paint Setup
|
* Litter Paint Setup
|
||||||
* rct2: 0x006736FC
|
* rct2: 0x006736FC
|
||||||
*/
|
*/
|
||||||
void litter_paint(rct_litter *litter, sint32 imageDirection)
|
void litter_paint(paint_session * session, rct_litter *litter, sint32 imageDirection)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo *dpi;
|
rct_drawpixelinfo *dpi;
|
||||||
|
|
||||||
dpi = gPaintSession.Unk140E9A8;
|
dpi = session->Unk140E9A8;
|
||||||
if (dpi->zoom_level != 0) return; // If zoomed at all no litter drawn
|
if (dpi->zoom_level != 0) return; // If zoomed at all no litter drawn
|
||||||
|
|
||||||
// litter has no sprite direction so remove that
|
// litter has no sprite direction so remove that
|
||||||
|
|
|
@ -37,9 +37,9 @@ extern const uint8 * DuckAnimations[];
|
||||||
/**
|
/**
|
||||||
* rct2: 0x00672AC9
|
* rct2: 0x00672AC9
|
||||||
*/
|
*/
|
||||||
void misc_paint(rct_sprite *misc, sint32 imageDirection)
|
void misc_paint(paint_session * session, rct_sprite *misc, sint32 imageDirection)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo * dpi = gPaintSession.Unk140E9A8;
|
rct_drawpixelinfo * dpi = session->Unk140E9A8;
|
||||||
|
|
||||||
switch (misc->steam_particle.misc_identifier) {
|
switch (misc->steam_particle.misc_identifier) {
|
||||||
case SPRITE_MISC_STEAM_PARTICLE: // 0
|
case SPRITE_MISC_STEAM_PARTICLE: // 0
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
* rct2: 0x0068F0FB
|
* rct2: 0x0068F0FB
|
||||||
*/
|
*/
|
||||||
void peep_paint(rct_peep * peep, sint32 imageDirection)
|
void peep_paint(paint_session * session, rct_peep * peep, sint32 imageDirection)
|
||||||
{
|
{
|
||||||
#ifdef __ENABLE_LIGHTFX__
|
#ifdef __ENABLE_LIGHTFX__
|
||||||
if (gConfigGeneral.enable_light_fx) {
|
if (gConfigGeneral.enable_light_fx) {
|
||||||
|
@ -59,7 +59,7 @@ void peep_paint(rct_peep * peep, sint32 imageDirection)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rct_drawpixelinfo * dpi = gPaintSession.Unk140E9A8;
|
rct_drawpixelinfo * dpi = session->Unk140E9A8;
|
||||||
if (dpi->zoom_level > 2) {
|
if (dpi->zoom_level > 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
* Paint Quadrant
|
* Paint Quadrant
|
||||||
* rct2: 0x0069E8B0
|
* rct2: 0x0069E8B0
|
||||||
*/
|
*/
|
||||||
void sprite_paint_setup(const uint16 eax, const uint16 ecx) {
|
void sprite_paint_setup(paint_session * session, const uint16 eax, const uint16 ecx)
|
||||||
|
{
|
||||||
rct_drawpixelinfo* dpi;
|
rct_drawpixelinfo* dpi;
|
||||||
|
|
||||||
if ((eax & 0xe000) | (ecx & 0xe000)) return;
|
if ((eax & 0xe000) | (ecx & 0xe000)) return;
|
||||||
|
@ -38,7 +39,7 @@ void sprite_paint_setup(const uint16 eax, const uint16 ecx) {
|
||||||
|
|
||||||
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) return;
|
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) return;
|
||||||
|
|
||||||
dpi = gPaintSession.Unk140E9A8;
|
dpi = session->Unk140E9A8;
|
||||||
if (dpi->zoom_level > 2) return;
|
if (dpi->zoom_level > 2) return;
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ void sprite_paint_setup(const uint16 eax, const uint16 ecx) {
|
||||||
// height of the slope element, and consequently clipped.
|
// height of the slope element, and consequently clipped.
|
||||||
if ((gCurrentViewportFlags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) && (spr->unknown.z > (gClipHeight * 8) )) continue;
|
if ((gCurrentViewportFlags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) && (spr->unknown.z > (gClipHeight * 8) )) continue;
|
||||||
|
|
||||||
dpi = gPaintSession.Unk140E9A8;
|
dpi = session->Unk140E9A8;
|
||||||
|
|
||||||
if (dpi->y + dpi->height <= spr->unknown.sprite_top) continue;
|
if (dpi->y + dpi->height <= spr->unknown.sprite_top) continue;
|
||||||
if (spr->unknown.sprite_bottom <= dpi->y)continue;
|
if (spr->unknown.sprite_bottom <= dpi->y)continue;
|
||||||
|
@ -63,23 +64,23 @@ void sprite_paint_setup(const uint16 eax, const uint16 ecx) {
|
||||||
image_direction += spr->unknown.sprite_direction;
|
image_direction += spr->unknown.sprite_direction;
|
||||||
image_direction &= 0x1F;
|
image_direction &= 0x1F;
|
||||||
|
|
||||||
gPaintSession.CurrentlyDrawnItem = spr;
|
session->CurrentlyDrawnItem = spr;
|
||||||
gPaintSession.SpritePosition.x = spr->unknown.x;
|
session->SpritePosition.x = spr->unknown.x;
|
||||||
gPaintSession.SpritePosition.y = spr->unknown.y;
|
session->SpritePosition.y = spr->unknown.y;
|
||||||
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
|
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
|
||||||
|
|
||||||
switch (spr->unknown.sprite_identifier) {
|
switch (spr->unknown.sprite_identifier) {
|
||||||
case SPRITE_IDENTIFIER_VEHICLE:
|
case SPRITE_IDENTIFIER_VEHICLE:
|
||||||
vehicle_paint((rct_vehicle*)spr, image_direction);
|
vehicle_paint(session, (rct_vehicle*)spr, image_direction);
|
||||||
break;
|
break;
|
||||||
case SPRITE_IDENTIFIER_PEEP:
|
case SPRITE_IDENTIFIER_PEEP:
|
||||||
peep_paint((rct_peep*)spr, image_direction);
|
peep_paint(session, (rct_peep*)spr, image_direction);
|
||||||
break;
|
break;
|
||||||
case SPRITE_IDENTIFIER_MISC:
|
case SPRITE_IDENTIFIER_MISC:
|
||||||
misc_paint(spr, image_direction);
|
misc_paint(session, spr, image_direction);
|
||||||
break;
|
break;
|
||||||
case SPRITE_IDENTIFIER_LITTER:
|
case SPRITE_IDENTIFIER_LITTER:
|
||||||
litter_paint((rct_litter*)spr, image_direction);
|
litter_paint(session, (rct_litter*)spr, image_direction);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
|
@ -20,10 +20,12 @@
|
||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
#include "../../world/sprite.h"
|
#include "../../world/sprite.h"
|
||||||
|
|
||||||
void sprite_paint_setup(const uint16 eax, const uint16 ecx);
|
typedef struct paint_session paint_session;
|
||||||
|
|
||||||
void misc_paint(rct_sprite *misc, sint32 imageDirection);
|
void sprite_paint_setup(paint_session * session, const uint16 eax, const uint16 ecx);
|
||||||
void litter_paint(rct_litter *litter, sint32 imageDirection);
|
|
||||||
void peep_paint(rct_peep *peep, sint32 imageDirection);
|
void misc_paint(paint_session * session, rct_sprite *misc, sint32 imageDirection);
|
||||||
|
void litter_paint(paint_session * session, rct_litter *litter, sint32 imageDirection);
|
||||||
|
void peep_paint(paint_session * session, rct_peep *peep, sint32 imageDirection);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2333,7 +2333,7 @@ void vehicle_visual_default(sint32 x, sint32 imageDirection, sint32 y, sint32 z,
|
||||||
*
|
*
|
||||||
* rct2: 0x006D4244
|
* rct2: 0x006D4244
|
||||||
*/
|
*/
|
||||||
void vehicle_paint(rct_vehicle *vehicle, sint32 imageDirection)
|
void vehicle_paint(paint_session * session, rct_vehicle *vehicle, sint32 imageDirection)
|
||||||
{
|
{
|
||||||
rct_ride_entry *rideEntry = 0;
|
rct_ride_entry *rideEntry = 0;
|
||||||
const rct_ride_entry_vehicle *vehicleEntry;
|
const rct_ride_entry_vehicle *vehicleEntry;
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct vehicle_boundbox {
|
||||||
|
|
||||||
extern const vehicle_boundbox VehicleBoundboxes[16][224];
|
extern const vehicle_boundbox VehicleBoundboxes[16][224];
|
||||||
|
|
||||||
void vehicle_paint(rct_vehicle *vehicle, sint32 imageDirection);
|
void vehicle_paint(paint_session * session, rct_vehicle *vehicle, sint32 imageDirection);
|
||||||
|
|
||||||
void vehicle_visual_default(sint32 x, sint32 imageDirection, sint32 y, sint32 z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
|
void vehicle_visual_default(sint32 x, sint32 imageDirection, sint32 y, sint32 z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
|
||||||
void vehicle_visual_roto_drop(sint32 x, sint32 imageDirection, sint32 y, sint32 z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
|
void vehicle_visual_roto_drop(sint32 x, sint32 imageDirection, sint32 y, sint32 z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
|
||||||
|
|
|
@ -1048,6 +1048,6 @@ void vehicle_visual_splash_boats_or_water_coaster(sint32 x, sint32 imageDirectio
|
||||||
imageDirection = ((get_current_rotation() * 8) + vehicle->sprite_direction) & 0x1F;
|
imageDirection = ((get_current_rotation() * 8) + vehicle->sprite_direction) & 0x1F;
|
||||||
gPaintSession.SpritePosition.x = vehicle->x;
|
gPaintSession.SpritePosition.x = vehicle->x;
|
||||||
gPaintSession.SpritePosition.y = vehicle->y;
|
gPaintSession.SpritePosition.y = vehicle->y;
|
||||||
vehicle_paint(vehicle, imageDirection);
|
vehicle_paint(&gPaintSession, vehicle, imageDirection);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue