Lines 39-44
Link Here
|
39 |
#include "memcheck.h" |
39 |
#include "memcheck.h" |
40 |
#include "rt_util.h" |
40 |
#include "rt_util.h" |
41 |
|
41 |
|
|
|
42 |
#define FULLSCREENHACK // !New! |
42 |
|
43 |
|
43 |
// GLOBAL VARIABLES |
44 |
// GLOBAL VARIABLES |
44 |
|
45 |
|
Lines 407-413
Link Here
|
407 |
==================== |
408 |
==================== |
408 |
*/ |
409 |
*/ |
409 |
static SDL_Surface *sdl_surface = NULL; |
410 |
static SDL_Surface *sdl_surface = NULL; |
410 |
static SDL_Surface *sdl_backbuf = NULL; |
411 |
#ifdef FULLSCREENHACK // [!New! |
|
|
412 |
static byte *backbuf = NULL; // Game drawing will happen here |
413 |
#endif // !New!] |
411 |
|
414 |
|
412 |
void GraphicsMode ( void ) |
415 |
void GraphicsMode ( void ) |
413 |
{ |
416 |
{ |
Lines 426-432
Link Here
|
426 |
|
429 |
|
427 |
SDL_WM_SetCaption ("Rise of the Triad", "ROTT"); |
430 |
SDL_WM_SetCaption ("Rise of the Triad", "ROTT"); |
428 |
SDL_ShowCursor (0); |
431 |
SDL_ShowCursor (0); |
429 |
sdl_surface = SDL_SetVideoMode (320, 200, 8, flags); |
432 |
#ifdef FULLSCREENHACK // [!New! |
|
|
433 |
sdl_surface = SDL_SetVideoMode (640, 480, 8, flags); |
434 |
backbuf = SafeMalloc(320*200); |
435 |
#else // !New!] |
436 |
sdl_surface = SDL_SetVideoMode (320, 200, 8, flags); |
437 |
#endif |
430 |
|
438 |
|
431 |
if (sdl_surface == NULL) |
439 |
if (sdl_surface == NULL) |
432 |
{ |
440 |
{ |
Lines 452-457
Link Here
|
452 |
|
460 |
|
453 |
SDL_QuitSubSystem (SDL_INIT_VIDEO); |
461 |
SDL_QuitSubSystem (SDL_INIT_VIDEO); |
454 |
} |
462 |
} |
|
|
463 |
#ifdef FULLSCREENHACK // [!New! |
464 |
if(backbuf != NULL) { |
465 |
SafeFree(backbuf); |
466 |
backbuf = NULL; |
467 |
} |
468 |
#endif // !New!] |
455 |
} |
469 |
} |
456 |
|
470 |
|
457 |
/* |
471 |
/* |
Lines 506-514
Link Here
|
506 |
|
520 |
|
507 |
screensize=MAXSCREENHEIGHT*MAXSCREENWIDTH; |
521 |
screensize=MAXSCREENHEIGHT*MAXSCREENWIDTH; |
508 |
|
522 |
|
|
|
523 |
#ifdef FULLSCREENHACK // [!New! |
524 |
page1start=(int)backbuf; |
525 |
page2start=(int)backbuf; |
526 |
page3start=(int)backbuf; |
527 |
#else // !New!] |
509 |
page1start=(int)sdl_surface->pixels; |
528 |
page1start=(int)sdl_surface->pixels; |
510 |
page2start=(int)sdl_surface->pixels; |
529 |
page2start=(int)sdl_surface->pixels; |
511 |
page3start=(int)sdl_surface->pixels; |
530 |
page3start=(int)sdl_surface->pixels; |
|
|
531 |
#endif // !New! |
512 |
displayofs = page1start; |
532 |
displayofs = page1start; |
513 |
bufferofs = page2start; |
533 |
bufferofs = page2start; |
514 |
XFlipPage (); |
534 |
XFlipPage (); |
Lines 637-643
Link Here
|
637 |
VGAMAPMASK(15); |
657 |
VGAMAPMASK(15); |
638 |
memset((byte *)(0xa000<<4),color,0x10000); |
658 |
memset((byte *)(0xa000<<4),color,0x10000); |
639 |
#else |
659 |
#else |
|
|
660 |
#ifdef FULLSCREENHACK // [!New! |
661 |
memset (backbuf, color, 320*200); |
662 |
#else // !New!] |
640 |
memset (sdl_surface->pixels, color, MAXSCREENWIDTH*MAXSCREENHEIGHT); |
663 |
memset (sdl_surface->pixels, color, MAXSCREENWIDTH*MAXSCREENHEIGHT); |
|
|
664 |
#endif // !New! |
641 |
#endif |
665 |
#endif |
642 |
} |
666 |
} |
643 |
|
667 |
|
Lines 653-663
Link Here
|
653 |
{ |
677 |
{ |
654 |
} |
678 |
} |
655 |
|
679 |
|
|
|
680 |
#ifdef FULLSCREENHACK // [!New! |
681 |
/* This scales a 320x200 image to 640x400 in good ol' DOS fashion. |
682 |
* This code has been optimized to the max, because it's used a lot. |
683 |
* This version is about 2.5 times as fast as the trivial implementation. */ |
684 |
/*void copyFullScreen(char* source, char* dest) |
685 |
{ |
686 |
int i, j, inRow, outRow1, outRow2; |
687 |
for(j = 0; j < 200; j++) { |
688 |
inRow = ylookup[j]; |
689 |
outRow1 = (j<<1)*640; |
690 |
outRow2 = ((j<<1)+1)*640; |
691 |
for(i = 0; i < 320; i++) { |
692 |
dest[outRow2+(i<<1)+1] = dest[outRow2+(i<<1)] = |
693 |
dest[outRow1+(i<<1)+1] = dest[outRow1+(i<<1)] = source[inRow+i]; |
694 |
} |
695 |
} |
696 |
}*/ |
697 |
// The same as above but for scaling 320x200 to 640x480 so the aspect |
698 |
// ratio is right. |
699 |
void copyFullScreen(char* source, char* dest) |
700 |
{ |
701 |
int i, j, inRow, outRow1, outRow2, outRow3; |
702 |
for(j = 0; j < 40; j++) { |
703 |
inRow = 1600*j; |
704 |
outRow1 = 7680*j; |
705 |
outRow2 = outRow1+640; |
706 |
for(i = 0; i < 320; i++) { |
707 |
dest[outRow2+(i<<1)+1] = dest[outRow2+(i<<1)] = |
708 |
dest[outRow1+(i<<1)+1] = dest[outRow1+(i<<1)] = source[inRow+i]; |
709 |
} |
710 |
inRow += 320; |
711 |
outRow1 += 1280; |
712 |
outRow2 += 1280; |
713 |
outRow3 = outRow2+640; |
714 |
for(i = 0; i < 320; i++) { |
715 |
dest[outRow3+(i<<1)+1] = dest[outRow3+(i<<1)] = |
716 |
dest[outRow2+(i<<1)+1] = dest[outRow2+(i<<1)] = |
717 |
dest[outRow1+(i<<1)+1] = dest[outRow1+(i<<1)] = source[inRow+i]; |
718 |
} |
719 |
inRow += 320; |
720 |
outRow1 += 1920; |
721 |
outRow2 += 1920; |
722 |
for(i = 0; i < 320; i++) { |
723 |
dest[outRow2+(i<<1)+1] = dest[outRow2+(i<<1)] = |
724 |
dest[outRow1+(i<<1)+1] = dest[outRow1+(i<<1)] = source[inRow+i]; |
725 |
} |
726 |
inRow += 320; |
727 |
outRow1 += 1280; |
728 |
outRow2 += 1280; |
729 |
outRow3 = outRow2+640; |
730 |
for(i = 0; i < 320; i++) { |
731 |
dest[outRow3+(i<<1)+1] = dest[outRow3+(i<<1)] = |
732 |
dest[outRow2+(i<<1)+1] = dest[outRow2+(i<<1)] = |
733 |
dest[outRow1+(i<<1)+1] = dest[outRow1+(i<<1)] = source[inRow+i]; |
734 |
} |
735 |
inRow += 320; |
736 |
outRow1 += 1920; |
737 |
outRow2 += 1920; |
738 |
for(i = 0; i < 320; i++) { |
739 |
dest[outRow2+(i<<1)+1] = dest[outRow2+(i<<1)] = |
740 |
dest[outRow1+(i<<1)+1] = dest[outRow1+(i<<1)] = source[inRow+i]; |
741 |
} |
742 |
} |
743 |
} |
744 |
#endif // !New!] |
656 |
|
745 |
|
657 |
/* C version of rt_vh_a.asm */ |
746 |
/* C version of rt_vh_a.asm */ |
658 |
|
747 |
|
659 |
void VH_UpdateScreen (void) |
748 |
void VH_UpdateScreen (void) |
660 |
{ |
749 |
{ |
|
|
750 |
#ifdef FULLSCREENHACK // [!New! |
751 |
copyFullScreen(backbuf, (char*)sdl_surface->pixels); |
752 |
#endif // !New!] |
661 |
SDL_UpdateRect (SDL_GetVideoSurface (), 0, 0, 0, 0); |
753 |
SDL_UpdateRect (SDL_GetVideoSurface (), 0, 0, 0, 0); |
662 |
} |
754 |
} |
663 |
|
755 |
|
Lines 685-690
Link Here
|
685 |
if (bufferofs > page3start) |
777 |
if (bufferofs > page3start) |
686 |
bufferofs = page1start; |
778 |
bufferofs = page1start; |
687 |
#else |
779 |
#else |
|
|
780 |
#ifdef FULLSCREENHACK // [!New! |
781 |
copyFullScreen(backbuf, (char*)sdl_surface->pixels); // !New! |
782 |
#endif // !New!] |
688 |
SDL_UpdateRect (sdl_surface, 0, 0, 0, 0); |
783 |
SDL_UpdateRect (sdl_surface, 0, 0, 0, 0); |
689 |
#endif |
784 |
#endif |
690 |
} |
785 |
} |