[Super-tux-commit] supertux/src gameobjs.cpp,1.58,1.59 gameobjs.h,1.41,1.42 player.cpp,1.198,1.199 p
Brought to you by:
wkendrick
From: Matze B. <mat...@us...> - 2004-11-22 21:35:33
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29683/src Modified Files: gameobjs.cpp gameobjs.h player.cpp player.h sector.cpp sector.h tilemap.cpp Log Message: fix tux jumping always full height Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- player.h 20 Nov 2004 22:38:35 -0000 1.93 +++ player.h 22 Nov 2004 21:35:04 -0000 1.94 @@ -156,8 +156,6 @@ bool falling_from_flap; bool enable_hover; bool butt_jump; - int frame_; - int frame_main; float flapping_velocity; @@ -171,7 +169,6 @@ Timer2 invincible_timer; Timer2 skidding_timer; Timer2 safe_timer; - Timer2 frame_timer; Timer2 kick_timer; Timer2 shooting_timer; // used to show the arm when Tux is shooting Timer2 dying_timer; Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- sector.h 20 Nov 2004 22:38:35 -0000 1.22 +++ sector.h 22 Nov 2004 21:35:04 -0000 1.23 @@ -106,9 +106,6 @@ bool add_bullet(const Vector& pos, float xm, Direction dir); bool add_smoke_cloud(const Vector& pos); - bool add_particles(const Vector& epicenter, int min_angle, int max_angle, - const Vector& initial_velocity, const Vector& acceleration, int number, - Color color, int size, int life_time, int drawing_layer); void add_floating_text(const Vector& pos, const std::string& text); /** Flip the all the sector vertically. The purpose of this is to let Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- sector.cpp 20 Nov 2004 22:38:35 -0000 1.38 +++ sector.cpp 22 Nov 2004 21:35:04 -0000 1.39 @@ -791,13 +791,6 @@ return true; } -bool -Sector::add_particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color, int size, int life_time, int drawing_layer) -{ - add_object(new Particles(epicenter, min_angle, max_angle, initial_velocity, acceleration, number, color, size, life_time, drawing_layer)); - return true; -} - void Sector::add_floating_text(const Vector& pos, const std::string& text) { Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- gameobjs.cpp 20 Nov 2004 22:14:38 -0000 1.58 +++ gameobjs.cpp 22 Nov 2004 21:35:04 -0000 1.59 @@ -452,7 +452,9 @@ img_smoke_cloud->draw(context, position, LAYER_OBJECTS+1); } -Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color_, int size_, int life_time, int drawing_layer_) +Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, + const Vector& initial_velocity, const Vector& acceleration, int number, + Color color_, int size_, float life_time, int drawing_layer_) : accel(acceleration), color(color_), size(size_), drawing_layer(drawing_layer_) { if(life_time == 0) { Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.198 retrieving revision 1.199 diff -u -d -r1.198 -r1.199 --- player.cpp 22 Nov 2004 17:51:50 -0000 1.198 +++ player.cpp 22 Nov 2004 21:35:04 -0000 1.199 @@ -175,13 +175,8 @@ on_ground_flag = false; - frame_main = 0; - frame_ = 0; - player_input_init(&input); - frame_timer.start(.025, true); - physic.reset(); } @@ -363,12 +358,13 @@ skidding_timer.start(SKID_TIME); SoundManager::get()->play_sound(IDToSound(SND_SKID)); // dust some partcles - Sector::current()->add_particles( - Vector(bbox.p1.x + (dir == RIGHT ? bbox.get_width() : 0), + Sector::current()->add_object( + new Particles( + Vector(bbox.p1.x + (dir == RIGHT ? bbox.get_width() : 0), bbox.p2.y), dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20, - Vector(280,-260), Vector(0,0.030), 3, Color(100,100,100), 3, 800, - LAYER_OBJECTS+1); + Vector(280,-260), Vector(0,0.030), 3, Color(100,100,100), 3, .8, + LAYER_OBJECTS+1)); ax *= 2.5; } @@ -423,6 +419,17 @@ fall_mode = JUMPING; } + if(on_ground()) { /* Make sure jumping is off. */ + jumping = false; + flapping = false; + falling_from_flap = false; + if (flapping_timer.started()) { + flapping_timer.start(0); + } + + physic.set_acceleration_y(0); //for flapping + } + // Press jump key if(input.jump == DOWN && can_jump && on_ground()) { @@ -456,7 +463,6 @@ } if (jumping && physic.get_velocity_y() > 0) { - printf("jumpend.\n"); jumping = false; physic.set_velocity_y(0); } @@ -638,18 +644,6 @@ } #endif - if(on_ground()) /* Make sure jumping is off. */ - { - jumping = false; - flapping = false; - falling_from_flap = false; - if (flapping_timer.started()) { - flapping_timer.start(0); - } - - physic.set_acceleration_y(0); //for flapping - } - input.old_jump = input.jump; } @@ -673,28 +667,6 @@ input.old_fire = DOWN; } -#if 0 - /* tux animations: */ - if(frame_timer.check()) { - if (input.right == UP && input.left == UP) - { - frame_main = 1; - frame_ = 1; - } - else - { - if ((input.fire == DOWN && (global_frame_counter % 2) == 0) || - (global_frame_counter % 4) == 0) - frame_main = (frame_main + 1) % 4; - - frame_ = frame_main; - - if (frame_ == 3) - frame_ = 1; - } - } -#endif - /* Duck! */ if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0 && on_ground()) @@ -930,122 +902,6 @@ return FORCE_MOVE; } -#if 0 -void -Player::collision(void* p_c_object, int c_object) -{ - //BadGuy* pbad_c = NULL; - //Trampoline* ptramp_c = NULL; - //FlyingPlatform* pplatform_c = NULL; - - switch (c_object) - { - case CO_BADGUY: - pbad_c = (BadGuy*) p_c_object; - - /* Hurt player if he touches a badguy */ - if (!pbad_c->dying && !dying && - !safe_timer.started() && - pbad_c->mode != BadGuy::HELD) - { - if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN - && !holding_something) - { - holding_something = true; - pbad_c->mode = BadGuy::HELD; - pbad_c->base.y-=8; - } - else if (pbad_c->mode == BadGuy::FLAT) - { - // Don't get hurt if we're kicking a flat badguy! - } - else if (pbad_c->mode == BadGuy::KICK) - { - /* Hurt if you get hit by kicked laptop: */ - if (!invincible_timer.started()) - { - kill(SHRINK); - } - else - pbad_c->kill_me(20); - } - else if (!pbad_c->frozen_timer.check() && (pbad_c->kind == BAD_MRBOMB - || pbad_c->kind == BAD_JUMPY || pbad_c->kind == BAD_FISH - || pbad_c->kind == BAD_SPIKY)) - pbad_c->kill_me(20); - else - { - if (!invincible_timer.started()) - { - kill(SHRINK); - } - else - { - pbad_c->kill_me(25); - } - } - player_status.score_multiplier++; - } - break; - - case CO_TRAMPOLINE: - ptramp_c = (Trampoline*) p_c_object; - - // Pick up trampoline - if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something && on_ground()) - { - holding_something = true; - ptramp_c->mode = Trampoline::M_HELD; - ptramp_c->base.y -= 8; - } - // Set down trampoline - else if (ptramp_c->mode == Trampoline::M_HELD && input.fire != DOWN) - { - holding_something = false; - ptramp_c->mode = Trampoline::M_NORMAL; - ptramp_c->base.y += 8; - ptramp_c->physic.set_velocity(physic.get_velocity_x(), physic.get_velocity_y()); - - //if (dir == RIGHT) - // ptramp_c->base.x = base.x + base.width+1; - //else /* LEFT */ - // ptramp_c->base.x = base.x - base.width-1; - } -/* - // Don't let tux walk through trampoline - else if (ptramp_c->mode != Trampoline::M_HELD && on_ground()) - { - if (physic.get_velocity_x() > 0) // RIGHT - { - physic.set_velocity_x(0); - base.x = ptramp_c->base.x - base.width; - } - else if (physic.get_velocity_x() < 0) // LEFT - { - physic.set_velocity_x(0); - base.x = ptramp_c->base.x + ptramp_c->base.width; - } - } -*/ - break; - case CO_FLYING_PLATFORM: - pplatform_c = (FlyingPlatform*) p_c_object; - - base.y = pplatform_c->base.y - base.height; - physic.set_velocity_x(pplatform_c->get_vel_x()); - - physic.enable_gravity(false); - can_jump = true; - fall_mode = ON_GROUND; - break; - - default: - break; - } - -} -#endif - void Player::make_invincible() { Index: tilemap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tilemap.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- tilemap.cpp 20 Nov 2004 22:14:39 -0000 1.21 +++ tilemap.cpp 22 Nov 2004 21:35:04 -0000 1.22 @@ -231,7 +231,7 @@ { if(x < 0 || x >= width || y < 0 || y >= height) { #ifdef DEBUG - std::cout << "Warning: tile outside tilemap requested!\n"; + //std::cout << "Warning: tile outside tilemap requested!\n"; #endif return tilemanager->get(0); } Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- gameobjs.h 20 Nov 2004 22:14:38 -0000 1.41 +++ gameobjs.h 22 Nov 2004 21:35:04 -0000 1.42 @@ -130,7 +130,7 @@ public: Particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, - int number, Color color, int size, int life_time, int drawing_layer); + int number, Color color, int size, float life_time, int drawing_layer); ~Particles(); virtual void action(float elapsed_time); |