| 1 |
From: Debian Games Team <[email protected]> |
| 2 |
Date: Tue, 24 Nov 2015 17:59:23 +0100 |
| 3 |
Subject: source |
| 4 |
|
| 5 |
--- |
| 6 |
src/config.h.in | 2 +- |
| 7 |
src/eventmanager.cpp | 2 +- |
| 8 |
src/graphic.cpp | 6 +++--- |
| 9 |
src/hash.cpp | 8 ++++---- |
| 10 |
src/image.cpp | 2 +- |
| 11 |
src/level.ll | 28 ++++++++++++++-------------- |
| 12 |
src/list.cpp | 4 ++-- |
| 13 |
src/main.cpp | 6 ++++-- |
| 14 |
src/pipe.cpp | 4 ++-- |
| 15 |
src/pipenightdreams.cpp | 1 + |
| 16 |
src/player.cpp | 8 -------- |
| 17 |
src/player.h | 9 +++++++-- |
| 18 |
src/pointer.cpp | 23 +---------------------- |
| 19 |
src/pointer.h | 26 +++++++++++++++++++++----- |
| 20 |
src/score.cpp | 2 +- |
| 21 |
src/str.cpp | 6 +++--- |
| 22 |
16 files changed, 66 insertions(+), 71 deletions(-) |
| 23 |
|
| 24 |
diff --git a/src/config.h.in b/src/config.h.in |
| 25 |
index 31064ca..60e0680 100644 |
| 26 |
--- a/src/config.h.in |
| 27 |
+++ b/src/config.h.in |
| 28 |
@@ -1,4 +1,4 @@ |
| 29 |
|
| 30 |
+/* src/config.h.in. Generated automatically from configure.in by autoheader 2.13. */ |
| 31 |
|
| 32 |
/* Define if lex declares yytext as a char * by default, not a char[]. */ |
| 33 |
#undef YYTEXT_POINTER |
| 34 |
diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp |
| 35 |
index e31941a..e2e7cd4 100644 |
| 36 |
--- a/src/eventmanager.cpp |
| 37 |
+++ b/src/eventmanager.cpp |
| 38 |
@@ -40,7 +40,7 @@ void EventManager::removeStream(EventStream * s){ |
| 39 |
lista_streams->remove(lista_streams->indexOf(s)); |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
+void EventManager::pumpEvents(bool wait){ |
| 44 |
SDL_Event event; |
| 45 |
Index * stream; |
| 46 |
bool got=false; |
| 47 |
diff --git a/src/graphic.cpp b/src/graphic.cpp |
| 48 |
index 9e0867e..4360c22 100644 |
| 49 |
--- a/src/graphic.cpp |
| 50 |
+++ b/src/graphic.cpp |
| 51 |
@@ -44,11 +44,11 @@ Graphic::~Graphic(){ |
| 52 |
if (pixels) free(pixels); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
+void Graphic::setAlpha(char value){ |
| 57 |
SDL_SetAlpha(surface, SDL_SRCALPHA, value); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
+void Graphic::enableClipping(bool flag){ |
| 62 |
|
| 63 |
if (flag){ |
| 64 |
SDL_Rect rect; |
| 65 |
@@ -68,7 +68,7 @@ void Graphic::setClipping(int x, int y, int width, int height){ |
| 66 |
clip_height=height; |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
+void Graphic::flip(Axis a){ |
| 71 |
if (surface){ |
| 72 |
if (SDL_MUSTLOCK(surface)) |
| 73 |
if (SDL_LockSurface(surface)<0) return; |
| 74 |
diff --git a/src/hash.cpp b/src/hash.cpp |
| 75 |
index a8be35d..3560842 100644 |
| 76 |
--- a/src/hash.cpp |
| 77 |
+++ b/src/hash.cpp |
| 78 |
@@ -55,10 +55,10 @@ int Hash::function(Str * str){ |
| 79 |
return(sum % nbuckets); |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
+Hash::Hash(int bs){ |
| 84 |
int i; |
| 85 |
nbuckets=bs; |
| 86 |
|
| 87 |
+ lbuckets=new List *[nbuckets]; |
| 88 |
|
| 89 |
for (i=0;i<nbuckets;i++) |
| 90 |
lbuckets[i]=new List(); |
| 91 |
@@ -99,7 +99,7 @@ Hash::Result Hash::add(Str * str, Object * obj){ |
| 92 |
return NotAdded; |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
+Hash::Result Hash::remove(Str * str, bool del){ |
| 97 |
if (str){ |
| 98 |
Index * i; |
| 99 |
List * list=lbuckets[function(str)]; |
| 100 |
@@ -135,7 +135,7 @@ Object * Hash::find(Str * str){ |
| 101 |
return NULL; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
+void Hash::empty(bool del){ |
| 106 |
int i; |
| 107 |
List * list; |
| 108 |
for (i=0;i<nbuckets;i++){ |
| 109 |
diff --git a/src/image.cpp b/src/image.cpp |
| 110 |
index b4e6be5..aa4344c 100644 |
| 111 |
--- a/src/image.cpp |
| 112 |
+++ b/src/image.cpp |
| 113 |
@@ -19,7 +19,7 @@ |
| 114 |
#include "SDL_image.h" |
| 115 |
#include <stdio.h> |
| 116 |
|
| 117 |
|
| 118 |
+Image::Image(Str * filename):Graphic(){ |
| 119 |
if (filename) load(filename); |
| 120 |
} |
| 121 |
|
| 122 |
diff --git a/src/level.ll b/src/level.ll |
| 123 |
index 26e7608..9877572 100644 |
| 124 |
--- a/src/level.ll |
| 125 |
+++ b/src/level.ll |
| 126 |
@@ -93,6 +93,20 @@ |
| 127 |
#define INVALID 100 |
| 128 |
|
| 129 |
int nline; |
| 130 |
+ |
| 131 |
+int Level::load(Str * filename){ |
| 132 |
+ YY_FLUSH_BUFFER; |
| 133 |
+ nline=1; |
| 134 |
+ if (!(yyin=fopen(filename->get(), "r"))){ |
| 135 |
+ delete filename; |
| 136 |
+ return 1; |
| 137 |
+ } |
| 138 |
+ delete filename; |
| 139 |
+ level(); |
| 140 |
+ fclose(yyin); |
| 141 |
+ if (error) return -1; |
| 142 |
+ return 0; |
| 143 |
+} |
| 144 |
%} |
| 145 |
|
| 146 |
%option noyywrap |
| 147 |
@@ -599,17 +613,3 @@ void Level::level(){ |
| 148 |
}else printError(new Str("'pipenightdreams' not found")); |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
diff --git a/src/list.cpp b/src/list.cpp |
| 166 |
index 836527e..7d4f5ed 100644 |
| 167 |
--- a/src/list.cpp |
| 168 |
+++ b/src/list.cpp |
| 169 |
@@ -125,7 +125,7 @@ List::Result List::insert(int i, Object * obj){ |
| 170 |
return (insert(indexOf(i), obj)); |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
+List::Result List::remove(Index * index, bool del){ |
| 175 |
if (isEmpty()) return EmptyList; |
| 176 |
if (!index) return NullIndex; |
| 177 |
|
| 178 |
@@ -155,7 +155,7 @@ List::Result List::remove(Index * index, bool del=false){ |
| 179 |
return Removed; |
| 180 |
} |
| 181 |
|
| 182 |
|
| 183 |
+void List::empty(bool del){ |
| 184 |
while (!isEmpty()) |
| 185 |
remove(getFirst(), del); |
| 186 |
} |
| 187 |
diff --git a/src/main.cpp b/src/main.cpp |
| 188 |
index 36adf7a..fca6e76 100644 |
| 189 |
--- a/src/main.cpp |
| 190 |
+++ b/src/main.cpp |
| 191 |
@@ -36,10 +36,12 @@ int main(int argc, char *argv[]) |
| 192 |
if (data_dir) delete data_dir; |
| 193 |
data_dir=new Str(argv[++i]); |
| 194 |
}else |
| 195 |
|
| 196 |
+ if (!strcmp("--level", argv[i])) { |
| 197 |
+ level = atoi(argv[++i]); |
| 198 |
+ } else if (!strcmp("--fullscreen", argv[i])) |
| 199 |
fullscreen=true; |
| 200 |
else{ |
| 201 |
|
| 202 |
+ printf("Invalid Data Dir\nUse pipenightdreams [--datadir <DATA DIR>] [--fullscreen] [--level <level>]\n"); |
| 203 |
printf("Using default: %s\n", GAME_DATADIR); |
| 204 |
} |
| 205 |
i++; |
| 206 |
diff --git a/src/pipe.cpp b/src/pipe.cpp |
| 207 |
index e39d547..cbfaebf 100644 |
| 208 |
--- a/src/pipe.cpp |
| 209 |
+++ b/src/pipe.cpp |
| 210 |
@@ -43,11 +43,11 @@ bool Pipe::isRemovable(){ |
| 211 |
return !(full_level>0) && !fixed; |
| 212 |
} |
| 213 |
|
| 214 |
|
| 215 |
+void Pipe::setFixed(bool flag){ |
| 216 |
fixed=flag; |
| 217 |
} |
| 218 |
|
| 219 |
|
| 220 |
+void Pipe::setBonus(Bonus bonus){ |
| 221 |
this->bonus=bonus; |
| 222 |
} |
| 223 |
|
| 224 |
diff --git a/src/pipenightdreams.cpp b/src/pipenightdreams.cpp |
| 225 |
index 441c517..51e2f4e 100644 |
| 226 |
--- a/src/pipenightdreams.cpp |
| 227 |
+++ b/src/pipenightdreams.cpp |
| 228 |
@@ -99,6 +99,7 @@ void PipeNightDreams::run(){ |
| 229 |
switch (error){ |
| 230 |
case 1:{ |
| 231 |
showFinal(); |
| 232 |
+ game_over=true; |
| 233 |
break; |
| 234 |
} |
| 235 |
case -1:{ |
| 236 |
diff --git a/src/player.cpp b/src/player.cpp |
| 237 |
index 5e923e9..96faa70 100644 |
| 238 |
--- a/src/player.cpp |
| 239 |
+++ b/src/player.cpp |
| 240 |
@@ -163,14 +163,6 @@ void Player::paint(VideoManager * vm){ |
| 241 |
queue->paint(vm); |
| 242 |
} |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
void Player::tick(){ |
| 253 |
score->tick(); |
| 254 |
|
| 255 |
diff --git a/src/player.h b/src/player.h |
| 256 |
index 92bda6d..c17d5ba 100644 |
| 257 |
--- a/src/player.h |
| 258 |
+++ b/src/player.h |
| 259 |
@@ -47,8 +47,13 @@ class Player : protected AnimatedCanvas{ |
| 260 |
void setStartRowColumn(int row, int column); |
| 261 |
void setBoard(Board * bd); |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
+ inline void setRestrictionCoef(unsigned int coef){ |
| 266 |
+ queue->setRestrictionCoef(coef); |
| 267 |
+ } |
| 268 |
+ |
| 269 |
+ inline void setFixedCoef(unsigned int coef){ |
| 270 |
+ queue->setFixedCoef(coef); |
| 271 |
+ } |
| 272 |
|
| 273 |
void incLives(); |
| 274 |
void decLives(); |
| 275 |
diff --git a/src/pointer.cpp b/src/pointer.cpp |
| 276 |
index 8e31394..2d15793 100644 |
| 277 |
--- a/src/pointer.cpp |
| 278 |
+++ b/src/pointer.cpp |
| 279 |
@@ -17,7 +17,7 @@ |
| 280 |
|
| 281 |
#include "pointer.h" |
| 282 |
|
| 283 |
|
| 284 |
+Pointer::Pointer(int row, int column){ |
| 285 |
this->row=row; |
| 286 |
this->column=column; |
| 287 |
this->moved_flag=true; |
| 288 |
@@ -25,27 +25,6 @@ Pointer::Pointer(int row=0, int column=0){ |
| 289 |
|
| 290 |
Pointer::~Pointer(){ delete image_name;} |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
int Pointer::getRow(){ |
| 314 |
return row; |
| 315 |
} |
| 316 |
diff --git a/src/pointer.h b/src/pointer.h |
| 317 |
index be271cb..25ddd50 100644 |
| 318 |
--- a/src/pointer.h |
| 319 |
+++ b/src/pointer.h |
| 320 |
@@ -43,11 +43,27 @@ class Pointer: public Canvas{ |
| 321 |
|
| 322 |
friend class Board; |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
+ inline void setRow(int row){ |
| 330 |
+ this->row=row; |
| 331 |
+ } |
| 332 |
+ |
| 333 |
+ inline void setColumn(int column){ |
| 334 |
+ this->column=column; |
| 335 |
+ } |
| 336 |
+ |
| 337 |
+ inline void setRowColumn(int row, int column){ |
| 338 |
+ this->row=row; |
| 339 |
+ this->column=column; |
| 340 |
+ } |
| 341 |
+ |
| 342 |
+ inline void setMoved(bool flag){ |
| 343 |
+ moved_flag=flag; |
| 344 |
+ } |
| 345 |
+ |
| 346 |
+ inline bool moved(){ |
| 347 |
+ return moved_flag; |
| 348 |
+ } |
| 349 |
+ |
| 350 |
|
| 351 |
Str * image_name; |
| 352 |
Image * ima; |
| 353 |
diff --git a/src/score.cpp b/src/score.cpp |
| 354 |
index 6e2e4b5..7744c16 100644 |
| 355 |
--- a/src/score.cpp |
| 356 |
+++ b/src/score.cpp |
| 357 |
@@ -18,7 +18,7 @@ |
| 358 |
#include "score.h" |
| 359 |
#include <math.h> |
| 360 |
|
| 361 |
|
| 362 |
+Score::Score(int value){ |
| 363 |
this->value=value; |
| 364 |
delta=0; |
| 365 |
changed=true; |
| 366 |
diff --git a/src/str.cpp b/src/str.cpp |
| 367 |
index fca6e6c..f2338ad 100644 |
| 368 |
--- a/src/str.cpp |
| 369 |
+++ b/src/str.cpp |
| 370 |
@@ -11,7 +11,7 @@ |
| 371 |
|
| 372 |
const char Str::nul = '\0'; |
| 373 |
|
| 374 |
|
| 375 |
+Str::Str(const char * string){ |
| 376 |
s=NULL; |
| 377 |
set(string); |
| 378 |
} |
| 379 |
@@ -25,7 +25,7 @@ Str::~Str(){ |
| 380 |
if (s) delete[] s; |
| 381 |
} |
| 382 |
|
| 383 |
|
| 384 |
+void Str::set(const char * string){ |
| 385 |
if (s) delete[] s; |
| 386 |
if (string){ |
| 387 |
s=new char[strlen(string)+1]; |
| 388 |
@@ -71,7 +71,7 @@ int Str::lenght(){ |
| 389 |
return (strlen(s)); |
| 390 |
} |
| 391 |
|
| 392 |
|
| 393 |
+bool Str::isEqual(Str * str, bool case_sensitive){ |
| 394 |
if (case_sensitive){ |
| 395 |
return (!strcmp(s, str->s)); |
| 396 |
} |