- if (subscreens[current_screen].screen->check_invalidated())
- subscreens[current_screen].screen->draw(subscreens[current_screen].buf);
+ unsigned char *sptr1 = fadefrom_buf;
+ unsigned char *sptr2 = subscreens[current_screen].buf;
+ unsigned char *dptr = buf;
+
+ if (same_fade && elapsed_fade >= 0.5) {
+ // fade G&B to be = R
+ for (unsigned i = 0; i < 800 * 600; ++i) {
+ dptr[0] = sptr2[0] + (((int(sptr2[2]) - int(sptr2[0])) * fb) >> 8);
+ dptr[1] = sptr2[1] + (((int(sptr2[2]) - int(sptr2[1])) * fg) >> 8);
+ dptr[2] = sptr2[2];
+ dptr[3] = sptr2[3];
+
+ sptr1 += 4, sptr2 += 4, dptr += 4;
+ }
+ } else {
+ for (unsigned i = 0; i < 800 * 600; ++i) {
+ dptr[0] = sptr1[0] + (((int(sptr2[0]) - int(sptr1[0])) * fb) >> 8);
+ dptr[1] = sptr1[1] + (((int(sptr2[1]) - int(sptr1[1])) * fg) >> 8);
+ dptr[2] = sptr1[2] + (((int(sptr2[2]) - int(sptr1[2])) * fr) >> 8);
+ dptr[3] = sptr1[3] + (((int(sptr2[3]) - int(sptr1[3])) * fa) >> 8);
+
+ sptr1 += 4, sptr2 += 4, dptr += 4;
+ }
+ }
+ }
+ } else {
+ // determine if we want to switch screens