From: Christoph Sommer Date: Thu, 22 Feb 2007 22:00:01 +0000 (+0000) Subject: Infinite play and different color for Penny X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=66f485649459f148ea8663ee285691d21349f7d4;p=supertux.git Infinite play and different color for Penny SVN-Revision: 4871 --- diff --git a/contrib/supertux-coop.diff b/contrib/supertux-coop.diff index e3a58efda..016ce3d8f 100644 --- a/contrib/supertux-coop.diff +++ b/contrib/supertux-coop.diff @@ -29,12 +29,12 @@ # # patch -p0 < contrib/supertux-coop.diff # -# This patch works for revision 4866. It may break for later revisions. +# This patch works for revision 4870. It may break for later revisions. # # ----------------------------------------------------------------------------- Index: src/control/joystickkeyboardcontroller.cpp =================================================================== ---- src/control/joystickkeyboardcontroller.cpp (revision 4856) +--- src/control/joystickkeyboardcontroller.cpp (revision 4870) +++ src/control/joystickkeyboardcontroller.cpp (working copy) @@ -29,6 +29,7 @@ #include "game_session.hpp" @@ -80,7 +80,7 @@ Index: src/control/joystickkeyboardcontroller.cpp Control control = key_mapping->second; Index: src/options_menu.cpp =================================================================== ---- src/options_menu.cpp (revision 4856) +--- src/options_menu.cpp (revision 4870) +++ src/options_menu.cpp (working copy) @@ -58,6 +58,8 @@ } @@ -93,7 +93,7 @@ Index: src/options_menu.cpp } Index: src/main.hpp =================================================================== ---- src/main.hpp (revision 4856) +--- src/main.hpp (revision 4870) +++ src/main.hpp (working copy) @@ -31,5 +31,6 @@ // global variables @@ -104,9 +104,9 @@ Index: src/main.hpp #endif Index: src/game_session.cpp =================================================================== ---- src/game_session.cpp (revision 4856) +--- src/game_session.cpp (revision 4870) +++ src/game_session.cpp (working copy) -@@ -117,6 +117,7 @@ +@@ -118,6 +118,7 @@ end_sequence = 0; main_controller->reset(); @@ -114,7 +114,30 @@ Index: src/game_session.cpp currentsector = 0; -@@ -542,9 +543,11 @@ +@@ -448,6 +449,22 @@ + process_events(); + process_menu(); + ++ // two-player hack: resurrect Penny when she dies ++ Player* tux = currentsector->player; ++ for(std::vector::iterator i = currentsector->gameobjects.begin(); i != currentsector->gameobjects.end(); ++i) { ++ Player* p = dynamic_cast(*i); ++ if (!p) continue; ++ if (p == tux) continue; ++ if (p->is_dead()) { ++ p->remove_me(); ++ static PlayerStatus* ps = new PlayerStatus(); ++ p = new Player(ps, "Penny"); ++ currentsector->add_object(p); ++ p->move(tux->get_pos()); ++ p->safe_timer.start(TUX_SAFE_TIME); ++ } ++ } ++ + check_end_conditions(); + + // respawning in new sector? +@@ -543,9 +560,11 @@ // TODO make a screen out of this, another mainloop is ugly main_controller->update(); @@ -128,7 +151,7 @@ Index: src/game_session.cpp } Index: src/mainloop.cpp =================================================================== ---- src/mainloop.cpp (revision 4856) +--- src/mainloop.cpp (revision 4870) +++ src/mainloop.cpp (working copy) @@ -166,9 +166,11 @@ MainLoop::process_events() @@ -144,7 +167,7 @@ Index: src/mainloop.cpp if(event.type == SDL_QUIT) Index: src/object/player.cpp =================================================================== ---- src/object/player.cpp (revision 4856) +--- src/object/player.cpp (revision 4870) +++ src/object/player.cpp (working copy) @@ -116,6 +116,7 @@ { @@ -154,17 +177,28 @@ Index: src/object/player.cpp smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite"); smalltux_star = sprite_manager->create("images/creatures/tux_small/smalltux-star.sprite"); bigtux_star = sprite_manager->create("images/creatures/tux_big/bigtux-star.sprite"); -@@ -875,6 +876,9 @@ +@@ -875,6 +876,20 @@ int layer = LAYER_OBJECTS + 1; -+ // draw second player behind main player -+ if (name == "Penny") layer -= 20; ++ // two-player hack: draw Penny in a different color ++ if (name == "Penny") { ++ layer -= 20; ++ if(tux_body->head) tux_body->head->set_color(Color(1.0f, 1.0f, 0.5f, 1.0f)); ++ if(tux_body->body) tux_body->body->set_color(Color(1.0f, 1.0f, 0.5f, 1.0f)); ++ if(tux_body->arms) tux_body->arms->set_color(Color(1.0f, 1.0f, 0.5f, 1.0f)); ++ if(tux_body->feet) tux_body->feet->set_color(Color(1.0f, 1.0f, 0.5f, 1.0f)); ++ } else { ++ if(tux_body->head) tux_body->head->set_color(Color(1.0f, 1.0f, 1.0f, 1.0f)); ++ if(tux_body->body) tux_body->body->set_color(Color(1.0f, 1.0f, 1.0f, 1.0f)); ++ if(tux_body->arms) tux_body->arms->set_color(Color(1.0f, 1.0f, 1.0f, 1.0f)); ++ if(tux_body->feet) tux_body->feet->set_color(Color(1.0f, 1.0f, 1.0f, 1.0f)); ++ } + /* Set Tux sprite action */ if (climbing) { -@@ -1049,6 +1053,12 @@ +@@ -1049,6 +1064,12 @@ return FORCE_MOVE; } @@ -177,7 +211,7 @@ Index: src/object/player.cpp if(hit.left || hit.right) { try_grab(); //grab objects right now, in update it will be too late } -@@ -1141,6 +1151,8 @@ +@@ -1141,6 +1162,8 @@ dying_timer.start(3.0); set_group(COLGROUP_DISABLED); @@ -188,7 +222,7 @@ Index: src/object/player.cpp Sector::current()->add_object(effect); Index: src/gameconfig.cpp =================================================================== ---- src/gameconfig.cpp (revision 4856) +--- src/gameconfig.cpp (revision 4870) +++ src/gameconfig.cpp (working copy) @@ -86,6 +86,10 @@ if(config_control_lisp && main_controller) { @@ -215,7 +249,7 @@ Index: src/gameconfig.cpp } Index: src/main.cpp =================================================================== ---- src/main.cpp (revision 4856) +--- src/main.cpp (revision 4870) +++ src/main.cpp (working copy) @@ -58,6 +58,7 @@ @@ -245,7 +279,7 @@ Index: src/main.cpp Scripting::exit_squirrel(); Index: src/sector.cpp =================================================================== ---- src/sector.cpp (revision 4856) +--- src/sector.cpp (revision 4870) +++ src/sector.cpp (working copy) @@ -74,11 +74,21 @@ bool Sector::show_collrects = false;