rendered paste bodyIndex: src/direction.hpp
===================================================================
--- src/direction.hpp (revision 5005)
+++ src/direction.hpp (working copy)
@@ -20,6 +20,6 @@
#ifndef SUPERTUX_DIRECTION_H
#define SUPERTUX_DIRECTION_H
-enum Direction { AUTO, LEFT, RIGHT };
+enum Direction { AUTO, LEFT, RIGHT, UP, DOWN };
#endif
Index: src/badguy/mriceblock.cpp
===================================================================
--- src/badguy/mriceblock.cpp (revision 5005)
+++ src/badguy/mriceblock.cpp (working copy)
@@ -138,7 +138,7 @@
return FORCE_MOVE;
// handle kicks from left or right side
- if(ice_state == ICESTATE_FLAT && get_state() == STATE_ACTIVE) {
+ if(ice_state == ICESTATE_FLAT && dir != UP && get_state() == STATE_ACTIVE) {
if(hit.left) {
dir = RIGHT;
player.kick();
@@ -189,12 +189,12 @@
break;
case ICESTATE_FLAT:
{
- MovingObject* movingobject = dynamic_cast<MovingObject*>(&object);
- if (movingobject && (movingobject->get_pos().x < get_pos().x)) {
- dir = RIGHT;
- } else {
- dir = LEFT;
- }
+ MovingObject* movingobject = dynamic_cast<MovingObject*>(&object);
+ if (movingobject && (movingobject->get_pos().x < get_pos().x)) {
+ dir = RIGHT;
+ } else {
+ dir = LEFT;
+ }
}
set_state(ICESTATE_KICKED);
break;
@@ -219,11 +219,16 @@
WalkingBadguy::activate();
break;
case ICESTATE_FLAT:
- sound_manager->play("sounds/stomp.wav", get_pos());
- physic.set_velocity_x(0);
- physic.set_velocity_y(0);
+ if(dir == UP) {
+ physic.set_velocity_y(-KICKSPEED);
+ bbox.set_size(34, 31.8f);
+ } else {
+ sound_manager->play("sounds/stomp.wav", get_pos());
+ physic.set_velocity_x(0);
+ physic.set_velocity_y(0);
- sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
+ sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
+ }
flat_timer.start(4);
break;
case ICESTATE_KICKED:
@@ -257,7 +262,7 @@
MrIceBlock::ungrab(MovingObject& , Direction dir)
{
this->dir = dir;
- set_state(ICESTATE_KICKED);
+ set_state(dir == UP ? ICESTATE_FLAT : ICESTATE_KICKED);
set_group(COLGROUP_MOVING);
}
Index: src/object/rock.cpp
===================================================================
--- src/object/rock.cpp (revision 5005)
+++ src/object/rock.cpp (working copy)
@@ -117,7 +117,9 @@
{
set_group(COLGROUP_MOVING_STATIC);
on_ground = false;
- if (last_movement.norm() > 1) {
+ if(dir == UP) {
+ physic.set_velocity(0, -750);
+ } else if (last_movement.norm() > 1) {
physic.set_velocity((dir == RIGHT) ? 200 : -200, -200);
} else {
physic.set_velocity(0, 0);
Index: src/object/block.cpp
===================================================================
--- src/object/block.cpp (revision 5005)
+++ src/object/block.cpp (working copy)
@@ -32,6 +32,7 @@
#include "video/drawing_context.hpp"
#include "lisp/lisp.hpp"
#include "gameobjs.hpp"
+#include "portable.hpp"
#include "specialriser.hpp"
#include "growup.hpp"
#include "flower.hpp"
@@ -73,7 +74,8 @@
}
}
- if(bouncing) {
+ Portable* portable = dynamic_cast<Portable*> (&other);
+ if(bouncing && (portable == 0 || portable->is_portable())) {
BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
if(badguy) {
badguy->kill_fall();
@@ -223,6 +225,13 @@
try_open();
}
}
+ Portable* portable = dynamic_cast<Portable*> (&other);
+ if(portable) {
+ MovingObject* moving = dynamic_cast<MovingObject*> (&other);
+ if(moving->get_bbox().get_top() > get_bbox().get_bottom() - 7.0) {
+ try_open();
+ }
+ }
return Block::collision(other, hit);
}
@@ -344,6 +353,13 @@
try_break(false);
}
}
+ Portable* portable = dynamic_cast<Portable*> (&other);
+ if(portable) {
+ MovingObject* moving = dynamic_cast<MovingObject*> (&other);
+ if(moving->get_bbox().get_top() > get_bbox().get_bottom() - 7.0) {
+ try_break();
+ }
+ }
return Block::collision(other, hit);
}
Index: src/object/player.cpp
===================================================================
--- src/object/player.cpp (revision 5005)
+++ src/object/player.cpp (working copy)
@@ -627,12 +627,24 @@
if( controller->released( Controller::PEEK_RIGHT ) ) {
peeking = AUTO;
}
+ if( controller->released( Controller::UP ) ) {
+ peeking = AUTO;
+ }
+ if( controller->released( Controller::DOWN ) ) {
+ peeking = AUTO;
+ }
if( controller->pressed( Controller::PEEK_LEFT ) ) {
peeking = LEFT;
}
if( controller->pressed( Controller::PEEK_RIGHT ) ) {
peeking = RIGHT;
}
+ if( controller->pressed( Controller::UP ) ) {
+ peeking = UP;
+ }
+ if( controller->pressed( Controller::DOWN ) ) {
+ peeking = DOWN;
+ }
/* Handle horizontal movement: */
if (!backflipping) handle_horizontal_input();
@@ -674,9 +686,13 @@
if(moving_object) {
moving_object->set_pos(pos);
} else {
- log_debug << "Non MovingObjetc grabbed?!?" << std::endl;
+ log_debug << "Non MovingObject grabbed?!?" << std::endl;
}
- grabbed_object->ungrab(*this, dir);
+ if(controller->hold(Controller::UP)) {
+ grabbed_object->ungrab(*this, UP);
+ } else {
+ grabbed_object->ungrab(*this, dir);
+ }
grabbed_object = NULL;
}
}