void NextPlayer() { Int x; #ifdef DEBUG Int dd = 0; #endif x = stor.currplayer; while(1) { stor.currplayer = (stor.currplayer + 1) % stor.numplayers; if ( x == stor.currplayer ) { if ( stor.numplayers > 1 ) { // Only one guy hasn't lost //HaveWinner(); FrmCustomAlert( calertDEBUG, "We have a weiner, I mean a winner!", "No, I'm not telling you who.", "ToDo: Do this correctly." ); } break; } if ( ! stor.player[stor.currplayer].lost ) { break; } #ifdef DEBUG ErrNonFatalDisplayIf( ++dd > (MaxPlayers + 4), "NextPlayer: Had to rely on dd loop check!" ); #endif } DrawPlayerScore( x ); DrawPlayerScore( stor.currplayer ); // Clear scores stor.scorethisroll = stor.scorethisturn = 0; StayBit = false; // Clear cubes for( x = 0 ; x < NumCubes ; x++ ) { stor.cube[x].keep = false; stor.cube[x].value = 0; } stor.status = DS_NextPlayer; // Bypass StatusLine(); if ( stor.flags & flag_NextPlayerPopUp ) { FrmCustomAlert( calertNEXTPLAYER, stor.player[stor.currplayer].name, " ", " "); DrawState(); } else { DrawStatus(); } }
void DrawState() { Short x; Char msg[MaxName+4]; DrawCurrScore(); // Fill the fields x = 0; if ( stor.currplayer > -1 ) { // If there is a game on, fill in the names and scores for ( ; x < stor.numplayers ; x++ ) { StrPrintF( msg, "%d. %s", x+1, stor.player[x].name, NULL ); SetFieldTextFromStr( fieldNamePlayer[x], msg ); DrawPlayerScore( x ); } } // Clears the rest if the fields for ( ; x < MaxPlayers ; x++ ) { ClearFieldText( fieldNamePlayer[x] ); ClearFieldText( fieldScorePlayer[x] ); ClearFieldText( fieldMarkPlayer[x] ); } for ( x = 0 ; x < NumCubes ; x++ ) { DrawCube(x); DrawKeepBit(x); } DrawStayButton(); DrawRollButton(); DrawStatus(); DrawTopStatusButton(); }
update_status ModuleUI::Update(){ now = SDL_GetTicks(); if (App->input->keyboard[SDL_SCANCODE_5] == KEY_STATE::KEY_DOWN){ App->ui->AddCoin(); } if (App->input->keyboard[SDL_SCANCODE_K] == KEY_STATE::KEY_DOWN){ App->ui->AddEnergy(); } if (game){ if (dead){ lives--; if (lives >= 0){ dead = false; App->player->position.x = checkpoints[curr_check].x; App->player->position.y = checkpoints[curr_check].y; App->player->PlayerCollider->SetPos(App->player->position.x + 10, App->player->position.y + 20); App->player->PlayerEBulletsCollider->SetPos(App->player->position.x + 4, App->player->position.y + 3); App->player->dead = false; App->player->fall_hole.Reset(); App->player->direction = IDLE; App->render->camera.y = checkpoints[curr_check].camera_y; RestetEnergyBombs(); App->player->dead_explo.Reset(); } else { //App->render->Blit(ui_graphics, 23, (-App->render->camera.y) / SCREEN_SIZE + 136, &gameover); if (TopScore()) App->fade->FadeToBlack((Module *)App->levels, (Module *)App->namescreen, 1.0f); else App->fade->FadeToBlack((Module *)App->levels, (Module *)App->losescreen, 1.0f); App->player->dead_explo.Reset(); } } if (score > top_score) top_score = score; if (now - e_timer > 1500 && energy > 0) { energy--; e_timer = SDL_GetTicks(); } if (curr_check + 1 < checkpoints.size()){ if ((-App->render->camera.y) / 3+200 < checkpoints[curr_check + 1].y) curr_check++; } App->render->Blit(ui_graphics, 18, (-App->render->camera.y) / SCREEN_SIZE + 1, &(player1.GetCurrentFrame()));//player1 DrawPlayerScore(score, 66, (-App->render->camera.y) / SCREEN_SIZE + 9, Points); //player score App->render->Blit(ui_graphics, 158, (-App->render->camera.y) / SCREEN_SIZE + 1, &(player2.GetCurrentFrame())); App->render->Blit(ui_graphics, 105, (-App->render->camera.y) / SCREEN_SIZE + 1, &top);//top DrawPlayerScore(top_score, 137, (-App->render->camera.y) / SCREEN_SIZE + 9, Points); //top score for (int i = 0; i < bombs; i++){//bombs App->render->Blit(ui_graphics, 8 * i, (-App->render->camera.y) / SCREEN_SIZE + 304, &bomb); } App->render->Blit(ui_graphics, 0, (-App->render->camera.y) / SCREEN_SIZE, &lives_symbol);// lives icon DrawPlayerScore(lives, 8, (-App->render->camera.y) / SCREEN_SIZE + 1, lives_num);//lives number App->render->Blit(ui_graphics, 0, (-App->render->camera.y) / SCREEN_SIZE + 17, &energy_bar);//energy bar for (int i = 0; i < energy; i++){ App->render->Blit(ui_graphics, 17+(2 * i), (-App->render->camera.y) / SCREEN_SIZE + 18, &energy_pill); } } else{ UpdateCreditnum(); //Draw Stuff App->render->Blit(ui_graphics, 18, 1, &player1_static);//player1 DrawPlayerScore(score, 66, (-App->render->camera.y) / SCREEN_SIZE + 9, Points); //player score App->render->Blit(ui_graphics, 158, 1, &player2_title);//player2 DrawPlayerScore(score_p2, 206, 9, Points); //p2 score App->render->Blit(ui_graphics, 105, 1, &top);//top DrawPlayerScore(top_score, 137, (-App->render->camera.y) / SCREEN_SIZE + 9, Points); //top score if (title||cont){ App->render->Blit(ui_graphics, 84, 305, &credits);//credits App->render->Blit(ui_graphics, 140, 305, c_num);//credit number } } return UPDATE_CONTINUE; }