static void update(struct game_state *gs) { if (inner_state.state != IS_LEVEL_CLEARED && inner_state.state != IS_LEVEL_TRANSITION) update_eye(); update_crosshair(); update_background(); update_water(); update_particles(); update_explosions(); if (ship_is_visible()) { update_ship(); update_missiles(); update_bombs(); update_lasers(); update_foes(); } update_powerups(); update_in_game_texts(); if (inner_state.state == IS_IN_GAME) { update_multiplier(); update_combo(); } if (inner_state.state == IS_GAME_OVER) { if (inner_state.tics >= GAME_OVER_FADE_IN_TICS) { if (!update_stats_table()) { gc.score += game_over_stats.bonus; set_inner_state(IS_RANK); } } } if (inner_state.state == IS_LEVEL_CLEARED) { if (inner_state.tics >= LEVEL_CLEARED_FADE_IN_TICS) { if (!update_stats_table()) { gc.score += game_over_stats.bonus; set_inner_state(IS_LEVEL_TRANSITION); } } } update_level_tics(); update_inner_state(); if (serializing) serialize(); }
int check_powerups(int y, int x, int a){ int i; Powerup_list * temp; int flag[3]={ 0, 0 ,0}; switch (a){ case 1: for (i = 0; i < 6; i++){ if (matrix[y - y1b - 2][x - x1b - 1] == pUps[i]) { flag[0]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b - 2][x - x1b - 1] == ' ') || (matrix[y - y1b - 2][x - x1b - 1] == 'g')) flag[0]=1; if (matrix[y - y1b - 2][x - x1b] == pUps[i]){ flag[1]=1; // negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b - 2][x - x1b] == ' ') || (matrix[y - y1b - 2][x - x1b] == 'g')) flag[1]=1; if (matrix[y - y1b - 2][x - x1b + 1] == pUps[i]){ flag[2]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b - 2][x - x1b + 1] == ' ') || (matrix[y - y1b - 2][x - x1b + 1] == 'g')) flag[2]=1; } for(i=0;i<=2; i++) if(flag[i]==0) return 0; for (i = 0; i < 6; i++){ if (matrix[y - y1b - 2][x - x1b - 1] == pUps[i]) { if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y-2,x-1); free_powerup(temp); // negde da ubacimo brisanje powerupa. } if (matrix[y - y1b - 2][x - x1b] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y-2,x); free_powerup(temp); // negde da ubacimo brisanje powerupa. } if (matrix[y - y1b - 2][x - x1b + 1] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y-2,x+1); free_powerup(temp); // negde da ubacimo brisanje powerupa. } } return 1; case 2: for (i = 0; i < 6; i++){ if (matrix[y - y1b - 1][x - x1b - 2] == pUps[i]) { flag[0]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b - 1][x - x1b - 2] == ' ') || (matrix[y - y1b - 1][x - x1b - 2] == 'g')) flag[0]=1; if (matrix[y - y1b][x - x1b - 2] == pUps[i]){ flag[1]=1; // negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b][x - x1b - 2] == ' ') || (matrix[y - y1b][x - x1b - 2] == 'g')) flag[1]=1; if (matrix[y - y1b + 1][x - x1b - 2] == pUps[i]){ flag[2]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b + 1][x - x1b - 2] == ' ') || (matrix[y - y1b + 1][x - x1b - 2] == 'g')) flag[2]=1; } for(i=0;i<=2; i++) if(flag[i]==0) return 0; for (i = 0; i < 6; i++){ if (matrix[y - y1b - 1][x - x1b - 2] == pUps[i]) { if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y-1,x-2); free_powerup(temp); } if (matrix[y - y1b][x - x1b - 2] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y,x-2); free_powerup(temp); } if (matrix[y - y1b + 1][x - x1b - 2] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y+1,x-2); free_powerup(temp); } } return 1; case 3: for (i = 0; i < 6; i++){ if (matrix[y - y1b - 1][x - x1b + 2] == pUps[i]) { flag[0]=1; // negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b - 1][x - x1b + 2] == ' ') || (matrix[y - y1b - 1][x - x1b + 2] == 'g')) flag[0]=1; if (matrix[y - y1b][x - x1b + 2] == pUps[i]){ flag[1]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b][x - x1b + 2] == ' ') || (matrix[y - y1b][x - x1b + 2] == 'g')) flag[1]=1; if (matrix[y - y1b + 1][x - x1b + 2] == pUps[i]){ flag[2]=1; // negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b + 1][x - x1b + 2] == ' ') || (matrix[y - y1b + 1][x - x1b + 2] == 'g')) flag[2]=1; } for(i=0;i<=2; i++) if(flag[i]==0) return 0; for (i = 0; i < 6; i++){ if (matrix[y - y1b - 1][x - x1b + 2] == pUps[i]) { if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y-1,x+2); free_powerup(temp); // negde da ubacimo brisanje powerupa. } if (matrix[y - y1b][x - x1b + 2] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y,x+2); free_powerup(temp); // negde da ubacimo brisanje powerupa. } if (matrix[y - y1b + 1][x - x1b + 2] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y+1,x+2); free_powerup(temp); } } return 1; case 4: for (i = 0; i < 6; i++){ if (matrix[y - y1b + 2][x - x1b - 1] == pUps[i]) { flag[0]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b + 2][x - x1b - 1] == ' ') || (matrix[y - y1b + 2][x - x1b - 1] == 'g')) flag[0]=1; if (matrix[y - y1b + 2][x - x1b] == pUps[i]){ flag[1]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b + 2][x - x1b] == ' ') || (matrix[y - y1b + 2][x - x1b] == 'g')) flag[1]=1; if (matrix[y - y1b + 2][x - x1b + 1] == pUps[i]){ flag[2]=1;// negde da ubacimo brisanje powerupa. } else if ((matrix[y - y1b + 2][x - x1b + 1] == ' ') || (matrix[y - y1b + 2][x - x1b + 1] == 'g')) flag[2]=1; } for(i=0;i<=2; i++) if(flag[i]==0) return 0; for (i = 0; i < 6; i++){ if (matrix[y - y1b + 2][x - x1b - 1] == pUps[i]) { if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y+2,x-1); free_powerup(temp); } if (matrix[y - y1b + 2][x - x1b] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y+2,x); free_powerup(temp); } if (matrix[y - y1b + 2][x - x1b + 1] == pUps[i]){ if(lst->curr==lst->first) update_powerups(pUps[i]); temp=which_powerup(y+2,x+1); free_powerup(temp); } } return 1; } }