Package: blocks-of-the-undead / 1.0-7

02_accept_mousepress_as_anykey.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Description: a mousepress is also an anykey
 When the use is asked to "press any key", accept a mousepress to,
 so the user does not have touse the keyboard in a mouse-driven game.
Forwarded: no
Author: Evgeni Golov <evgeni@debian.org>
Last-Update: 2008-10-26

Index: blocks-of-the-undead-1.0/TetrisAttack/src/CTetrisGame.cpp
===================================================================
--- blocks-of-the-undead-1.0.orig/TetrisAttack/src/CTetrisGame.cpp	2012-05-01 20:13:20.321936666 +0200
+++ blocks-of-the-undead-1.0/TetrisAttack/src/CTetrisGame.cpp	2012-05-01 20:13:26.317980862 +0200
@@ -363,42 +363,7 @@
 		
 		case Splash:
 		{
-			state = SinglePlayerPuzzle;
-			int a = 1, b = 1;
-			
-                        string file;
-#if defined(WIN32) || defined(_WIN32)
-                        file = CImgLoader::getPath() + "/progress.txt";
-#else
-                        char *homedir = getenv("HOME");
-                        if (homedir != NULL)
-                        {
-                            file = string(homedir) + "/.blocks-progress";
-                        }
-                        else
-                        {
-                            file = "blocks-progress";
-                        }
-#endif
-
-			ifstream data( file.c_str() );
-			if (data)
-			{
-				data >> a;
-				data >> b;
-			}
-
-			if (a != 1)
-			{
-				CTetrisTheme* tmptheme = new CTetrisTheme( stringify(a) );
-				CVector pos = fields[0]->getPos();
-				delete fields[0];
-				fields.clear();
-				fields.push_back(new CPlayingField(pos, *(tmptheme->getBlockSet()), tmptheme, 100) );
-				delete theme;
-				theme = tmptheme;
-			}
-			fields[0]->load(a,b);
+			startGame();
 		}break;
 
 		default:
@@ -440,12 +405,68 @@
 		case SinglePlayerPuzzle:
 		case SinglePlayer:
 		{
+			if (fields[0]->isGameOver())
+			{
+				fields[0]->reLoadLevel();
+				break;
+			}
+
 			int x, y;
 			bool cords;
 			/*if ( (cords = fields[0]->boardCords(mouseloc, x, y)) && (fields[0]->blockExists(x, y) || fields[0]->blockExists(x+1, y)))
 			{*/
 				fields[0]->swap();
 			//}
-		}
+		} break;
+
+		case Loading:
+		{
+			state = SinglePlayerPuzzle;
+		} break;
+
+		case Splash:
+		{
+			startGame();
+		}break;
 	}
 }
+
+void CTetrisGame::startGame()
+{
+			state = SinglePlayerPuzzle;
+			int a = 1, b = 1;
+
+                        string file;
+#if defined(WIN32) || defined(_WIN32)
+                        file = CImgLoader::getPath() + "/progress.txt";
+#else
+                        char *homedir = getenv("HOME");
+                        if (homedir != NULL)
+                        {
+                            file = string(homedir) + "/.blocks-progress";
+                        }
+                        else
+                        {
+                            file = "blocks-progress";
+                        }
+#endif
+
+			ifstream data( file.c_str() );
+			if (data)
+			{
+				data >> a;
+				data >> b;
+			}
+
+			if (a != 1)
+			{
+				CTetrisTheme* tmptheme = new CTetrisTheme( stringify(a) );
+				CVector pos = fields[0]->getPos();
+				delete fields[0];
+				fields.clear();
+				fields.push_back(new CPlayingField(pos, *(tmptheme->getBlockSet()), tmptheme, 100) );
+				delete theme;
+				theme = tmptheme;
+			}
+			fields[0]->load(a,b);
+}
Index: blocks-of-the-undead-1.0/TetrisAttack/src/CTetrisGame.h
===================================================================
--- blocks-of-the-undead-1.0.orig/TetrisAttack/src/CTetrisGame.h	2005-01-17 05:49:02.000000000 +0100
+++ blocks-of-the-undead-1.0/TetrisAttack/src/CTetrisGame.h	2012-05-01 20:13:26.317980862 +0200
@@ -37,6 +37,7 @@
 	void handleKeypress(const SDL_KeyboardEvent &e);
 	void handleMouseMotion(const SDL_MouseMotionEvent &e);
 	void handleMouseButton(const SDL_MouseButtonEvent &e);
+	void startGame();
 
 	vector<CPlayingField*> fields;
 	list<CSprite*> sprites;