commit e1188317dbd09738abdcd41e585a6d1a7ac1f79a
Merge: 93f58bbe ca78a3ab
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Fri Jan 1 21:25:55 2016 +0100
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Fri Jan 1 21:25:55 2016 +0100
Merge branch 'master' into sdl2-branch
AUTHORS | 2 +
configure.ac | 33 ++++++-
man/Makefile.am | 4 +-
man/bash-completion/.gitignore | 4 +
man/bash-completion/Makefile.am | 44 ++++++++++
man/bash-completion/doom.template | 51 +++++++++++
man/bash-completion/heretic.template | 48 +++++++++++
man/bash-completion/hexen.template | 42 +++++++++
man/bash-completion/strife.template | 48 +++++++++++
man/docgen | 34 +++++++-
msvc/doom.vcproj | 8 ++
msvc/heretic.vcproj | 8 ++
msvc/hexen.vcproj | 8 ++
msvc/strife.vcproj | 8 ++
opl/opl.c | 4 +-
opl/opl_linux.c | 4 +-
pkg/osx/Execute.m | 4 +
src/Makefile.am | 12 +--
src/d_mode.c | 2 +-
src/doom/am_map.c | 8 +-
src/doom/d_main.c | 17 ++--
src/doom/f_finale.c | 16 ++--
src/doom/f_wipe.c | 12 +--
src/doom/g_game.c | 30 ++++++-
src/doom/m_menu.c | 4 +-
src/doom/p_doors.c | 1 +
src/doom/p_enemy.c | 2 +-
src/doom/p_map.c | 4 +-
src/doom/p_pspr.c | 2 +-
src/doom/p_setup.c | 12 ++-
src/doom/p_user.c | 2 +-
src/doom/r_draw.c | 4 +-
src/doom/r_main.c | 4 +-
src/doom/r_segs.c | 4 +-
src/doom/r_sky.c | 2 +-
src/doom/r_things.c | 4 +-
src/doom/st_stuff.c | 62 ++++++++------
src/doom/wi_stuff.c | 2 +-
src/doomtype.h | 6 +-
src/hexen/h2def.h | 19 +++--
src/i_oplmusic.c | 64 +++++++++++---
src/i_video.c | 161 ++++-------------------------------
src/i_video.h | 6 +-
src/m_config.c | 9 ++
src/m_fixed.c | 2 +-
src/setup/Makefile.am | 2 +-
src/setup/display.c | 13 +++
src/strife/d_main.c | 6 +-
src/tables.c | 4 +-
src/v_diskicon.c | 61 +++++++++++++
src/v_diskicon.h | 39 +++++++++
src/v_video.c | 4 +-
src/w_wad.c | 7 +-
textscreen/txt_table.c | 3 -
54 files changed, 696 insertions(+), 270 deletions(-)
diff --cc src/Makefile.am
index 3d162b9f,77b9565f..e61640e9
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@@ -270,8 -271,8 +271,8 @@@ CLEANFILES = $(execgames_SCRIPTS) $(app
if HAVE_PYTHON
-icon.c : $(top_builddir)/data/doom8.ico
- $(top_builddir)/data/convert-icon $(top_builddir)/data/doom8.ico $@
+icon.c : $(top_builddir)/data/doom.png
- $(top_builddir)/data/convert-icon $< $@
++ $(top_builddir)/data/convert-icon $(top_builddir)/data/doom.png $@
endif
diff --cc src/i_video.c
index 60807417,b98c3667..27fd7098
--- a/src/i_video.c
+++ b/src/i_video.c
@@@ -92,11 -91,6 +93,8 @@@ static const char shiftxform[]
'{', '|', '}', '~', 127
};
-
- #define LOADING_DISK_W 16
- #define LOADING_DISK_H 16
-
+#if 0 // obsolete software scaling routines
++
// Non aspect ratio-corrected modes (direct multiples of 320x200)
static screen_mode_t *screen_modes[] = {
@@@ -933,177 -918,6 +894,89 @@@ static boolean BlitArea(int x1, int y1
return result;
}
+#endif
+
- // TODO: needed for I_BeginRead() and I_EndRead(),
- // but let's forget about this for a while
- /*
- static void UpdateRect(int x1, int y1, int x2, int y2)
- {
- SDL_Rect update_rect;
- int x1_scaled, x2_scaled, y1_scaled, y2_scaled;
-
- // Do stretching and blitting
-
- if (BlitArea(x1, y1, x2, y2))
- {
- // Update the area
-
- x1_scaled = (x1 * screen_mode->width) / SCREENWIDTH;
- y1_scaled = (y1 * screen_mode->height) / SCREENHEIGHT;
- x2_scaled = (x2 * screen_mode->width) / SCREENWIDTH;
- y2_scaled = (y2 * screen_mode->height) / SCREENHEIGHT;
-
- update_rect.x = x1_scaled;
- update_rect.y = y1_scaled;
- update_rect.x = x2_scaled - x1_scaled;
- update_rect.y = y2_scaled - y1_scaled;
-
- SDL_UpdateWindowSurfaceRects(screen, &update_rect, 1);
- }
- }
- */
-
- // TODO: let's forget about this for a while
- void I_BeginRead(void)
- {
- /*
- byte *screenloc = I_VideoBuffer
- + (SCREENHEIGHT - LOADING_DISK_H) * SCREENWIDTH
- + (SCREENWIDTH - LOADING_DISK_W);
- int y;
-
- if (!initialized || disk_image == NULL)
- return;
-
- // save background and copy the disk image in
-
- for (y=0; y<LOADING_DISK_H; ++y)
- {
- memcpy(saved_background + y * LOADING_DISK_W,
- screenloc,
- LOADING_DISK_W);
- memcpy(screenloc,
- disk_image + y * LOADING_DISK_W,
- LOADING_DISK_W);
-
- screenloc += SCREENWIDTH;
- }
-
- UpdateRect(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H,
- SCREENWIDTH, SCREENHEIGHT);
- */
- }
-
- // TODO: let's forget about this for a while
- void I_EndRead(void)
- {
- /*
- byte *screenloc = I_VideoBuffer
- + (SCREENHEIGHT - LOADING_DISK_H) * SCREENWIDTH
- + (SCREENWIDTH - LOADING_DISK_W);
- int y;
-
- if (!initialized || disk_image == NULL)
- return;
-
- // save background and copy the disk image in
-
- for (y=0; y<LOADING_DISK_H; ++y)
- {
- memcpy(screenloc,
- saved_background + y * LOADING_DISK_W,
- LOADING_DISK_W);
-
- screenloc += SCREENWIDTH;
- }
-
- UpdateRect(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H,
- SCREENWIDTH, SCREENHEIGHT);
- */
- }
-
+static void CreateUpscaledTexture(int w, int h)
+{
+ const int actualheight = aspect_ratio_correct ?
+ SCREENHEIGHT_4_3 :
+ SCREENHEIGHT;
+ int h_upscale, w_upscale;
+ static int h_upscale_old, w_upscale_old;
+
+ // When the screen or window dimensions do not match the aspect ratio
+ // of the texture, the rendered area is scaled down to fit. Calculate
+ // the actual dimensions of the rendered area.
+
+ if (w * actualheight < h * SCREENWIDTH)
+ {
+ // Tall window.
+
+ h = w * actualheight / SCREENWIDTH;
+ }
+ else
+ {
+ // Wide window.
+
+ w = h * SCREENWIDTH / actualheight;
+ }
+
+ // If one screen dimension matches an integer multiple of the original
+ // resolution, there is no need to overscale in this direction.
+
+ h_upscale = h / SCREENHEIGHT;
+
+ if (!h || h % SCREENHEIGHT)
+ {
+ h_upscale++;
+ }
+
+ w_upscale = w / SCREENWIDTH;
+
+ if (!w || w % SCREENWIDTH)
+ {
+ w_upscale++;
+ }
+
+ // Limit maximum texture dimensions to 1600x1200.
+
+ if (h_upscale > 6)
+ {
+ h_upscale = 6;
+ }
+
+ if (w_upscale > 5)
+ {
+ w_upscale = 5;
+ }
+
+ // Create a new texture only if the upscale factors have actually changed.
+
+ if (h_upscale == h_upscale_old && w_upscale == w_upscale_old)
+ {
+ return;
+ }
+
+ h_upscale_old = h_upscale;
+ w_upscale_old = w_upscale;
+
+ if (texture_upscaled)
+ {
+ SDL_DestroyTexture(texture_upscaled);
+ }
+
+ // Set the scaling quality for rendering the upscaled texture to "linear",
+ // which looks much softer and smoother than "nearest" but does a better
+ // job at downscaling from the upscaled texture to screen.
+
+ SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
+
+ texture_upscaled = SDL_CreateTexture(renderer,
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_TEXTUREACCESS_TARGET,
+ w_upscale*SCREENWIDTH,
+ h_upscale*SCREENHEIGHT);
+}
//
// I_FinishUpdate
diff --cc src/setup/Makefile.am
index d276a038,a6f85782..600665ac
--- a/src/setup/Makefile.am
+++ b/src/setup/Makefile.am
@@@ -38,8 -38,8 +38,8 @@@ CLEANFILES = $(app_DATA
if HAVE_PYTHON
-setup_icon.c : $(top_builddir)/data/setup8.ico
- $(top_builddir)/data/convert-icon $(top_builddir)/data/setup8.ico $@
+setup_icon.c : $(top_builddir)/data/setup.png
- $(top_builddir)/data/convert-icon $^ $@
++ $(top_builddir)/data/convert-icon $(top_builddir)/data/setup.png $@
endif