[Super-tux-commit] supertux/src badguy.cpp,1.68,1.69 player.cpp,1.90,1.91 special.cpp,1.39,1.40 spri
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-11 22:12:54
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23210/src Modified Files: badguy.cpp player.cpp special.cpp sprite.cpp world.cpp Log Message: Cleanups. Basically I made sprites to care about the scrolling and not the player or badguys or whatever. Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- player.cpp 11 May 2004 18:16:12 -0000 1.90 +++ player.cpp 11 May 2004 22:12:42 -0000 1.91 @@ -551,7 +551,7 @@ { if (dying == DYING_SQUISHED) { - smalltux_gameover->draw(base.x - scroll_x, base.y); + smalltux_gameover->draw(base.x, base.y); } else { @@ -567,46 +567,46 @@ if (duck && size != SMALL) { if (dir == RIGHT) - sprite->duck_right->draw(base.x - scroll_x, base.y); + sprite->duck_right->draw(base.x, base.y); else - sprite->duck_left->draw(base.x - scroll_x, base.y); + sprite->duck_left->draw(base.x, base.y); } else if (skidding_timer.started()) { if (dir == RIGHT) - sprite->skid_right->draw(base.x - scroll_x, base.y); + sprite->skid_right->draw(base.x, base.y); else - sprite->skid_left->draw(base.x - scroll_x, base.y); + sprite->skid_left->draw(base.x, base.y); } else if (kick_timer.started()) { if (dir == RIGHT) - sprite->kick_right->draw(base.x - scroll_x, base.y); + sprite->kick_right->draw(base.x, base.y); else - sprite->kick_left->draw(base.x - scroll_x, base.y); + sprite->kick_left->draw(base.x, base.y); } else if (physic.get_velocity_y() != 0) { if (dir == RIGHT) - sprite->jump_right->draw(base.x - scroll_x, base.y); + sprite->jump_right->draw(base.x, base.y); else - sprite->jump_left->draw(base.x - scroll_x, base.y); + sprite->jump_left->draw(base.x, base.y); } else { if (fabsf(physic.get_velocity_x()) < 1.0f) // standing { if (dir == RIGHT) - sprite->stand_right->draw( base.x - scroll_x, base.y); + sprite->stand_right->draw( base.x, base.y); else - sprite->stand_left->draw( base.x - scroll_x, base.y); + sprite->stand_left->draw( base.x, base.y); } else // moving { if (dir == RIGHT) - sprite->walk_right->draw(base.x - scroll_x, base.y); + sprite->walk_right->draw(base.x, base.y); else - sprite->walk_left->draw(base.x - scroll_x, base.y); + sprite->walk_left->draw(base.x, base.y); } } @@ -614,9 +614,9 @@ if (holding_something && physic.get_velocity_y() == 0) { if (dir == RIGHT) - sprite->grab_right->draw(base.x - scroll_x, base.y); + sprite->grab_right->draw(base.x, base.y); else - sprite->grab_left->draw(base.x - scroll_x, base.y); + sprite->grab_left->draw(base.x, base.y); } // Draw blinking star overlay @@ -624,15 +624,15 @@ (invincible_timer.get_left() > TUX_INVINCIBLE_TIME_WARNING || global_frame_counter % 3)) { if (size == SMALL || duck) - smalltux_star->draw(base.x - scroll_x, base.y); + smalltux_star->draw(base.x, base.y); else - largetux_star->draw(base.x - scroll_x, base.y); + largetux_star->draw(base.x, base.y); } } } if (debug_mode) - fillrect(base.x - scroll_x, base.y, + fillrect(base.x, base.y, base.width, base.height, 75,75,75, 150); } @@ -673,7 +673,7 @@ { pbad_c->dying = DYING_FALLING; play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); - World::current()->add_score(pbad_c->base.x - scroll_x, + World::current()->add_score(pbad_c->base.x, pbad_c->base.y, 25 * player_status.score_multiplier); } Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- sprite.cpp 11 May 2004 21:53:50 -0000 1.7 +++ sprite.cpp 11 May 2004 22:12:42 -0000 1.8 @@ -79,7 +79,7 @@ unsigned int frame = get_current_frame(); if (frame < surfaces.size()) - surfaces[frame]->draw(x - x_hotspot, y - y_hotspot - scroll_y); + surfaces[frame]->draw(x - x_hotspot - scroll_x, y - y_hotspot - scroll_y); } void Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -r1.74 -r1.75 --- world.cpp 11 May 2004 21:53:51 -0000 1.74 +++ world.cpp 11 May 2004 22:12:42 -0000 1.75 @@ -325,7 +325,7 @@ return; } - int tux_pos_x = (int)(tux.base.x + (tux.base.width/2)); + float tux_pos_x = tux.base.x + (tux.base.width/2); if (level->back_scrolling || debug_mode) { @@ -393,7 +393,7 @@ /* Y-axis scrolling */ - int tux_pos_y = (int)(tux.base.y + (tux.base.height/2)); + float tux_pos_y = tux.base.y + (tux.base.height/2); scroll_y = tux_pos_y - (screen->h / 2); @@ -496,7 +496,7 @@ player_status.score += s; FloatingScore* new_floating_score = new FloatingScore(); - new_floating_score->init(x,y,s); + new_floating_score->init(x-scroll_x, y-scroll_y, s); floating_scores.push_back(new_floating_score); } @@ -504,7 +504,7 @@ World::add_bouncy_distro(float x, float y) { BouncyDistro* new_bouncy_distro = new BouncyDistro(); - new_bouncy_distro->init(x,y); + new_bouncy_distro->init(x, y); bouncy_distros.push_back(new_bouncy_distro); } Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- badguy.cpp 8 May 2004 23:46:43 -0000 1.68 +++ badguy.cpp 11 May 2004 22:12:41 -0000 1.69 @@ -746,10 +746,10 @@ } Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right; - sprite->draw(base.x - scroll_x, base.y); + sprite->draw(base.x, base.y); if (debug_mode) - fillrect(base.x - scroll_x, base.y, base.width, base.height, 75,0,75, 150); + fillrect(base.x, base.y, base.width, base.height, 75,0,75, 150); } void @@ -810,7 +810,7 @@ { make_player_jump(player); - World::current()->add_score(base.x - scroll_x, + World::current()->add_score(base.x, base.y, 50 * player_status.score_multiplier); play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); player_status.score_multiplier++; @@ -830,7 +830,7 @@ World::current()->add_bad_guy(base.x, base.y, BAD_BOMB); make_player_jump(player); - World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier); + World::current()->add_score(base.x, base.y, 50 * player_status.score_multiplier); play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); player_status.score_multiplier++; remove_me(); @@ -882,7 +882,7 @@ make_player_jump(player); - World::current()->add_score(base.x - scroll_x, base.y, 25 * player_status.score_multiplier); + World::current()->add_score(base.x, base.y, 25 * player_status.score_multiplier); player_status.score_multiplier++; // simply remove the fish... @@ -922,7 +922,7 @@ physic.enable_gravity(true); /* Gain some points: */ - World::current()->add_score(base.x - scroll_x, base.y, + World::current()->add_score(base.x, base.y, score * player_status.score_multiplier); /* Play death sound: */ Index: special.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- special.cpp 29 Apr 2004 00:15:10 -0000 1.39 +++ special.cpp 11 May 2004 22:12:42 -0000 1.40 @@ -123,7 +123,7 @@ if (base.x >= scroll_x - base.width && base.x <= scroll_x + screen->w) { - img_bullet->draw(base.x - scroll_x, base.y); + img_bullet->draw(base.x, base.y); } } @@ -252,7 +252,7 @@ { /* Rising up... */ - dest.x = (int)(base.x - scroll_x); + dest.x = (int)(base.x); dest.y = (int)(base.y + 32 - base.height); dest.w = 32; dest.h = (int)base.height; @@ -271,21 +271,21 @@ if (kind == UPGRADE_GROWUP) { img_growup->draw( - base.x - scroll_x, base.y); + base.x, base.y); } else if (kind == UPGRADE_ICEFLOWER) { img_iceflower->draw( - base.x - scroll_x, base.y); + base.x, base.y); } else if (kind == UPGRADE_HERRING) { img_star->draw( - base.x - scroll_x, base.y); + base.x, base.y); } else if (kind == UPGRADE_1UP) { - img_1up->draw( base.x - scroll_x, base.y); + img_1up->draw( base.x, base.y); } } } |