/* GRAY OUT */ void Game::Grayout() { int newdot = 0; for (int x=0; x<(sizeof(cast)/sizeof(cast[0])); x++) { if (cast[x] == true || globalCooldown == true) { for (int i=(screen->w*sframes_y+(sframes_x+(images[11]->ReturnW()*x))+(x*9)-1), j=0; i<(screen->w*(sframes_y+images[11]->ReturnH())+(sframes_x+(images[11]->ReturnW()*x))); i++, j++){ if (newdot == 0) { ((unsigned long *)screen->pixels)[i] = 0; newdot++; } else if (newdot == 2) { newdot = 0; } else { newdot++; } if (j >= (images[11]->ReturnW())) { i += (screen->w - images[11]->ReturnW()); j = 0; } } // Display cooldown int minutes = cooldown[x] / 60; int seconds = cooldown[x] % 60; ostringstream str; if (minutes > 0) { if (minutes == 1 && seconds == 0) { str << "60"; } else { minutes++; str << minutes; str << "min"; } } else { str << seconds; } Font font(str.str().c_str(), screen, 20, 11, (sframes_x+((images[11]->ReturnW()+9)*x)+5), sframes_y+5); // Count down cooldown if (cooldown[x] > 0) { if (SDL_GetTicks() >= (cdtime[x]+1000)) { cooldown[x]--; cdtime[x] = SDL_GetTicks(); } } else { cast[x] = false; } } } }