summaryrefslogtreecommitdiffhomepage
path: root/nGenEx/VideoSettings.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-09-30 16:46:36 +0200
committerAki <please@ignore.pl>2021-09-30 16:46:36 +0200
commit966fe28c59f59fc8be795c8215b9352435982445 (patch)
tree2979f8d30b63eb83310b78c62463915cb409989f /nGenEx/VideoSettings.cpp
parentc9b298cf8da03e6a9825eade5b764b0ed4804dc1 (diff)
downloadstarshatter-966fe28c59f59fc8be795c8215b9352435982445.zip
starshatter-966fe28c59f59fc8be795c8215b9352435982445.tar.gz
starshatter-966fe28c59f59fc8be795c8215b9352435982445.tar.bz2
Merged nGenEx and Parser into Stars45
Diffstat (limited to 'nGenEx/VideoSettings.cpp')
-rw-r--r--nGenEx/VideoSettings.cpp292
1 files changed, 0 insertions, 292 deletions
diff --git a/nGenEx/VideoSettings.cpp b/nGenEx/VideoSettings.cpp
deleted file mode 100644
index 995358c..0000000
--- a/nGenEx/VideoSettings.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/* Starshatter OpenSource Distribution
- Copyright (c) 1997-2004, Destroyer Studios LLC.
- All Rights Reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name "Destroyer Studios" nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- SUBSYSTEM: nGenEx.lib
- FILE: VideoSettings.cpp
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
- Video Settings class implementation
-*/
-
-#include "MemDebug.h"
-#include "VideoSettings.h"
-
-// +--------------------------------------------------------------------+
-
-VideoSettings::VideoSettings()
-{
- fullscreen_mode.width = 1024;
- fullscreen_mode.height = 768;
- fullscreen_mode.refresh = 75;
- fullscreen_mode.format = VideoMode::FMT_X8R8G8B8;
-
- windowed_mode.width = 800;
- windowed_mode.height = 600;
- windowed_mode.refresh = 0;
- windowed_mode.format = VideoMode::FMT_NONE;
-
- window_width = 800;
- window_height = 600;
-
- is_windowed = false;
- use_effects = true;
- shadows = true;
- bumpmaps = true;
- specmaps = true;
- max_detail = 4;
- enable_vs = true;
- enable_ps = true;
- depth_bias = 0;
-}
-
-VideoSettings::~VideoSettings()
-{ }
-
-// +--------------------------------------------------------------------+
-
-bool
-VideoSettings::IsWindowed() const
-{
- return is_windowed;
-}
-
-bool
-VideoSettings::UseEffects() const
-{
- return use_effects;
-}
-
-int
-VideoSettings::GetWidth() const
-{
- if (is_windowed)
- return window_width;
-
- return fullscreen_mode.width;
-}
-
-int
-VideoSettings::GetHeight() const
-{
- if (is_windowed)
- return window_height;
-
- return fullscreen_mode.height;
-}
-
-int
-VideoSettings::GetDepth() const
-{
- int fmt = 0;
- int bpp = 0;
-
- if (is_windowed)
- fmt = windowed_mode.format;
- else
- fmt = fullscreen_mode.format;
-
- switch (fmt) {
- default:
- case VideoMode::FMT_NONE: bpp = 0; break;
- case VideoMode::FMT_R5G5B5: bpp = 15; break;
- case VideoMode::FMT_R5G6B5: bpp = 16; break;
- case VideoMode::FMT_R8G8B8: bpp = 24; break;
- case VideoMode::FMT_X8R8G8B8: bpp = 32; break;
- }
-
- return bpp;
-}
-
-int
-VideoSettings::GetPixSize() const
-{
- int fmt = 0;
- int pix = 0;
-
- if (is_windowed)
- fmt = windowed_mode.format;
- else
- fmt = fullscreen_mode.format;
-
- switch (fmt) {
- default:
- case VideoMode::FMT_NONE: pix = 0; break;
- case VideoMode::FMT_R5G5B5: pix = 2; break;
- case VideoMode::FMT_R5G6B5: pix = 2; break;
- case VideoMode::FMT_R8G8B8: pix = 3; break;
- case VideoMode::FMT_X8R8G8B8: pix = 4; break;
- }
-
- return pix;
-}
-
-int
-VideoSettings::GetRefreshRate() const
-{
- if (is_windowed)
- return windowed_mode.refresh;
-
- return fullscreen_mode.refresh;
-}
-
-// +--------------------------------------------------------------------+
-
-const char*
-VideoSettings::GetModeDescription() const
-{
- if (is_windowed)
- return windowed_mode.GetDescription();
-
- return fullscreen_mode.GetDescription();
-}
-
-// +--------------------------------------------------------------------+
-
-int
-VideoSettings::GetVertexProcessing() const
-{
- if (is_windowed)
- return windowed_device.vertex_processing;
-
- return fullscreen_device.vertex_processing;
-}
-
-int
-VideoSettings::GetDepthBufferBits() const
-{
- if (is_windowed)
- return windowed_device.depth_buffer_bits;
-
- return fullscreen_device.depth_buffer_bits;
-}
-
-int
-VideoSettings::GetAdapterIndex() const
-{
- if (is_windowed)
- return windowed_device.adapter_index;
-
- return fullscreen_device.adapter_index;
-}
-
-int
-VideoSettings::GetDeviceIndex() const
-{
- if (is_windowed)
- return windowed_device.device_index;
-
- return fullscreen_device.device_index;
-}
-
-DWORD
-VideoSettings::GetDeviceType() const
-{
- if (is_windowed)
- return windowed_device.device_type;
-
- return fullscreen_device.device_type;
-}
-
-DWORD
-VideoSettings::GetDepthStencilFormat() const
-{
- if (is_windowed)
- return windowed_device.depth_stencil_format;
-
- return fullscreen_device.depth_stencil_format;
-}
-
-DWORD
-VideoSettings::GetBackBufferFormat() const
-{
- if (is_windowed)
- return windowed_device.back_buffer_format;
-
- return fullscreen_device.back_buffer_format;
-}
-
-const char*
-VideoSettings::GetAdapterDesc() const
-{
- if (is_windowed)
- return windowed_device.adapter_desc;
-
- return fullscreen_device.adapter_desc;
-}
-
-const char*
-VideoSettings::GetDeviceDesc() const
-{
- if (is_windowed)
- return windowed_device.device_desc;
-
- return fullscreen_device.device_desc;
-}
-
-
-// +--------------------------------------------------------------------+
-// +--------------------------------------------------------------------+
-// +--------------------------------------------------------------------+
-
-const char*
-VideoMode::GetDescription() const
-{
- static char desc[32];
-
- int bpp = 0;
- switch (format) {
- default:
- case VideoMode::FMT_NONE: bpp = 0; break;
- case VideoMode::FMT_R5G5B5: bpp = 15; break;
- case VideoMode::FMT_R5G6B5: bpp = 16; break;
- case VideoMode::FMT_R8G8B8: bpp = 24; break;
- case VideoMode::FMT_X8R8G8B8: bpp = 32; break;
- }
-
- sprintf_s(desc, "%d x %d x %d", width, height, bpp);
- return desc;
-}
-
-// +--------------------------------------------------------------------+
-// +--------------------------------------------------------------------+
-// +--------------------------------------------------------------------+
-
-VideoDeviceInfo::VideoDeviceInfo()
-{
- ZeroMemory(this, sizeof(VideoDeviceInfo));
-
- vertex_processing = VideoSettings::VTX_HARDWARE;
- depth_buffer_bits = 32;
-}
-
-VideoDeviceInfo::~VideoDeviceInfo()
-{
-}