# HG changeset patch # User nireco # Date 1228475498 0 # Node ID d5d52fb191e430c18e1c1889c5a720c4b5e0a552 # Parent 501b5a1918b51f6fdc396ea935c27ff5fb609ac4 some minor fixes, shots now explode in collisionpoint diff -r 501b5a1918b5 -r d5d52fb191e4 src/Config.hh --- a/src/Config.hh Fri Dec 05 06:28:25 2008 +0000 +++ b/src/Config.hh Fri Dec 05 11:11:38 2008 +0000 @@ -32,7 +32,7 @@ const float CROSSHAIR_ANGLE_SPEED = PI/40; const float PLAYER_MAX_SPEED = 130; -const float PLAYER_WALK_SPEED = 130; +const float PLAYER_WALK_SPEED = 100; const float PLAYER_COLLISION_ELASTICITY = 0.3; // TODO: This could be // different for different diff -r 501b5a1918b5 -r d5d52fb191e4 src/PhysicsObject.cc --- a/src/PhysicsObject.cc Fri Dec 05 06:28:25 2008 +0000 +++ b/src/PhysicsObject.cc Fri Dec 05 11:11:38 2008 +0000 @@ -203,7 +203,7 @@ if(!possibleLocation(reached)) { - Engine::log(DEBUG, "PhysicsObject.updatePosition") << "logic error reached should not be possible to be impossible.. diffVec: " << diffVec; + Engine::log(DEBUG, "PhysicsObject.updatePosition") << "inside ground. diffVec: " << diffVec; func1(); } @@ -216,18 +216,11 @@ } } else { newPosition = reached; + this->position = newPosition; onCollision(); //TODO: It should be moved before onCollision, for Shots } - if(!possibleLocation(newPosition)) { - Engine::log(DEBUG, "great failure") << "great failure"; - func1(); - } this->position = newPosition; - if(!possibleLocation(position)) { - Engine::log(DEBUG, "great failure") << "great failure"; - func1(); - } // Engine::log(DEBUG, "PhysicsObject.updatePosition") << "Pos: " << this->position; } diff -r 501b5a1918b5 -r d5d52fb191e4 src/Player.cc --- a/src/Player.cc Fri Dec 05 06:28:25 2008 +0000 +++ b/src/Player.cc Fri Dec 05 11:11:38 2008 +0000 @@ -38,13 +38,14 @@ // here should be somehow considered which projectile it is if(!canShoot()) return; - reloadTimer += 0; + reloadTimer += 50; Vector unitVectorAim = facingRight ? Vector(std::cos(aim), -std::sin(aim)) : Vector(-std::cos(aim), -std::sin(aim)); float shotspeed = 100*PHYSICS_TICK_MS/2; Vector shotRelativeVelocity = unitVectorAim * shotspeed; Vector shotVelocity = this->velocity + shotRelativeVelocity; - new Projectile(this->state, this->position, shotVelocity, true, 20); + Vector shotPosition = this->position + unitVectorAim*10; + new Projectile(this->state, shotPosition, shotVelocity, true, 20); } void LocalPlayer::handleMove (PlayerInput_Move input) { diff -r 501b5a1918b5 -r d5d52fb191e4 src/Projectile.cc --- a/src/Projectile.cc Fri Dec 05 06:28:25 2008 +0000 +++ b/src/Projectile.cc Fri Dec 05 11:11:38 2008 +0000 @@ -4,13 +4,14 @@ Projectile::Projectile(GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age) : PhysicsObject(state.world, PLAYER_MASS, position, velocity), state(state), visible(visible), radius(radius), destroyed(false), age(age) { birth_tick = world.tick_timer.get_ticks(); - // Looks kind of dumb, for ammunition to have shape + // Don't think these are needed anymore std::vector shape(4); shape[0] = Vector(-1, -1); shape[1] = Vector(-1, 1); shape[2] = Vector(1, 1); shape[3] = Vector(1, -1); setShape(shape); + target_visible = false; collision_elasticity = 0.9; // = shotType.elasticity world.addProjectile(this); @@ -22,11 +23,11 @@ this->destroyed = true; } -bool Projectile::isDestroyed (void) { +bool Projectile::isDestroyed (void) const { return this->destroyed; } -void Projectile::draw(CL_GraphicContext *gc) { +void Projectile::draw(CL_GraphicContext *gc) const { if (visible) { CL_Quad projectile( diff -r 501b5a1918b5 -r d5d52fb191e4 src/Projectile.hh --- a/src/Projectile.hh Fri Dec 05 06:28:25 2008 +0000 +++ b/src/Projectile.hh Fri Dec 05 11:11:38 2008 +0000 @@ -22,8 +22,8 @@ Projectile(GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age=1000000000); ~Projectile() {}; - bool isDestroyed (void); - virtual void draw(CL_GraphicContext *gc); + bool isDestroyed (void) const; + virtual void draw(CL_GraphicContext *gc) const; private: virtual void onCollision(); };