95 |
LEVELFINISHED, // level finished; proceed to next one |
LEVELFINISHED, // level finished; proceed to next one |
96 |
PLAYERDEAD, // player is dead; restart level shortly |
PLAYERDEAD, // player is dead; restart level shortly |
97 |
NOMORELIVES, // no player has any lives left, restart |
NOMORELIVES, // no player has any lives left, restart |
98 |
RESTARTGAME, // restart the current (new lives) |
STARTGAME, // start the current level (when called from level menu) |
99 |
|
RESTARTGAME, // restart the current level (new lives) |
100 |
RELOADLEVEL, // reload current level (resets objects) |
RELOADLEVEL, // reload current level (resets objects) |
101 |
LEVELINFO, // display level info |
LEVELINFO, // display level info |
102 |
ABORT // quit the game immediately |
ABORT // quit the game immediately |
335 |
{ |
{ |
336 |
current_state_dtime += dtime; |
current_state_dtime += dtime; |
337 |
switch (state) { |
switch (state) { |
338 |
|
case STARTGAME: |
339 |
case RESTARTGAME: |
case RESTARTGAME: |
340 |
player::NewGame(2); // two virtual players |
player::NewGame(2); // two virtual players |
341 |
change_state(load_level(icurrent_level) ? LEVELINIT : ABORT); |
change_state(load_level(icurrent_level) |
342 |
|
? (state == STARTGAME ? LEVELINFO : LEVELINIT) |
343 |
|
: ABORT); |
344 |
break; |
break; |
345 |
|
|
346 |
case PLAYERDEAD: |
case PLAYERDEAD: |
374 |
break; |
break; |
375 |
|
|
376 |
case LEVELINFO: { |
case LEVELINFO: { |
377 |
// TODO: show level information (name, author, etc.) |
// show level information (name, author, etc.) |
378 |
|
LevelInfo *info = level_pack->get_info(icurrent_level); |
379 |
|
int len = info->name.length()+6+info->author.length()+1; |
380 |
|
char *buf = new char[len]; |
381 |
|
|
382 |
|
if (info->author.empty()) sprintf(buf, "\"%s\"", info->name.c_str()); |
383 |
|
else sprintf(buf, "\"%s\" by %s", info->name.c_str(), info->author.c_str()); |
384 |
|
|
385 |
|
display::GetStatusBar()->show_text(buf); |
386 |
|
free(buf); |
387 |
|
|
388 |
change_state(LEVELINIT); |
change_state(LEVELINIT); |
389 |
break; |
break; |
498 |
|
|
499 |
double dtime=0; |
double dtime=0; |
500 |
|
|
501 |
state = RESTARTGAME; |
state = STARTGAME; |
502 |
|
// state = RESTARTGAME; |
503 |
while (state != ABORT) |
while (state != ABORT) |
504 |
{ |
{ |
505 |
last_tick_time=SDL_GetTicks(); |
last_tick_time=SDL_GetTicks(); |
627 |
change_state(RELOADLEVEL); |
change_state(RELOADLEVEL); |
628 |
break; |
break; |
629 |
|
|
630 |
|
case SDLK_F4: |
631 |
|
advance_level(); |
632 |
|
break; |
633 |
|
|
634 |
case SDLK_F5: |
case SDLK_F5: |
635 |
{ |
{ |
636 |
bool oldSkip = options::SkipSolvedLevels; |
bool oldSkip = options::SkipSolvedLevels; |
691 |
"Escape:", "Show game menu", |
"Escape:", "Show game menu", |
692 |
"F1:", "Show this help", |
"F1:", "Show this help", |
693 |
"F3:", "Kill current marble", |
"F3:", "Kill current marble", |
694 |
|
"F4:", "Skip to next level", |
695 |
"F5:", "Skip to next unsolved level", |
"F5:", "Skip to next unsolved level", |
696 |
"F10:", "Make screenshot", |
"F10:", "Make screenshot", |
697 |
"Left arrow:", "Decrease mouse speed", |
"Left arrow:", "Decrease mouse speed", |