diff options
author | Simon Howard | 2007-06-20 11:21:57 +0000 |
---|---|---|
committer | Simon Howard | 2007-06-20 11:21:57 +0000 |
commit | bc95293e5f880bffd163504b425123213bd60e04 (patch) | |
tree | 56c5a03c315934ac12389a9b0badbd4c81e104aa /src | |
parent | 856eebe52624ba5d780436feb349ea5ff2ee46b4 (diff) | |
download | chocolate-doom-bc95293e5f880bffd163504b425123213bd60e04.tar.gz chocolate-doom-bc95293e5f880bffd163504b425123213bd60e04.tar.bz2 chocolate-doom-bc95293e5f880bffd163504b425123213bd60e04.zip |
Add x5 screen scale (thanks MikeRS!)
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 919
Diffstat (limited to 'src')
-rw-r--r-- | src/i_scale.c | 106 | ||||
-rw-r--r-- | src/i_scale.h | 2 | ||||
-rw-r--r-- | src/i_video.c | 25 |
3 files changed, 130 insertions, 3 deletions
diff --git a/src/i_scale.c b/src/i_scale.c index dfba9f60..cba883a5 100644 --- a/src/i_scale.c +++ b/src/i_scale.c @@ -190,6 +190,48 @@ void I_Scale4x(int x1, int y1, int x2, int y2) } } +void I_Scale5x(int x1, int y1, int x2, int y2) +{ + byte *bufp, *screenp, *screenp2, *screenp3, *screenp4, *screenp5; + int x, y; + int multi_pitch; + + multi_pitch = dest_pitch * 5; + bufp = src_buffer + y1 * SCREENWIDTH + x1; + screenp = (byte *) dest_buffer + (y1 * dest_pitch + x1) * 5; + screenp2 = screenp + dest_pitch; + screenp3 = screenp + dest_pitch * 2; + screenp4 = screenp + dest_pitch * 3; + screenp5 = screenp + dest_pitch * 4; + + for (y=y1; y<y2; ++y) + { + byte *sp, *sp2, *sp3, *sp4, *sp5, *bp; + sp = screenp; + sp2 = screenp2; + sp3 = screenp3; + sp4 = screenp4; + sp5 = screenp5; + bp = bufp; + + for (x=x1; x<x2; ++x) + { + *sp++ = *bp; *sp++ = *bp; *sp++ = *bp; *sp++ = *bp; *sp++ = *bp; + *sp2++ = *bp; *sp2++ = *bp; *sp2++ = *bp; *sp2++ = *bp; *sp2++ = *bp; + *sp3++ = *bp; *sp3++ = *bp; *sp3++ = *bp; *sp3++ = *bp; *sp3++ = *bp; + *sp4++ = *bp; *sp4++ = *bp; *sp4++ = *bp; *sp4++ = *bp; *sp4++ = *bp; + *sp5++ = *bp; *sp5++ = *bp; *sp5++ = *bp; *sp5++ = *bp; *sp5++ = *bp; + ++bp; + } + screenp += multi_pitch; + screenp2 += multi_pitch; + screenp3 += multi_pitch; + screenp4 += multi_pitch; + screenp5 += multi_pitch; + bufp += SCREENWIDTH; + } +} + // Search through the given palette, finding the nearest color that matches // the given color. @@ -733,3 +775,67 @@ void I_Stretch4x(int x1, int y1, int x2, int y2) } } +static void WriteLine5x(byte *dest, byte *src) +{ + int x; + + for (x=0; x<SCREENWIDTH; ++x) + { + dest[0] = *src; + dest[1] = *src; + dest[2] = *src; + dest[3] = *src; + dest[4] = *src; + dest += 5; + ++src; + } +} + +void I_Stretch5x(int x1, int y1, int x2, int y2) +{ + byte *bufp, *screenp; + int y; + + // Only works with full screen update + + if (x1 != 0 || y1 != 0 || x2 != SCREENWIDTH || y2 != SCREENHEIGHT) + { + return; + } + + // Need to byte-copy from buffer into the screen buffer + + bufp = src_buffer + y1 * SCREENWIDTH + x1; + screenp = (byte *) dest_buffer + y1 * dest_pitch + x1; + + // For every 1 line of src_buffer, 6 lines are written to dest_buffer. + // (200 -> 1200) + + for (y=0; y<SCREENHEIGHT; y += 1) + { + // 100% line 0 + WriteLine5x(screenp, bufp); + screenp += dest_pitch; + + // 100% line 0 + WriteLine5x(screenp, bufp); + screenp += dest_pitch; + + // 100% line 0 + WriteLine5x(screenp, bufp); + screenp += dest_pitch; + + // 100% line 0 + WriteLine5x(screenp, bufp); + screenp += dest_pitch; + + // 100% line 0 + WriteLine5x(screenp, bufp); + screenp += dest_pitch; + + // 100% line 0 + WriteLine5x(screenp, bufp); + screenp += dest_pitch; bufp += SCREENWIDTH; + } +} + diff --git a/src/i_scale.h b/src/i_scale.h index d90f63f6..f4c7ff69 100644 --- a/src/i_scale.h +++ b/src/i_scale.h @@ -39,6 +39,7 @@ void I_Scale1x(int x1, int y1, int x2, int y2); void I_Scale2x(int x1, int y1, int x2, int y2); void I_Scale3x(int x1, int y1, int x2, int y2); void I_Scale4x(int x1, int y1, int x2, int y2); +void I_Scale5x(int x1, int y1, int x2, int y2); // Aspect ratio correcting scale up functions @@ -46,6 +47,7 @@ void I_Stretch1x(int x1, int y1, int x2, int y2); void I_Stretch2x(int x1, int y1, int x2, int y2); void I_Stretch3x(int x1, int y1, int x2, int y2); void I_Stretch4x(int x1, int y1, int x2, int y2); +void I_Stretch5x(int x1, int y1, int x2, int y2); #endif /* #ifndef __I_SCALE__ */ diff --git a/src/i_video.c b/src/i_video.c index 1666171e..ade81d03 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -640,6 +640,10 @@ static void BlitArea(int x1, int y1, int x2, int y2) { scale_function = I_Stretch4x; } + else if (screenmultiply == 5) + { + scale_function = I_Stretch5x; + } else { I_Error("No aspect ratio stretching function for screenmultiply=%i", @@ -663,6 +667,10 @@ static void BlitArea(int x1, int y1, int x2, int y2) { scale_function = I_Scale4x; } + else if (screenmultiply == 5) + { + scale_function = I_Scale5x; + } else { I_Error("No scale function found!"); @@ -962,7 +970,7 @@ static void CheckCommandLine(void) nomouse = M_CheckParm("-nomouse") > 0; - // 2x, 3x, 4x scale mode + // 2x, 3x, 4x, 5x scale mode //! // @category video @@ -1008,10 +1016,21 @@ static void CheckCommandLine(void) screenmultiply = 4; } + //! + // @category video + // + // Double up the screen to 5x its size. + // + + if (M_CheckParm("-5")) + { + screenmultiply = 5; + } + if (screenmultiply < 1) screenmultiply = 1; - if (screenmultiply > 4) - screenmultiply = 4; + if (screenmultiply > 5) + screenmultiply = 5; } static void AutoAdjustSettings(void) |