# HG changeset patch # User nireco # Date 1227877911 0 # Node ID 0d36aade845e0705bb18ce0013cd84060705afd0 # Parent 237ea0bb125aeca57f32a58ccba424f98005080e some stuff, don't remember what diff -r 237ea0bb125a -r 0d36aade845e src/proto2/GameState.cc --- a/src/proto2/GameState.cc Fri Nov 28 13:00:24 2008 +0000 +++ b/src/proto2/GameState.cc Fri Nov 28 13:11:51 2008 +0000 @@ -36,3 +36,7 @@ void Player::debugInfo (void) { Engine::log(DEBUG, "Player.debugInfo") << "In air: " << this->inAir; } + +void Shot::onCollision() { +// world.removeGround(position, 20); +} diff -r 237ea0bb125a -r 0d36aade845e src/proto2/GameState.hh --- a/src/proto2/GameState.hh Fri Nov 28 13:00:24 2008 +0000 +++ b/src/proto2/GameState.hh Fri Nov 28 13:11:51 2008 +0000 @@ -55,6 +55,21 @@ }; +class Shot : public PhysicsObject { +protected: + GameState &state; + bool visible; + uint32_t birth_tick; + uint32_t death_tick; +public: + Shot(GameState &state, Vector position, bool visible) : + PhysicsObject((PhysicsWorld &) state, PLAYER_MASS, position, Vector(0, 0)), state(state), visible(visible) { + + } +private: + virtual void onCollision(); +}; + class LocalPlayer : public Player { protected: LocalPlayer (GameState &state, Vector pos, bool visible) : Player(state, pos, visible) { } diff -r 237ea0bb125a -r 0d36aade845e src/proto2/Graphics.cc --- a/src/proto2/Graphics.cc Fri Nov 28 13:00:24 2008 +0000 +++ b/src/proto2/Graphics.cc Fri Nov 28 13:11:51 2008 +0000 @@ -72,7 +72,10 @@ if (keyboard.get_keycode(CL_KEY_I)) player->debugInfo(); - + + if (keyboard.get_keycode(CL_KEY_M)) + input_move |= INPUT_MOVE_DIG; + // apply movement if applicable if (input_move) player->handleMove(input_move); diff -r 237ea0bb125a -r 0d36aade845e src/proto2/Input.hh --- a/src/proto2/Input.hh Fri Nov 28 13:00:24 2008 +0000 +++ b/src/proto2/Input.hh Fri Nov 28 13:11:51 2008 +0000 @@ -12,6 +12,7 @@ INPUT_MOVE_RIGHT = 0x0008, INPUT_MOVE_JUMP = 0x0010, + INPUT_MOVE_DIG = 0x0020, }; typedef uint16_t PlayerInput_Move; diff -r 237ea0bb125a -r 0d36aade845e src/proto2/Physics.cc --- a/src/proto2/Physics.cc Fri Nov 28 13:00:24 2008 +0000 +++ b/src/proto2/Physics.cc Fri Nov 28 13:11:51 2008 +0000 @@ -78,7 +78,7 @@ // We can start a free fall now // // TODO it should be set inAir if it falls from a cliff - //this->inAir = true; + this->inAir = true; // Put some speed there to make loke smoother //this->velocity.y = -5; @@ -234,6 +234,7 @@ } } else { newPosition = reached; + onCollision(); //this->velocity = Vector(0, 0); //TODO: it shouldn't just stop on collision } diff -r 237ea0bb125a -r 0d36aade845e src/proto2/Physics.hh --- a/src/proto2/Physics.hh Fri Nov 28 13:00:24 2008 +0000 +++ b/src/proto2/Physics.hh Fri Nov 28 13:11:51 2008 +0000 @@ -143,6 +143,8 @@ Derivative evaluate(Force force, TimeMS dt, Derivative &d); Vector acceleration(const Force &force); + virtual void onCollision() {} + public: Vector getPosition (void); std::vector& getShape(void);