diff --git a/descriptor/reader/factory_reader.cc b/descriptor/reader/factory_reader.cc index 8526535d1..a17d56b15 100644 --- a/descriptor/reader/factory_reader.cc +++ b/descriptor/reader/factory_reader.cc @@ -286,7 +286,7 @@ obj_desc_t *factory_reader_t::read_node(FILE *fp, obj_node_info_t &node) typedef factory_desc_t::site_t site_t; if(version == 5) { - // Versioned node, version 4 with sound and animation + // Versioned node, version 5 with smoke, sound and animation desc->placement = (site_t)decode_uint16(p); desc->productivity = decode_uint16(p); desc->range = decode_uint16(p); diff --git a/descriptor/writer/factory_writer.cc b/descriptor/writer/factory_writer.cc index f8a0ec969..51f45118f 100644 --- a/descriptor/writer/factory_writer.cc +++ b/descriptor/writer/factory_writer.cc @@ -288,7 +288,7 @@ void factory_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj if( !*obj.get( str_smokeoffset ) ) { dbg->error( "factory_writer_t::write_obj", "%s defined but not %s!", str_smoketile, str_smokeoffset ); } - pos_off[ i ] = obj.get_koord( str_smoketile, koord( 0, 0 ) ); + xy_off[ i ] = obj.get_koord( str_smokeoffset, koord( 0, 0 ) ); num_smoke_offsets++; } } @@ -331,7 +331,7 @@ void factory_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj node.write_sint16(fp, smokeuplift, 76); node.write_sint16(fp, smokelifetime, 78); - // this should ne always at the end + // this should be always at the end sint8 sound_str_len = sound_str.size(); if (sound_str_len > 0) { node.write_sint8 (fp, sound_str_len, 79); diff --git a/obj/wolke.cc b/obj/wolke.cc index 96bad5456..66038d40c 100644 --- a/obj/wolke.cc +++ b/obj/wolke.cc @@ -62,7 +62,7 @@ wolke_t::wolke_t(koord3d pos, sint8 b_x_off, sint16 b_y_off, uint16 lt, uint16 u wolke_t::~wolke_t() { - mark_image_dirty( get_image(), 0 ); + mark_image_dirty( get_image(), calc_yoff() ); if( insta_zeit != lifetime ) { welt->sync_way_eyecandy.remove( this ); } @@ -82,6 +82,11 @@ image_id wolke_t::get_front_image() const } +sint16 wolke_t::calc_yoff() const +{ + return (base_y_off - (((long)insta_zeit * uplift * OBJECT_OFFSET_STEPS) >> 16)); +} + void wolke_t::rdwr(loadsave_t *file) { @@ -109,23 +114,26 @@ sync_result wolke_t::sync_step(uint32 delta_t) { // we query the image twice, since it may have changed (there are sure more efficient ways for that ... const image_id old_img = get_front_image(); - const sint16 old_yoff = base_y_off - (((long)insta_zeit * uplift * OBJECT_OFFSET_STEPS) >> 16); + const sint16 old_yoff = calc_yoff(); insta_zeit += delta_t; if( insta_zeit >= lifetime ) { // delete wolke ... + set_flag( obj_t::dirty ); + mark_image_dirty( old_img, old_yoff ); insta_zeit = lifetime; return SYNC_DELETE; } const image_id new_img = get_front_image(); // move cloud up - const sint16 new_yoff = base_y_off - (((long)insta_zeit * uplift * OBJECT_OFFSET_STEPS) >> 16); + const sint16 new_yoff = calc_yoff(); if( new_img != old_img ) { - // move/change cloud ... (happens much more often than image change => image change will be always done when drawing) + // change cloud set_flag( obj_t::dirty ); mark_image_dirty( old_img, old_yoff ); } if( new_yoff != old_yoff ) { + // move cloud set_flag( obj_t::dirty ); } return SYNC_OK; @@ -138,7 +146,7 @@ void wolke_t::display_after( int xpos, int ypos, const sint8 extra_param ) const void wolke_t::display_after( int xpos, int ypos, bool extra_param ) const #endif { - sint16 extra_offset = tile_raster_scale_y( base_y_off - (((long)insta_zeit * uplift * OBJECT_OFFSET_STEPS) >> 16), get_current_tile_raster_width() ); + sint16 extra_offset = tile_raster_scale_y( calc_yoff(), get_current_tile_raster_width() ); obj_t::display_after( xpos, ypos + extra_offset, extra_param ); } @@ -147,11 +155,18 @@ void wolke_t::display_after( int xpos, int ypos, bool extra_param ) const // called during map rotation void wolke_t::rotate90() { - // most basic: rotate coordinate - obj_t::rotate90(); if( lifetime != DEFAULT_EXHAUSTSMOKE_TIME ) { // since factory smoke comes from wrong tile, remove them on rotation insta_zeit = lifetime; + } else { + // only for vehicles + // rotate the base_y_off + set_yoff( base_y_off ); + // most basic: rotate coordinate + obj_t::rotate90(); + // restore y_off + base_y_off = get_yoff(); + set_yoff( -8 ); } } diff --git a/obj/wolke.h b/obj/wolke.h index 982d8d8b6..364327e48 100644 --- a/obj/wolke.h +++ b/obj/wolke.h @@ -29,6 +29,8 @@ private: uint16 uplift; uint8 cloud_nr; + sint16 calc_yoff() const; // calculate the smoke height using uplift and insta_zeit + public: static bool register_desc(const skin_desc_t *desc); diff --git a/simutrans/history.txt b/simutrans/history.txt index de687d921..6515beb2b 100644 --- a/simutrans/history.txt +++ b/simutrans/history.txt @@ -6,7 +6,7 @@ ADD: Vehicle list as dialog tool 33 (to see also upcoming vehicles) ADD: goods waiting bar with now configurable: gui_waitingbar_width ADD: button to copy the last 20 messages to the clipboard - CHG: factory smake location now depend on factory. Four parameters smoketile[], smokeoffset[] (koord), and smokeuplift (16) and smokelifetime (2499) + CHG: factory smoke location now depend on factory. Four parameters smoketile[], smokeoffset[] (koord), and smokeuplift (16) and smokelifetime (2499) FIX: several list stored wrong coordinates after map rotation Release of 121.0 (r8870 on 1-Dec-2019):