#
# 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"
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 @@
}
}
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
#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();
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<GameObject*>::iterator i = currentsector->gameobjects.begin(); i != currentsector->gameobjects.end(); ++i) {
++ Player* p = dynamic_cast<Player*>(*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();
}
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()
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 @@
{
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;
}
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);
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) {
}
Index: src/main.cpp
===================================================================
---- src/main.cpp (revision 4856)
+--- src/main.cpp (revision 4870)
+++ src/main.cpp (working copy)
@@ -58,6 +58,7 @@
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;