Skip to content

Commit 95f3932

Browse files
committed
Fix issues introduced in SuperTux#1922
1 parent 5e50a35 commit 95f3932

File tree

7 files changed

+21
-3
lines changed

7 files changed

+21
-3
lines changed

src/badguy/badguy.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ BadGuy::collision_solid(const CollisionHit& hit)
397397
void
398398
BadGuy::on_flip(float height)
399399
{
400+
MovingObject::on_flip(height);
400401
Vector pos = get_start_position();
401402
pos.y = height - pos.y;
402403
set_start_position(pos);

src/object/block.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ void Block::after_editor_set()
234234
void
235235
Block::on_flip(float height)
236236
{
237+
MovingObject::on_flip(height);
237238
if (m_original_y != -1) m_original_y = height - m_original_y - get_bbox().get_height();
238239
}
239240

src/object/decal.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Decal::fade_sprite(const std::string& new_sprite, float fade_time)
106106
void
107107
Decal::on_flip(float height)
108108
{
109+
MovingObject::on_flip(height);
109110
FlipLevelTransformer::transform_flip(m_flip);
110111
}
111112

src/object/flower.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Flower::collision(GameObject& other, const CollisionHit& )
8787
void
8888
Flower::on_flip(float height)
8989
{
90+
MovingObject::on_flip(height);
9091
FlipLevelTransformer::transform_flip(flip);
9192
}
9293

src/object/platform.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ Platform::editor_update()
149149
void
150150
Platform::on_flip(float height)
151151
{
152+
MovingObject::on_flip(height);
152153
if (Path* path = get_path()) {
153154
FlipLevelTransformer::transform_path(height, get_bbox().get_height(), *path);
154155
}

src/trigger/door.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "supertux/game_session.hpp"
2525
#include "supertux/screen_manager.hpp"
2626
#include "supertux/sector.hpp"
27+
#include "supertux/flip_level_transformer.hpp"
2728
#include "util/reader_mapping.hpp"
2829

2930
Door::Door(const ReaderMapping& mapping) :
@@ -33,7 +34,8 @@ Door::Door(const ReaderMapping& mapping) :
3334
target_spawnpoint(),
3435
script(),
3536
sprite(SpriteManager::current()->create("images/objects/door/door.sprite")),
36-
stay_open_timer()
37+
stay_open_timer(),
38+
m_flip(NO_FLIP)
3739
{
3840
mapping.get("x", m_col.m_bbox.get_left());
3941
mapping.get("y", m_col.m_bbox.get_top());
@@ -55,7 +57,8 @@ Door::Door(int x, int y, const std::string& sector, const std::string& spawnpoin
5557
target_spawnpoint(spawnpoint),
5658
script(),
5759
sprite(SpriteManager::current()->create("images/objects/door/door.sprite")),
58-
stay_open_timer()
60+
stay_open_timer(),
61+
m_flip(NO_FLIP)
5962
{
6063
m_col.m_bbox.set_pos(Vector(static_cast<float>(x), static_cast<float>(y)));
6164

@@ -117,7 +120,7 @@ Door::update(float )
117120
void
118121
Door::draw(DrawingContext& context)
119122
{
120-
sprite->draw(context.color(), m_col.m_bbox.p1(), LAYER_BACKGROUNDTILES+1);
123+
sprite->draw(context.color(), m_col.m_bbox.p1(), LAYER_BACKGROUNDTILES+1, m_flip);
121124
}
122125

123126
void
@@ -179,4 +182,11 @@ Door::collision(GameObject& other, const CollisionHit& hit_)
179182
return TriggerBase::collision(other, hit_);
180183
}
181184

185+
void
186+
Door::on_flip(float height)
187+
{
188+
MovingObject::on_flip(height);
189+
FlipLevelTransformer::transform_flip(m_flip);
190+
}
191+
182192
/* EOF */

src/trigger/door.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "supertux/timer.hpp"
2121
#include "trigger/trigger_base.hpp"
22+
#include "video/flip.hpp"
2223

2324
class Player;
2425
class ReaderMapping;
@@ -39,6 +40,7 @@ class Door final : public TriggerBase
3940
virtual void draw(DrawingContext& context) override;
4041
virtual void event(Player& player, EventType type) override;
4142
virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
43+
virtual void on_flip(float height) override;
4244

4345
private:
4446
enum DoorState {
@@ -55,6 +57,7 @@ class Door final : public TriggerBase
5557
std::string script;
5658
SpritePtr sprite; /**< "door" sprite to render */
5759
Timer stay_open_timer; /**< time until door will close again */
60+
Flip m_flip;
5861

5962
private:
6063
Door(const Door&) = delete;

0 commit comments

Comments
 (0)