void error_resize(t_env* env) { id_print_str("\033[00;40m"); tputs(env->cl, 1, id_put); id_print_str("Desoler mais cet application ne gere pas les resize\n"); id_print_str("Appuyer sur la barre d espace pour relancer une partie\n"); restart_level(env); }
void GameSession::check_end_conditions() { Player* tux = world->get_tux(); /* End of level? */ int endpos = (World::current()->get_level()->width-5) * 32; Tile* endtile = collision_goal(tux->base); // fallback in case the other endpositions don't trigger if (!end_sequence && tux->base.x >= endpos) { end_sequence = ENDSEQUENCE_WAITING; last_x_pos = -1; music_manager->play_music(level_end_song, 0); endsequence_timer.start(7000); tux->invincible_timer.start(7000); //FIXME: Implement a winning timer for the end sequence (with special winning animation etc.) } else if(end_sequence && !endsequence_timer.check()) { exit_status = ES_LEVEL_FINISHED; return; } else if(end_sequence == ENDSEQUENCE_RUNNING && endtile && endtile->data >= 1) { end_sequence = ENDSEQUENCE_WAITING; } else if(!end_sequence && endtile && endtile->data == 0) { end_sequence = ENDSEQUENCE_RUNNING; last_x_pos = -1; music_manager->play_music(level_end_song, 0); endsequence_timer.start(7000); // 5 seconds until we finish the map tux->invincible_timer.start(7000); //FIXME: Implement a winning timer for the end sequence (with special winning animation etc.) } else if (!end_sequence && tux->is_dead()) { player_status.bonus = PlayerStatus::NO_BONUS; if (player_status.lives < 0) { // No more lives!? if(st_gl_mode != ST_GL_TEST) drawendscreen(); exit_status = ES_GAME_OVER; } else { // Still has lives, so reset Tux to the levelstart restart_level(); } return; } }
GameSession::GameSession(const std::string& subset_, int levelnb_, int mode) : world(0), st_gl_mode(mode), levelnb(levelnb_), end_sequence(NO_ENDSEQUENCE), subset(subset_) { current_ = this; global_frame_counter = 0; game_pause = false; fps_timer.init(true); frame_timer.init(true); restart_level(); }
void FaroresWindAction::update() { if(timer>0) { timer--; if(phase!=1) // Whatever return; } int ltile=0; int lflip=0; switch(phase) { //if(timer==0) case 0: { linktile(<ile, &lflip, ls_stab, down, zinit.linkanimationstyle); unpack_tile(newtilebuf, ltile, lflip, true); memcpy(linkTile, unpackbuf, 256); if(get_bit(quest_rules,qr_EXPANDEDLTM)) ltile+=item_tile_mod(); linktile(&link.tile, &link.flip, &link.extend, ls_pound, down, zinit.linkanimationstyle); if(get_bit(quest_rules,qr_EXPANDEDLTM)) { link.tile+=item_tile_mod(); } } phase=1; timer=64; // Fall though case 1: link.setX(fix(baseX+((rand()%3)-1))); link.setY(fix(baseY+((rand()%3)-1))); if(timer==0) phase=2; break; case 2: link.setX(fix(baseX)); link.setY(fix(baseY)); linktile(&link.tile, &link.flip, &link.extend, ls_stab, down, zinit.linkanimationstyle); if(get_bit(quest_rules,qr_EXPANDEDLTM)) link.tile+=item_tile_mod(); phase=3; timer=32; break; case 3: if(get_bit(quest_rules,qr_MORESOUNDS)) sfx(itemsbuf[magicitem].usesound,pan(int(link.getX()))); link.setDontDraw(true); for(int i=0; i<16; ++i) { for(int j=0; j<16; ++j) { if(linkTile[i*16+j]) { if(itemsbuf[magicitem].misc1==1) // Twilight { particles.add(new pTwilight(link.getX()+j, link.getY()-link.getZ()+i, 5, 0, 0, (rand()%8)+i*4)); int k=particles.Count()-1; particle *p = (particle*)(particles.spr(k)); p->step=3; } else if(itemsbuf[magicitem].misc1==2) // Sands of Hours { particles.add(new pTwilight(link.getX()+j, link.getY()-link.getZ()+i, 5, 1, 2, (rand()%16)+i*2)); int k=particles.Count()-1; particle *p = (particle*)(particles.spr(k)); p->step=4; if(rand()%10 < 2) { p->color=1; p->cset=0; } } else { particles.add(new pFaroresWindDust(link.getX()+j, link.getY()-link.getZ()+i, 5, 6, linkTile[i*16+j], rand()%96)); int k=particles.Count()-1; particle *p = (particle*)(particles.spr(k)); p->angular=true; p->angle=rand(); p->step=(((double)j)/8); p->yofs=link.getYOfs(); } } } } phase=4; timer=130; break; case 4: restart_level(); magicitem=-1; link.setDontDraw(false); link.currentItemAction=this; // This won't do... phase=5; break; } }