mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 21:11:52 +00:00
Merge branch 'master' into clientserver
This commit is contained in:
commit
f09fe7babc
547 changed files with 11258 additions and 9764 deletions
|
@ -156,6 +156,7 @@ macro( use_fast_math )
|
|||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
|
||||
endmacro()
|
||||
|
||||
|
||||
include( CheckFunctionExists )
|
||||
|
||||
macro( require_stricmp )
|
||||
|
@ -203,9 +204,9 @@ if( MSVC )
|
|||
# Function-level linking
|
||||
# Disable run-time type information
|
||||
if ( HAVE_VULKAN )
|
||||
set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN" )
|
||||
set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN /DHAVE_SOFTPOLY" )
|
||||
else()
|
||||
set( ALL_C_FLAGS "/GF /Gy /permissive-" )
|
||||
set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_SOFTPOLY" )
|
||||
endif()
|
||||
|
||||
# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
|
||||
|
@ -241,9 +242,9 @@ if( MSVC )
|
|||
else()
|
||||
set( REL_LINKER_FLAGS "" )
|
||||
if ( HAVE_VULKAN )
|
||||
set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN" )
|
||||
set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN -DHAVE_SOFTPOLY" )
|
||||
else()
|
||||
set( ALL_C_FLAGS "-ffp-contract=off" )
|
||||
set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_SOFTPOLY" )
|
||||
endif()
|
||||
|
||||
if ( UNIX )
|
||||
|
|
|
@ -159,6 +159,11 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
option( NO_SDL_JOYSTICK "Disable SDL joystick support (Not applicable to Windows)" OFF )
|
||||
if ( NO_SDL_JOYSTICK )
|
||||
add_definitions( -DNO_SDL_JOYSTICK=1 )
|
||||
endif ( NO_SDL_JOYSTICK )
|
||||
|
||||
if( NO_GTK )
|
||||
add_definitions( -DNO_GTK )
|
||||
elseif( DYN_GTK )
|
||||
|
@ -438,82 +443,83 @@ endif()
|
|||
|
||||
# Start defining source files for ZDoom
|
||||
set( PLAT_WIN32_SOURCES
|
||||
win32/hardware.cpp
|
||||
win32/i_crash.cpp
|
||||
win32/i_input.cpp
|
||||
win32/i_keyboard.cpp
|
||||
win32/i_mouse.cpp
|
||||
win32/i_dijoy.cpp
|
||||
win32/i_rawps2.cpp
|
||||
win32/i_xinput.cpp
|
||||
win32/i_main.cpp
|
||||
win32/i_system.cpp
|
||||
win32/i_specialpaths.cpp
|
||||
win32/st_start.cpp
|
||||
win32/st_start_util.cpp
|
||||
win32/gl_sysfb.cpp
|
||||
win32/base_sysfb.cpp
|
||||
win32/win32basevideo.cpp
|
||||
win32/win32glvideo.cpp
|
||||
win32/win32polyvideo.cpp)
|
||||
|
||||
win32/i_steam.cpp
|
||||
common/platform/win32/hardware.cpp
|
||||
common/platform/win32/i_crash.cpp
|
||||
common/platform/win32/i_input.cpp
|
||||
common/platform/win32/i_keyboard.cpp
|
||||
common/platform/win32/i_mouse.cpp
|
||||
common/platform/win32/i_dijoy.cpp
|
||||
common/platform/win32/i_rawps2.cpp
|
||||
common/platform/win32/i_xinput.cpp
|
||||
common/platform/win32/i_main.cpp
|
||||
common/platform/win32/i_system.cpp
|
||||
common/platform/win32/i_specialpaths.cpp
|
||||
common/platform/win32/st_start.cpp
|
||||
common/platform/win32/st_start_util.cpp
|
||||
common/platform/win32/gl_sysfb.cpp
|
||||
common/platform/win32/base_sysfb.cpp
|
||||
common/platform/win32/win32basevideo.cpp
|
||||
common/platform/win32/win32glvideo.cpp
|
||||
common/platform/win32/win32polyvideo.cpp)
|
||||
|
||||
if (HAVE_VULKAN)
|
||||
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} win32/win32vulkanvideo.cpp )
|
||||
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} common/platform/win32/win32vulkanvideo.cpp )
|
||||
endif()
|
||||
|
||||
set( PLAT_POSIX_SOURCES
|
||||
posix/i_steam.cpp
|
||||
posix/i_system_posix.cpp )
|
||||
common/platform/posix/i_system_posix.cpp )
|
||||
set( PLAT_SDL_SOURCES
|
||||
posix/sdl/crashcatcher.c
|
||||
posix/sdl/hardware.cpp
|
||||
posix/sdl/i_gui.cpp
|
||||
posix/sdl/i_input.cpp
|
||||
posix/sdl/i_joystick.cpp
|
||||
posix/sdl/i_main.cpp
|
||||
posix/sdl/i_system.cpp
|
||||
posix/sdl/sdlglvideo.cpp
|
||||
posix/sdl/st_start.cpp )
|
||||
common/platform/posix/sdl/crashcatcher.c
|
||||
common/platform/posix/sdl/hardware.cpp
|
||||
common/platform/posix/sdl/i_gui.cpp
|
||||
common/platform/posix/sdl/i_input.cpp
|
||||
common/platform/posix/sdl/i_joystick.cpp
|
||||
common/platform/posix/sdl/i_main.cpp
|
||||
common/platform/posix/sdl/i_system.cpp
|
||||
common/platform/posix/sdl/sdlglvideo.cpp
|
||||
common/platform/posix/sdl/st_start.cpp )
|
||||
set( PLAT_UNIX_SOURCES
|
||||
posix/unix/i_specialpaths.cpp
|
||||
posix/unix/gtk_dialogs.cpp )
|
||||
common/platform/posix/unix/i_specialpaths.cpp
|
||||
common/platform/posix/unix/gtk_dialogs.cpp )
|
||||
set( PLAT_OSX_SOURCES
|
||||
posix/osx/iwadpicker_cocoa.mm
|
||||
posix/osx/i_specialpaths.mm
|
||||
common/platform/posix/osx/iwadpicker_cocoa.mm
|
||||
common/platform/posix/osx/i_specialpaths.mm
|
||||
posix/osx/zdoom.icns )
|
||||
set( PLAT_COCOA_SOURCES
|
||||
posix/cocoa/i_input.mm
|
||||
posix/cocoa/i_joystick.cpp
|
||||
posix/cocoa/i_main.mm
|
||||
posix/cocoa/i_system.mm
|
||||
posix/cocoa/i_video.mm
|
||||
posix/cocoa/st_console.mm
|
||||
posix/cocoa/st_start.mm )
|
||||
common/platform/posix/cocoa/i_input.mm
|
||||
common/platform/posix/cocoa/i_joystick.cpp
|
||||
common/platform/posix/cocoa/i_main.mm
|
||||
common/platform/posix/cocoa/i_system.mm
|
||||
common/platform/posix/cocoa/i_video.mm
|
||||
common/platform/posix/cocoa/st_console.mm
|
||||
common/platform/posix/cocoa/st_start.mm )
|
||||
|
||||
if( WIN32 )
|
||||
set( SYSTEM_SOURCES_DIR win32 )
|
||||
set( SYSTEM_SOURCES_DIR common/platform/win32 )
|
||||
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
|
||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc )
|
||||
elseif( APPLE )
|
||||
if( OSX_COCOA_BACKEND )
|
||||
set( SYSTEM_SOURCES_DIR posix posix/cocoa )
|
||||
set( SYSTEM_SOURCES_DIR common/platform/posix common/platform/posix/cocoa )
|
||||
set( SYSTEM_SOURCES ${PLAT_COCOA_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
else()
|
||||
set( SYSTEM_SOURCES_DIR posix posix/sdl )
|
||||
set( SYSTEM_SOURCES_DIR common/platform/posix common/platform/posix/sdl )
|
||||
set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} )
|
||||
set( PLAT_OSX_SOURCES ${PLAT_OSX_SOURCES} posix/sdl/i_system.mm )
|
||||
set( PLAT_OSX_SOURCES ${PLAT_OSX_SOURCES} common/platform/posix/sdl/i_system.mm )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
endif()
|
||||
|
||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_POSIX_SOURCES} ${PLAT_OSX_SOURCES} )
|
||||
|
||||
set_source_files_properties( posix/osx/zdoom.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||
set_source_files_properties( posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions )
|
||||
set_source_files_properties( common/platform/posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions )
|
||||
else()
|
||||
set( SYSTEM_SOURCES_DIR posix posix/sdl )
|
||||
set( SYSTEM_SOURCES_DIR common/platform/posix common/platform/posix/sdl )
|
||||
set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
endif()
|
||||
|
@ -593,11 +599,7 @@ file( GLOB HEADER_FILES
|
|||
sound/*.h
|
||||
sound/backend/*.h*
|
||||
posix/*.h
|
||||
posix/cocoa/*.h
|
||||
posix/sdl/*.h
|
||||
win32/*.h
|
||||
r_data/*.h
|
||||
r_data/models/*.h
|
||||
common/audio/sound/thirdparty/*.h
|
||||
common/audio/sound/*.h
|
||||
common/audio/music/*.h*
|
||||
|
@ -605,9 +607,14 @@ file( GLOB HEADER_FILES
|
|||
common/console/*.h
|
||||
common/utility/*.h
|
||||
common/engine/*.h
|
||||
common/menu/*.h
|
||||
common/fonts/*.h
|
||||
common/objects/*.h
|
||||
common/filesystem/*.h
|
||||
common/platform/posix/cocoa/*.h
|
||||
common/platform/posix/sdl/*.h
|
||||
common/platform/win32/*.h
|
||||
common/models/*.h
|
||||
common/textures/*.h
|
||||
common/textures/hires/hqnx/*.h
|
||||
common/textures/hires/hqnx_asm/*.h
|
||||
|
@ -615,7 +622,18 @@ file( GLOB HEADER_FILES
|
|||
common/thirdparty/*.h
|
||||
common/thirdparty/rapidjson/*.h
|
||||
common/thirdparty/math/*h
|
||||
common/rendering/*.h
|
||||
common/rendering/gl_load/*.h
|
||||
common/rendering/hwrenderer/data/*.h
|
||||
common/rendering/polyrenderer/*.h
|
||||
common/rendering/polyrenderer/math/*.h
|
||||
common/rendering/polyrenderer/drawers/*.h
|
||||
common/rendering/polyrenderer/backend/*.h
|
||||
common/rendering/vulkan/*.h
|
||||
common/rendering/vulkan/system/*.h
|
||||
common/rendering/vulkan/renderer/*.h
|
||||
common/rendering/vulkan/shaders/*.h
|
||||
common/rendering/vulkan/textures/*.h
|
||||
common/scripting/core/*h
|
||||
common/scripting/vm/*h
|
||||
common/scripting/jit/*h
|
||||
|
@ -639,41 +657,18 @@ file( GLOB HEADER_FILES
|
|||
rendering/swrenderer/plane/*.h
|
||||
rendering/swrenderer/things/*.h
|
||||
rendering/swrenderer/viewport/*.h
|
||||
rendering/polyrenderer/*.h
|
||||
rendering/polyrenderer/math/*.h
|
||||
rendering/polyrenderer/drawers/*.h
|
||||
rendering/polyrenderer/backend/*.h
|
||||
rendering/hwrenderer/data/*.h
|
||||
rendering/hwrenderer/dynlights/*.h
|
||||
rendering/hwrenderer/models/*.h
|
||||
rendering/hwrenderer/postprocessing/*.h
|
||||
rendering/hwrenderer/*.h
|
||||
rendering/hwrenderer/scene/*.h
|
||||
rendering/hwrenderer/textures/*.h
|
||||
rendering/hwrenderer/utility/*.h
|
||||
rendering/vulkan/*.h
|
||||
rendering/vulkan/system/*.h
|
||||
rendering/vulkan/renderer/*.h
|
||||
rendering/vulkan/shaders/*.h
|
||||
rendering/vulkan/textures/*.h
|
||||
rendering/gl/*.h
|
||||
rendering/gl/models/*.h
|
||||
rendering/gl/renderer/*.h
|
||||
rendering/gl/scene/*.h
|
||||
rendering/gl/shaders/*.h
|
||||
rendering/gl/system/*.h
|
||||
rendering/gl/textures/*.h
|
||||
*.h
|
||||
)
|
||||
|
||||
set ( SWRENDER_SOURCES
|
||||
rendering/swrenderer/r_swcolormaps.cpp
|
||||
rendering/swrenderer/r_swrenderer.cpp
|
||||
rendering/swrenderer/r_memory.cpp
|
||||
rendering/swrenderer/r_renderthread.cpp
|
||||
rendering/swrenderer/drawers/r_draw.cpp
|
||||
rendering/swrenderer/drawers/r_draw_pal.cpp
|
||||
rendering/swrenderer/drawers/r_draw_rgba.cpp
|
||||
rendering/swrenderer/drawers/r_thread.cpp
|
||||
rendering/swrenderer/scene/r_3dfloors.cpp
|
||||
rendering/swrenderer/scene/r_light.cpp
|
||||
rendering/swrenderer/scene/r_opaque_pass.cpp
|
||||
|
@ -713,12 +708,12 @@ set ( SWRENDER_SOURCES
|
|||
)
|
||||
|
||||
set( POLYRENDER_SOURCES
|
||||
rendering/polyrenderer/drawers/poly_triangle.cpp
|
||||
rendering/polyrenderer/drawers/poly_thread.cpp
|
||||
rendering/polyrenderer/drawers/screen_triangle.cpp
|
||||
rendering/polyrenderer/drawers/screen_scanline_setup.cpp
|
||||
rendering/polyrenderer/drawers/screen_shader.cpp
|
||||
rendering/polyrenderer/drawers/screen_blend.cpp
|
||||
common/rendering/polyrenderer/drawers/poly_triangle.cpp
|
||||
common/rendering/polyrenderer/drawers/poly_thread.cpp
|
||||
common/rendering/polyrenderer/drawers/screen_triangle.cpp
|
||||
common/rendering/polyrenderer/drawers/screen_scanline_setup.cpp
|
||||
common/rendering/polyrenderer/drawers/screen_shader.cpp
|
||||
common/rendering/polyrenderer/drawers/screen_blend.cpp
|
||||
)
|
||||
|
||||
# These files will be flagged as "headers" so that they appear in project files
|
||||
|
@ -736,7 +731,7 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
common/scripting/frontend/zcc-parse.lemon
|
||||
zcc-parse.c
|
||||
zcc-parse.h
|
||||
win32/zdoom.natvis
|
||||
common/platform/win32/zutil.natvis
|
||||
)
|
||||
|
||||
set( VM_JIT_SOURCES
|
||||
|
@ -758,7 +753,7 @@ set( VM_JIT_SOURCES
|
|||
set( FASTMATH_SOURCES
|
||||
rendering/swrenderer/r_all.cpp
|
||||
rendering/swrenderer/r_swscene.cpp
|
||||
rendering/polyrenderer/poly_all.cpp
|
||||
common/rendering/polyrenderer/poly_all.cpp
|
||||
common/textures/hires/hqnx/init.cpp
|
||||
common/textures/hires/hqnx/hq2x.cpp
|
||||
common/textures/hires/hqnx/hq3x.cpp
|
||||
|
@ -766,9 +761,7 @@ set( FASTMATH_SOURCES
|
|||
common/textures/hires/xbr/xbrz.cpp
|
||||
common/textures/hires/xbr/xbrz_old.cpp
|
||||
common/rendering/gl_load/gl_load.c
|
||||
rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocessshader.cpp
|
||||
rendering/hwrenderer/dynlights/hw_dynlightdata.cpp
|
||||
rendering/hwrenderer/hw_dynlightdata.cpp
|
||||
rendering/hwrenderer/scene/hw_bsp.cpp
|
||||
rendering/hwrenderer/scene/hw_fakeflat.cpp
|
||||
rendering/hwrenderer/scene/hw_decal.cpp
|
||||
|
@ -785,28 +778,27 @@ set( FASTMATH_SOURCES
|
|||
rendering/hwrenderer/scene/hw_walls.cpp
|
||||
rendering/hwrenderer/scene/hw_walls_vertex.cpp
|
||||
rendering/hwrenderer/scene/hw_weapon.cpp
|
||||
r_data/models/models.cpp
|
||||
common/utility/matrix.cpp
|
||||
)
|
||||
|
||||
#Vulkan stuff must go into a separate list later because it needs to be disabled for some platforms
|
||||
#Vulkan stuff must go into a separate list because it needs to be disabled for some platforms
|
||||
set (VULKAN_SOURCES
|
||||
rendering/vulkan/system/vk_device.cpp
|
||||
rendering/vulkan/system/vk_swapchain.cpp
|
||||
rendering/vulkan/system/vk_builders.cpp
|
||||
rendering/vulkan/system/vk_framebuffer.cpp
|
||||
rendering/vulkan/system/vk_buffers.cpp
|
||||
rendering/vulkan/renderer/vk_renderstate.cpp
|
||||
rendering/vulkan/renderer/vk_renderpass.cpp
|
||||
rendering/vulkan/renderer/vk_streambuffer.cpp
|
||||
rendering/vulkan/renderer/vk_postprocess.cpp
|
||||
rendering/vulkan/renderer/vk_renderbuffers.cpp
|
||||
rendering/vulkan/shaders/vk_shader.cpp
|
||||
rendering/vulkan/textures/vk_samplers.cpp
|
||||
rendering/vulkan/textures/vk_hwtexture.cpp
|
||||
rendering/vulkan/textures/vk_imagetransition.cpp
|
||||
rendering/vulkan/thirdparty/volk/volk.c
|
||||
rendering/vulkan/thirdparty/vk_mem_alloc/vk_mem_alloc.cpp
|
||||
common/rendering/vulkan/system/vk_device.cpp
|
||||
common/rendering/vulkan/system/vk_swapchain.cpp
|
||||
common/rendering/vulkan/system/vk_builders.cpp
|
||||
common/rendering/vulkan/system/vk_framebuffer.cpp
|
||||
common/rendering/vulkan/system/vk_buffers.cpp
|
||||
common/rendering/vulkan/renderer/vk_renderstate.cpp
|
||||
common/rendering/vulkan/renderer/vk_renderpass.cpp
|
||||
common/rendering/vulkan/renderer/vk_streambuffer.cpp
|
||||
common/rendering/vulkan/renderer/vk_postprocess.cpp
|
||||
common/rendering/vulkan/renderer/vk_renderbuffers.cpp
|
||||
common/rendering/vulkan/shaders/vk_shader.cpp
|
||||
common/rendering/vulkan/textures/vk_samplers.cpp
|
||||
common/rendering/vulkan/textures/vk_hwtexture.cpp
|
||||
common/rendering/vulkan/textures/vk_imagetransition.cpp
|
||||
common/rendering/vulkan/thirdparty/volk/volk.c
|
||||
common/rendering/vulkan/thirdparty/vk_mem_alloc/vk_mem_alloc.cpp
|
||||
)
|
||||
|
||||
if (HAVE_VULKAN)
|
||||
|
@ -814,10 +806,10 @@ if (HAVE_VULKAN)
|
|||
endif()
|
||||
|
||||
set (POLYBACKEND_SOURCES
|
||||
rendering/polyrenderer/backend/poly_framebuffer.cpp
|
||||
rendering/polyrenderer/backend/poly_buffers.cpp
|
||||
rendering/polyrenderer/backend/poly_hwtexture.cpp
|
||||
rendering/polyrenderer/backend/poly_renderstate.cpp
|
||||
common/rendering/polyrenderer/backend/poly_framebuffer.cpp
|
||||
common/rendering/polyrenderer/backend/poly_buffers.cpp
|
||||
common/rendering/polyrenderer/backend/poly_hwtexture.cpp
|
||||
common/rendering/polyrenderer/backend/poly_renderstate.cpp
|
||||
)
|
||||
set (FASTMATH_SOURCES ${FASTMATH_SOURCES} ${POLYBACKEND_SOURCES})
|
||||
|
||||
|
@ -880,7 +872,6 @@ set (PCH_SOURCES
|
|||
playsim/p_user.cpp
|
||||
rendering/r_utility.cpp
|
||||
rendering/r_sky.cpp
|
||||
rendering/r_videoscale.cpp
|
||||
sound/s_advsound.cpp
|
||||
sound/s_reverbedit.cpp
|
||||
sound/s_sndseq.cpp
|
||||
|
@ -888,9 +879,7 @@ set (PCH_SOURCES
|
|||
serializer_doom.cpp
|
||||
scriptutil.cpp
|
||||
st_stuff.cpp
|
||||
rendering/v_framebuffer.cpp
|
||||
r_data/v_palette.cpp
|
||||
rendering/v_video.cpp
|
||||
wi_stuff.cpp
|
||||
gamedata/a_keys.cpp
|
||||
gamedata/a_weapons.cpp
|
||||
|
@ -948,40 +937,15 @@ set (PCH_SOURCES
|
|||
g_statusbar/shared_sbar.cpp
|
||||
rendering/2d/f_wipe.cpp
|
||||
rendering/2d/v_blend.cpp
|
||||
rendering/gl/renderer/gl_renderer.cpp
|
||||
rendering/gl/renderer/gl_renderstate.cpp
|
||||
rendering/gl/renderer/gl_renderbuffers.cpp
|
||||
rendering/gl/renderer/gl_postprocess.cpp
|
||||
rendering/gl/renderer/gl_postprocessstate.cpp
|
||||
rendering/gl/renderer/gl_stereo3d.cpp
|
||||
rendering/gl/renderer/gl_scene.cpp
|
||||
rendering/gl/shaders/gl_shader.cpp
|
||||
rendering/gl/shaders/gl_shaderprogram.cpp
|
||||
rendering/gl/system/gl_framebuffer.cpp
|
||||
rendering/gl/system/gl_debug.cpp
|
||||
rendering/gl/system/gl_buffers.cpp
|
||||
rendering/gl/textures/gl_hwtexture.cpp
|
||||
rendering/gl/textures/gl_samplers.cpp
|
||||
rendering/hwrenderer/data/hw_vertexbuilder.cpp
|
||||
rendering/hwrenderer/data/flatvertices.cpp
|
||||
rendering/hwrenderer/data/hw_viewpointbuffer.cpp
|
||||
rendering/hwrenderer/dynlights/hw_aabbtree.cpp
|
||||
rendering/hwrenderer/dynlights/hw_shadowmap.cpp
|
||||
rendering/hwrenderer/dynlights/hw_lightbuffer.cpp
|
||||
rendering/hwrenderer/models/hw_models.cpp
|
||||
rendering/hwrenderer/scene/hw_skydome.cpp
|
||||
rendering/hwrenderer/hw_entrypoint.cpp
|
||||
rendering/hwrenderer/hw_vertexbuilder.cpp
|
||||
rendering/hwrenderer/doom_aabbtree.cpp
|
||||
rendering/hwrenderer/hw_models.cpp
|
||||
rendering/hwrenderer/hw_postprocessshader.cpp
|
||||
rendering/hwrenderer/hw_precache.cpp
|
||||
rendering/hwrenderer/scene/hw_lighting.cpp
|
||||
rendering/hwrenderer/scene/hw_drawlistadd.cpp
|
||||
rendering/hwrenderer/scene/hw_renderstate.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocess.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocessshader.cpp
|
||||
rendering/hwrenderer/textures/hw_precache.cpp
|
||||
rendering/hwrenderer/utility/hw_clock.cpp
|
||||
rendering/hwrenderer/utility/hw_cvars.cpp
|
||||
rendering/hwrenderer/utility/hw_draw2d.cpp
|
||||
rendering/hwrenderer/utility/hw_lighting.cpp
|
||||
rendering/hwrenderer/utility/hw_shaderpatcher.cpp
|
||||
rendering/hwrenderer/utility/hw_vrmodes.cpp
|
||||
rendering/hwrenderer/scene/hw_setcolor.cpp
|
||||
maploader/edata.cpp
|
||||
maploader/specials.cpp
|
||||
maploader/maploader.cpp
|
||||
|
@ -1020,22 +984,17 @@ set (PCH_SOURCES
|
|||
intermission/intermission.cpp
|
||||
intermission/intermission_parse.cpp
|
||||
r_data/colormaps.cpp
|
||||
r_data/cycler.cpp
|
||||
r_data/gldefs.cpp
|
||||
r_data/a_dynlightdata.cpp
|
||||
r_data/r_translate.cpp
|
||||
r_data/sprites.cpp
|
||||
r_data/portalgroups.cpp
|
||||
r_data/voxels.cpp
|
||||
r_data/voxeldef.cpp
|
||||
r_data/r_canvastexture.cpp
|
||||
r_data/r_interpolate.cpp
|
||||
r_data/r_vanillatrans.cpp
|
||||
r_data/r_sections.cpp
|
||||
r_data/models/models_md3.cpp
|
||||
r_data/models/models_md2.cpp
|
||||
r_data/models/models_voxel.cpp
|
||||
r_data/models/models_ue1.cpp
|
||||
r_data/models/models_obj.cpp
|
||||
r_data/models.cpp
|
||||
scripting/vmiterators.cpp
|
||||
scripting/vmthunks.cpp
|
||||
scripting/vmthunks_actors.cpp
|
||||
|
@ -1077,12 +1036,14 @@ set (PCH_SOURCES
|
|||
common/textures/bitmap.cpp
|
||||
common/textures/m_png.cpp
|
||||
common/textures/texture.cpp
|
||||
common/textures/gametexture.cpp
|
||||
common/textures/image.cpp
|
||||
common/textures/imagetexture.cpp
|
||||
common/textures/texturemanager.cpp
|
||||
common/textures/multipatchtexturebuilder.cpp
|
||||
common/textures/skyboxtexture.cpp
|
||||
common/textures/animtexture.cpp
|
||||
common/textures/v_collection.cpp
|
||||
common/textures/formats/automaptexture.cpp
|
||||
common/textures/formats/brightmaptexture.cpp
|
||||
common/textures/formats/buildtexture.cpp
|
||||
|
@ -1102,6 +1063,13 @@ set (PCH_SOURCES
|
|||
common/textures/formats/tgatexture.cpp
|
||||
common/textures/formats/stbtexture.cpp
|
||||
common/textures/hires/hqresize.cpp
|
||||
common/models/models_md3.cpp
|
||||
common/models/models_md2.cpp
|
||||
common/models/models_voxel.cpp
|
||||
common/models/models_ue1.cpp
|
||||
common/models/models_obj.cpp
|
||||
common/models/model.cpp
|
||||
common/models/voxels.cpp
|
||||
common/console/c_commandline.cpp
|
||||
common/console/c_buttons.cpp
|
||||
common/console/c_bind.cpp
|
||||
|
@ -1125,6 +1093,7 @@ set (PCH_SOURCES
|
|||
common/utility/s_playlist.cpp
|
||||
common/utility/zstrformat.cpp
|
||||
common/utility/name.cpp
|
||||
common/utility/r_memory.cpp
|
||||
common/thirdparty/md5.cpp
|
||||
common/thirdparty/superfasthash.cpp
|
||||
common/filesystem/filesystem.cpp
|
||||
|
@ -1139,6 +1108,7 @@ set (PCH_SOURCES
|
|||
common/filesystem/file_whres.cpp
|
||||
common/filesystem/file_directory.cpp
|
||||
common/filesystem/resourcefile.cpp
|
||||
common/engine/cycler.cpp
|
||||
common/engine/stats.cpp
|
||||
common/engine/sc_man.cpp
|
||||
common/engine/palettecontainer.cpp
|
||||
|
@ -1151,7 +1121,38 @@ set (PCH_SOURCES
|
|||
common/objects/dobject.cpp
|
||||
common/objects/dobjgc.cpp
|
||||
common/objects/dobjtype.cpp
|
||||
common/rendering/v_framebuffer.cpp
|
||||
common/rendering/v_video.cpp
|
||||
common/rendering/r_thread.cpp
|
||||
common/rendering/r_videoscale.cpp
|
||||
common/rendering/hwrenderer/hw_draw2d.cpp
|
||||
common/rendering/hwrenderer/data/hw_clock.cpp
|
||||
common/rendering/hwrenderer/data/hw_skydome.cpp
|
||||
common/rendering/hwrenderer/data/flatvertices.cpp
|
||||
common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp
|
||||
common/rendering/hwrenderer/data/hw_modelvertexbuffer.cpp
|
||||
common/rendering/hwrenderer/data/hw_cvars.cpp
|
||||
common/rendering/hwrenderer/data/hw_vrmodes.cpp
|
||||
common/rendering/hwrenderer/data/hw_lightbuffer.cpp
|
||||
common/rendering/hwrenderer/data/hw_aabbtree.cpp
|
||||
common/rendering/hwrenderer/data/hw_shadowmap.cpp
|
||||
common/rendering/hwrenderer/data/hw_shaderpatcher.cpp
|
||||
common/rendering/hwrenderer/postprocessing/hw_postprocess.cpp
|
||||
common/rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
common/rendering/gl_load/gl_interface.cpp
|
||||
common/rendering/gl/gl_renderer.cpp
|
||||
common/rendering/gl/gl_stereo3d.cpp
|
||||
common/rendering/gl/gl_framebuffer.cpp
|
||||
common/rendering/gl/gl_renderstate.cpp
|
||||
common/rendering/gl/gl_renderbuffers.cpp
|
||||
common/rendering/gl/gl_postprocess.cpp
|
||||
common/rendering/gl/gl_postprocessstate.cpp
|
||||
common/rendering/gl/gl_debug.cpp
|
||||
common/rendering/gl/gl_buffers.cpp
|
||||
common/rendering/gl/gl_hwtexture.cpp
|
||||
common/rendering/gl/gl_samplers.cpp
|
||||
common/rendering/gl/gl_shader.cpp
|
||||
common/rendering/gl/gl_shaderprogram.cpp
|
||||
common/scripting/core/dictionary.cpp
|
||||
common/scripting/core/dynarrays.cpp
|
||||
common/scripting/core/symbols.cpp
|
||||
|
@ -1175,8 +1176,6 @@ set (PCH_SOURCES
|
|||
utility/nodebuilder/nodebuild_extract.cpp
|
||||
utility/nodebuilder/nodebuild_gl.cpp
|
||||
utility/nodebuilder/nodebuild_utility.cpp
|
||||
utility/m_bbox.cpp
|
||||
utility/v_collection.cpp
|
||||
)
|
||||
|
||||
if( ${HAVE_VM_JIT} )
|
||||
|
@ -1253,14 +1252,21 @@ include_directories( .
|
|||
common/textures/formats
|
||||
common/textures/hires
|
||||
common/textures
|
||||
common/models
|
||||
common/filesystem
|
||||
common/utility
|
||||
common/console
|
||||
common/engine
|
||||
common/menu
|
||||
common/fonts
|
||||
common/objects
|
||||
common/rendering
|
||||
common/rendering/hwrenderer/data
|
||||
common/rendering/gl_load
|
||||
common/rendering/gl
|
||||
common/rendering/vulkan/thirdparty
|
||||
common/rendering/polyrenderer/backend
|
||||
common/rendering/polyrenderer/drawers
|
||||
common/scripting/vm
|
||||
common/scripting/jit
|
||||
common/scripting/core
|
||||
|
@ -1276,6 +1282,7 @@ include_directories( .
|
|||
gamedata/textures
|
||||
gamedata/fonts
|
||||
rendering
|
||||
rendering/hwrenderer
|
||||
rendering/2d
|
||||
r_data
|
||||
sound
|
||||
|
@ -1286,12 +1293,12 @@ include_directories( .
|
|||
scripting
|
||||
scripting/zscript
|
||||
rendering
|
||||
rendering/vulkan/thirdparty
|
||||
../libraries/gdtoa
|
||||
../libraries/glslang/glslang/Public
|
||||
../libraries/glslang/spirv
|
||||
${CMAKE_BINARY_DIR}/libraries/gdtoa
|
||||
${SYSTEM_SOURCES_DIR} )
|
||||
${SYSTEM_SOURCES_DIR}
|
||||
)
|
||||
|
||||
add_dependencies( zdoom revision_check )
|
||||
|
||||
|
@ -1324,7 +1331,7 @@ if( MSVC )
|
|||
set_target_properties(zdoom PROPERTIES LINK_FLAGS ${LINKERSTUFF})
|
||||
|
||||
add_custom_command(TARGET zdoom POST_BUILD
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$<TARGET_FILE:zdoom>\"\;\#1
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\common\\platform\\win32\\manifest.xml\" -outputresource:\"$<TARGET_FILE:zdoom>\"\;\#1
|
||||
COMMENT "Adding manifest..."
|
||||
)
|
||||
|
||||
|
@ -1354,7 +1361,7 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
|||
# Need to enable intrinsics for these files.
|
||||
if( SSE_MATTERS )
|
||||
set_property( SOURCE
|
||||
rendering/polyrenderer/poly_all.cpp
|
||||
common/rendering/polyrenderer/poly_all.cpp
|
||||
rendering/swrenderer/r_all.cpp
|
||||
utility/palette.cpp
|
||||
utility/x86.cpp
|
||||
|
@ -1402,32 +1409,7 @@ source_group("Playsim\\Map Thinkers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE
|
|||
source_group("Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/.+")
|
||||
source_group("Rendering\\2D" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/2d/.+")
|
||||
source_group("Rendering\\Hardware Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/data/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/dynlights/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/models/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Postprocessing" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/postprocessing/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/renderer/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/scene/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/shaders/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/system/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/textures/.+")
|
||||
source_group("Rendering\\Hardware Renderer\\Utilities" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/hwrenderer/utility/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/system/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/renderer/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/shaders/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/textures/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\Third Party" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/thirdparty/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\Third Party\\Volk" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/thirdparty/volk/.+")
|
||||
source_group("Rendering\\Vulkan Renderer\\Third Party\\Vk_Mem_Alloc" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/vulkan/thirdparty/vk_mem_alloc.+")
|
||||
source_group("Rendering\\OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/data/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/dynlights/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/renderer/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/scene/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/shaders/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/system/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/textures/.+")
|
||||
source_group("Rendering\\OpenGL Renderer\\Utilities" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl/utility/.+")
|
||||
source_group("Rendering\\Software Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/swrenderer/.+")
|
||||
source_group("Rendering\\Software Renderer\\Drawers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/swrenderer/drawers/.+")
|
||||
source_group("Rendering\\Software Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/swrenderer/scene/.+")
|
||||
|
@ -1436,18 +1418,9 @@ source_group("Rendering\\Software Renderer\\Line" REGULAR_EXPRESSION "^${CMAKE_C
|
|||
source_group("Rendering\\Software Renderer\\Plane" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/swrenderer/plane/.+")
|
||||
source_group("Rendering\\Software Renderer\\Things" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/swrenderer/things/.+")
|
||||
source_group("Rendering\\Software Renderer\\Viewport" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/swrenderer/viewport/.+")
|
||||
source_group("Rendering\\Poly Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/polyrenderer/.+")
|
||||
source_group("Rendering\\Poly Renderer\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/polyrenderer/math/.+")
|
||||
source_group("Rendering\\Poly Renderer\\Drawers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/polyrenderer/drawers/.+")
|
||||
source_group("Rendering\\Poly Renderer\\Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/polyrenderer/backend/.+")
|
||||
source_group("Render Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r_data/.+")
|
||||
source_group("Render Data\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r_data/models/.+")
|
||||
source_group("Render Interface" FILES r_defs.h r_renderer.h r_sky.cpp r_sky.h r_state.h r_utility.cpp r_utility.h)
|
||||
source_group("Platforms\\POSIX Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/.+")
|
||||
source_group("Platforms\\Cocoa Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/cocoa/.+")
|
||||
source_group("Platforms\\OS X Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/.+")
|
||||
source_group("Platforms\\Unix Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/unix/.+")
|
||||
source_group("Platforms\\SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/sdl/.+")
|
||||
source_group("Platforms\\Win32 Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/win32/.+")
|
||||
source_group("Scripting\\Decorate frontend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/scripting/decorate/.+")
|
||||
source_group("Scripting\\ZScript frontend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/scripting/zscript/.+")
|
||||
|
@ -1464,6 +1437,7 @@ source_group("Common\\Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/
|
|||
source_group("Common\\Engine" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/engine/.+")
|
||||
source_group("Common\\2D" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/2d/.+")
|
||||
source_group("Common\\Objects" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/objects/.+")
|
||||
source_group("Common\\Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/menu/.+")
|
||||
source_group("Common\\Fonts" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/fonts/.+")
|
||||
source_group("Common\\File System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/.+")
|
||||
source_group("Common\\Scripting" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/.+")
|
||||
|
@ -1473,8 +1447,28 @@ source_group("Common\\Scripting\\Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_S
|
|||
source_group("Common\\Scripting\\Core" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/core/.+")
|
||||
source_group("Common\\Scripting\\JIT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/jit/.+")
|
||||
source_group("Common\\Scripting\\VM" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/scripting/vm/.+")
|
||||
source_group("Common\\Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/.+")
|
||||
source_group("Common\\Rendering\\OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rendering/gl_load/.+")
|
||||
source_group("Common\\Platforms\\Cocoa Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/cocoa/.+")
|
||||
source_group("Common\\Platforms\\OS X Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/osx/.+")
|
||||
source_group("Common\\Platforms\\Unix Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/unix/.+")
|
||||
source_group("Common\\Platforms\\SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/sdl/.+")
|
||||
source_group("Common\\Platforms\\Win32 Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/win32/.+")
|
||||
source_group("Common\\Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/.+")
|
||||
source_group("Common\\Rendering\\Hardware Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/.+")
|
||||
source_group("Common\\Rendering\\Hardware Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/data/.+")
|
||||
source_group("Common\\Rendering\\Hardware Renderer\\Postprocessing" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/postprocessing/.+")
|
||||
source_group("Common\\Rendering\\OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl_load/.+")
|
||||
source_group("Common\\Rendering\\OpenGL Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/system/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/renderer/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/shaders/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/textures/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\Third Party" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/thirdparty/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\Third Party\\Volk" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/thirdparty/volk/.+")
|
||||
source_group("Common\\Rendering\\Vulkan Renderer\\Third Party\\Vk_Mem_Alloc" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/thirdparty/vk_mem_alloc.+")
|
||||
source_group("Common\\Rendering\\Poly Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/polyrenderer/.+")
|
||||
source_group("Common\\Rendering\\Poly Renderer\\Drawers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/polyrenderer/drawers/.+")
|
||||
source_group("Common\\Rendering\\Poly Renderer\\Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/polyrenderer/backend/.+")
|
||||
source_group("Common\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/models/.+")
|
||||
source_group("Common\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/.+")
|
||||
source_group("Common\\Textures\\Hires" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/.+")
|
||||
source_group("Common\\Textures\\Hires\\HQ Resize" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/hqnx/.+")
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "p_blockmap.h"
|
||||
#include "g_game.h"
|
||||
#include "v_video.h"
|
||||
#include "d_main.h"
|
||||
#include "v_draw.h"
|
||||
|
||||
#include "m_cheat.h"
|
||||
#include "c_dispatch.h"
|
||||
|
@ -988,7 +990,7 @@ class DAutomap :public DAutomapBase
|
|||
|
||||
void calcMinMaxMtoF();
|
||||
|
||||
void DrawMarker(FTexture *tex, double x, double y, int yadjust,
|
||||
void DrawMarker(FGameTexture *tex, double x, double y, int yadjust,
|
||||
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle);
|
||||
|
||||
void rotatePoint(double *x, double *y);
|
||||
|
@ -1235,12 +1237,12 @@ void DAutomap::ScrollParchment (double dmapx, double dmapy)
|
|||
|
||||
if (mapback.isValid())
|
||||
{
|
||||
FTexture *backtex = TexMan.GetTexture(mapback);
|
||||
auto backtex = TexMan.GetGameTexture(mapback);
|
||||
|
||||
if (backtex != nullptr)
|
||||
{
|
||||
int pwidth = backtex->GetDisplayWidth();
|
||||
int pheight = backtex->GetDisplayHeight();
|
||||
int pwidth = int(backtex->GetDisplayWidth() * CleanXfac);
|
||||
int pheight = int(backtex->GetDisplayHeight() * CleanYfac);
|
||||
|
||||
while(mapxstart > 0)
|
||||
mapxstart -= pwidth;
|
||||
|
@ -1588,11 +1590,11 @@ void DAutomap::clearFB (const AMColor &color)
|
|||
}
|
||||
else
|
||||
{
|
||||
FTexture *backtex = TexMan.GetTexture(mapback);
|
||||
auto backtex = TexMan.GetGameTexture(mapback);
|
||||
if (backtex != nullptr)
|
||||
{
|
||||
int pwidth = backtex->GetDisplayWidth();
|
||||
int pheight = backtex->GetDisplayHeight();
|
||||
int pwidth = int(backtex->GetDisplayWidth() * CleanXfac);
|
||||
int pheight = int(backtex->GetDisplayHeight() * CleanYfac);
|
||||
int x, y;
|
||||
|
||||
//blit the automap background to the screen.
|
||||
|
@ -1600,7 +1602,7 @@ void DAutomap::clearFB (const AMColor &color)
|
|||
{
|
||||
for (x = int(mapxstart); x < f_w; x += pwidth)
|
||||
{
|
||||
DrawTexture(twod, backtex, x, y, DTA_ClipBottom, f_h, DTA_TopOffset, 0, DTA_LeftOffset, 0, TAG_DONE);
|
||||
DrawTexture(twod, backtex, x, y, DTA_ClipBottom, f_h, DTA_TopOffset, 0, DTA_LeftOffset, 0, DTA_DestWidth, pwidth, DTA_DestHeight, pheight, TAG_DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2139,7 +2141,7 @@ void DAutomap::drawSubsectors()
|
|||
// is necessary in order to best reproduce Doom's original lighting.
|
||||
double fadelevel;
|
||||
|
||||
if (vid_rendermode != 4 || primaryLevel->lightMode == ELightMode::Doom || primaryLevel->lightMode == ELightMode::ZDoomSoftware || primaryLevel->lightMode == ELightMode::DoomSoftware)
|
||||
if (!V_IsHardwareRenderer() || primaryLevel->lightMode == ELightMode::Doom || primaryLevel->lightMode == ELightMode::ZDoomSoftware || primaryLevel->lightMode == ELightMode::DoomSoftware)
|
||||
{
|
||||
double map = (NUMCOLORMAPS * 2.) - ((floorlight + 12) * (NUMCOLORMAPS / 128.));
|
||||
fadelevel = clamp((map - 12) / NUMCOLORMAPS, 0.0, 1.0);
|
||||
|
@ -2150,7 +2152,7 @@ void DAutomap::drawSubsectors()
|
|||
fadelevel = 1. - clamp(floorlight, 0, 255) / 255.f;
|
||||
}
|
||||
|
||||
twod->AddPoly(TexMan.GetTexture(maptex, true),
|
||||
twod->AddPoly(TexMan.GetGameTexture(maptex, true),
|
||||
&points[0], points.Size(),
|
||||
originx, originy,
|
||||
scale / scalex,
|
||||
|
@ -2908,7 +2910,7 @@ void DAutomap::drawThings ()
|
|||
|
||||
if (am_showthingsprites > 0 && t->sprite > 0)
|
||||
{
|
||||
FTexture *texture = nullptr;
|
||||
FGameTexture *texture = nullptr;
|
||||
spriteframe_t *frame;
|
||||
int rotation = 0;
|
||||
|
||||
|
@ -2928,7 +2930,7 @@ void DAutomap::drawThings ()
|
|||
rotation = int((angle.Normalized360() * (16. / 360.)).Degrees);
|
||||
|
||||
const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0];
|
||||
texture = TexMan.GetTexture(textureID, true);
|
||||
texture = TexMan.GetGameTexture(textureID, true);
|
||||
}
|
||||
|
||||
if (texture == nullptr) goto drawTriangle; // fall back to standard display if no sprite can be found.
|
||||
|
@ -3023,7 +3025,7 @@ void DAutomap::drawThings ()
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void DAutomap::DrawMarker (FTexture *tex, double x, double y, int yadjust,
|
||||
void DAutomap::DrawMarker (FGameTexture *tex, double x, double y, int yadjust,
|
||||
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
|
||||
{
|
||||
if (tex == nullptr || !tex->isValid())
|
||||
|
@ -3035,8 +3037,8 @@ void DAutomap::DrawMarker (FTexture *tex, double x, double y, int yadjust,
|
|||
rotatePoint (&x, &y);
|
||||
}
|
||||
DrawTexture(twod, tex, CXMTOF(x) + f_x, CYMTOF(y) + yadjust + f_y,
|
||||
DTA_DestWidthF, tex->GetDisplayWidthDouble() * CleanXfac * xscale,
|
||||
DTA_DestHeightF, tex->GetDisplayHeightDouble() * CleanYfac * yscale,
|
||||
DTA_DestWidthF, tex->GetDisplayWidth() * CleanXfac * xscale,
|
||||
DTA_DestHeightF, tex->GetDisplayHeight() * CleanYfac * yscale,
|
||||
DTA_ClipTop, f_y,
|
||||
DTA_ClipBottom, f_y + f_h,
|
||||
DTA_ClipLeft, f_x,
|
||||
|
@ -3072,7 +3074,7 @@ void DAutomap::drawMarks ()
|
|||
|
||||
if (font == nullptr)
|
||||
{
|
||||
DrawMarker(TexMan.GetTexture(marknums[i], true), markpoints[i].x, markpoints[i].y, -3, 0,
|
||||
DrawMarker(TexMan.GetGameTexture(marknums[i], true), markpoints[i].x, markpoints[i].y, -3, 0,
|
||||
1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]);
|
||||
}
|
||||
else
|
||||
|
@ -3114,18 +3116,18 @@ void DAutomap::drawAuthorMarkers ()
|
|||
}
|
||||
|
||||
FTextureID picnum;
|
||||
FTexture *tex;
|
||||
FGameTexture *tex;
|
||||
uint16_t flip = 0;
|
||||
|
||||
if (mark->picnum.isValid())
|
||||
{
|
||||
tex = TexMan.GetTexture(mark->picnum, true);
|
||||
tex = TexMan.GetGameTexture(mark->picnum, true);
|
||||
if (tex->GetRotations() != 0xFFFF)
|
||||
{
|
||||
spriteframe_t *sprframe = &SpriteFrames[tex->GetRotations()];
|
||||
picnum = sprframe->Texture[0];
|
||||
flip = sprframe->Flip & 1;
|
||||
tex = TexMan.GetTexture(picnum);
|
||||
tex = TexMan.GetGameTexture(picnum);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3140,7 +3142,7 @@ void DAutomap::drawAuthorMarkers ()
|
|||
spriteframe_t *sprframe = &SpriteFrames[sprdef->spriteframes + mark->frame];
|
||||
picnum = sprframe->Texture[0];
|
||||
flip = sprframe->Flip & 1;
|
||||
tex = TexMan.GetTexture(picnum);
|
||||
tex = TexMan.GetGameTexture(picnum);
|
||||
}
|
||||
}
|
||||
auto it = Level->GetActorIterator(mark->args[0]);
|
||||
|
|
|
@ -37,11 +37,15 @@
|
|||
#include "vm.h"
|
||||
#include "c_cvars.h"
|
||||
#include "v_draw.h"
|
||||
#include "v_video.h"
|
||||
#include "fcolormap.h"
|
||||
|
||||
F2DDrawer* twod;
|
||||
static F2DDrawer drawer;
|
||||
F2DDrawer* twod = &drawer;
|
||||
|
||||
EXTERN_CVAR(Float, transsouls)
|
||||
CVAR(Float, classic_scaling_factor, 1.0, CVAR_ARCHIVE)
|
||||
CVAR(Float, classic_scaling_pixelaspect, 1.2f, CVAR_ARCHIVE)
|
||||
|
||||
IMPLEMENT_CLASS(DShape2DTransform, false, false)
|
||||
|
||||
|
@ -234,7 +238,7 @@ void F2DDrawer::AddIndices(int firstvert, TArray<int> &v)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool F2DDrawer::SetStyle(FTexture *tex, DrawParms &parms, PalEntry &vertexcolor, RenderCommand &quad)
|
||||
bool F2DDrawer::SetStyle(FGameTexture *tex, DrawParms &parms, PalEntry &vertexcolor, RenderCommand &quad)
|
||||
{
|
||||
FRenderStyle style = parms.style;
|
||||
float alpha;
|
||||
|
@ -390,9 +394,10 @@ void F2DDrawer::SetColorOverlay(PalEntry color, float alpha, PalEntry &vertexcol
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
||||
void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
||||
{
|
||||
if (parms.style.BlendOp == STYLEOP_None) return; // not supposed to be drawn.
|
||||
assert(img && img->isValid());
|
||||
|
||||
double xscale = parms.destwidth / parms.texwidth;
|
||||
double yscale = parms.destheight / parms.texheight;
|
||||
|
@ -472,7 +477,7 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddShape( FTexture *img, DShape2D *shape, DrawParms &parms )
|
||||
void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
||||
{
|
||||
// [MK] bail out if vertex/coord array sizes are mismatched
|
||||
if ( shape->mVertices.Size() != shape->mCoords.Size() )
|
||||
|
@ -550,12 +555,11 @@ void F2DDrawer::AddShape( FTexture *img, DShape2D *shape, DrawParms &parms )
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double fadelevel,
|
||||
uint32_t *indices, size_t indexcount)
|
||||
{
|
||||
|
||||
RenderCommand poly;
|
||||
|
||||
poly.mType = DrawTypeTriangles;
|
||||
|
@ -630,7 +634,7 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
|
||||
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
|
||||
{
|
||||
RenderCommand dg = {};
|
||||
int method = 0;
|
||||
|
@ -677,7 +681,20 @@ void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned in
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin)
|
||||
float F2DDrawer::GetClassicFlatScalarWidth()
|
||||
{
|
||||
float ar = 4.f / 3.f / (float)ActiveRatio((float)screen->GetWidth(), (float)screen->GetHeight());
|
||||
float sw = 320.f * classic_scaling_factor / (float)screen->GetWidth() / ar;
|
||||
return sw;
|
||||
}
|
||||
|
||||
float F2DDrawer::GetClassicFlatScalarHeight()
|
||||
{
|
||||
float sh = 240.f / classic_scaling_pixelaspect * classic_scaling_factor / (float)screen->GetHeight();
|
||||
return sh;
|
||||
}
|
||||
|
||||
void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin, double flatscale)
|
||||
{
|
||||
float fU1, fU2, fV1, fV2;
|
||||
|
||||
|
@ -690,27 +707,100 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *
|
|||
dg.mTexture = src;
|
||||
dg.mFlags = DTF_Wrap;
|
||||
|
||||
// scaling is not used here.
|
||||
if (!local_origin)
|
||||
{
|
||||
fU1 = float(left) / src->GetDisplayWidth();
|
||||
fV1 = float(top) / src->GetDisplayHeight();
|
||||
fU2 = float(right) / src->GetDisplayWidth();
|
||||
fV2 = float(bottom) / src->GetDisplayHeight();
|
||||
}
|
||||
else
|
||||
float fs = 1.f / float(flatscale);
|
||||
bool flipc = false;
|
||||
|
||||
float sw = GetClassicFlatScalarWidth();
|
||||
float sh = GetClassicFlatScalarHeight();
|
||||
|
||||
switch (local_origin)
|
||||
{
|
||||
case 0:
|
||||
fU1 = float(left) / (float)src->GetDisplayWidth() * fs;
|
||||
fV1 = float(top) / (float)src->GetDisplayHeight() * fs;
|
||||
fU2 = float(right) / (float)src->GetDisplayWidth() * fs;
|
||||
fV2 = float(bottom) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
fU1 = 0;
|
||||
fV1 = 0;
|
||||
fU2 = float(right - left) / src->GetDisplayWidth();
|
||||
fV2 = float(bottom - top) / src->GetDisplayHeight();
|
||||
fU2 = float(right - left) / (float)src->GetDisplayWidth() * fs;
|
||||
fV2 = float(bottom - top) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
// The following are for drawing frames with elements of pnly one orientation
|
||||
case 2: // flip vertically
|
||||
fU1 = 0;
|
||||
fV2 = 0;
|
||||
fU2 = float(right - left) / (float)src->GetDisplayWidth() * fs;
|
||||
fV1 = float(bottom - top) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
case 3: // flip horizontally
|
||||
fU2 = 0;
|
||||
fV1 = 0;
|
||||
fU1 = float(right - left) / (float)src->GetDisplayWidth() * fs;
|
||||
fV2 = float(bottom - top) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
case 4: // flip vertically and horizontally
|
||||
fU2 = 0;
|
||||
fV2 = 0;
|
||||
fU1 = float(right - left) / (float)src->GetDisplayWidth() * fs;
|
||||
fV1 = float(bottom - top) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
|
||||
case 5: // flip coordinates
|
||||
fU1 = 0;
|
||||
fV1 = 0;
|
||||
fU2 = float(bottom - top) / (float)src->GetDisplayWidth() * fs;
|
||||
fV2 = float(right - left) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
case 6: // flip coordinates and vertically
|
||||
fU2 = 0;
|
||||
fV1 = 0;
|
||||
fU1 = float(bottom - top) / (float)src->GetDisplayWidth() * fs;
|
||||
fV2 = float(right - left) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
case 7: // flip coordinates and horizontally
|
||||
fU1 = 0;
|
||||
fV2 = 0;
|
||||
fU2 = float(bottom - top) / (float)src->GetDisplayWidth() * fs;
|
||||
fV1 = float(right - left) / (float)src->GetDisplayHeight() * fs;
|
||||
break;
|
||||
|
||||
case -1: // classic flat scaling
|
||||
fU1 = float(left) / (float)src->GetDisplayWidth() * fs * sw;
|
||||
fV1 = float(top) / (float)src->GetDisplayHeight() * fs * sh;
|
||||
fU2 = float(right) / (float)src->GetDisplayWidth() * fs * sw;
|
||||
fV2 = float(bottom) / (float)src->GetDisplayHeight() * fs * sh;
|
||||
break;
|
||||
|
||||
case -2: // classic scaling for screen bevel
|
||||
fU1 = 0;
|
||||
fV1 = 0;
|
||||
fU2 = float(right - left) / (float)src->GetDisplayWidth() * fs * sw;
|
||||
fV2 = float(bottom - top) / (float)src->GetDisplayHeight() * fs * sh;
|
||||
break;
|
||||
}
|
||||
dg.mVertIndex = (int)mVertices.Reserve(4);
|
||||
auto ptr = &mVertices[dg.mVertIndex];
|
||||
|
||||
ptr->Set(left, top, 0, fU1, fV1, 0xffffffff); ptr++;
|
||||
ptr->Set(left, bottom, 0, fU1, fV2, 0xffffffff); ptr++;
|
||||
ptr->Set(right, top, 0, fU2, fV1, 0xffffffff); ptr++;
|
||||
if (local_origin < 4)
|
||||
{
|
||||
ptr->Set(left, bottom, 0, fU1, fV2, 0xffffffff); ptr++;
|
||||
ptr->Set(right, top, 0, fU2, fV1, 0xffffffff); ptr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->Set(left, bottom, 0, fU2, fV1, 0xffffffff); ptr++;
|
||||
ptr->Set(right, top, 0, fU1, fV2, 0xffffffff); ptr++;
|
||||
}
|
||||
ptr->Set(right, bottom, 0, fU2, fV2, 0xffffffff); ptr++;
|
||||
dg.mIndexIndex = mIndices.Size();
|
||||
dg.mIndexCount += 6;
|
||||
|
@ -721,11 +811,11 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *
|
|||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color, FRenderStyle *style)
|
||||
void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color, FRenderStyle *style, bool prepend)
|
||||
{
|
||||
RenderCommand dg;
|
||||
|
||||
|
@ -741,7 +831,13 @@ void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color, F
|
|||
dg.mIndexIndex = mIndices.Size();
|
||||
dg.mIndexCount += 6;
|
||||
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);
|
||||
AddCommand(&dg);
|
||||
if (!prepend) AddCommand(&dg);
|
||||
else
|
||||
{
|
||||
// Only needed by Raze's fullscreen blends because they are being calculated late when half of the 2D content has already been submitted,
|
||||
// This ensures they are below the HUD, not above it.
|
||||
mData.Insert(0, dg);
|
||||
}
|
||||
}
|
||||
|
||||
void F2DDrawer::ClearScreen(PalEntry color)
|
||||
|
@ -755,7 +851,7 @@ void F2DDrawer::ClearScreen(PalEntry color)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddLine(float x1, float y1, float x2, float y2, int clipx1, int clipy1, int clipx2, int clipy2, uint32_t color, uint8_t alpha)
|
||||
void F2DDrawer::AddLine(double x1, double y1, double x2, double y2, int clipx1, int clipy1, int clipx2, int clipy2, uint32_t color, uint8_t alpha)
|
||||
{
|
||||
PalEntry p = (PalEntry)color;
|
||||
p.a = alpha;
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
int mIndexIndex;
|
||||
int mIndexCount;
|
||||
|
||||
FTexture *mTexture;
|
||||
FGameTexture *mTexture;
|
||||
int mTranslationId;
|
||||
PalEntry mSpecialColormap[2];
|
||||
int mScissor[4];
|
||||
|
@ -170,27 +170,29 @@ public:
|
|||
void AddIndices(int firstvert, int count, ...);
|
||||
private:
|
||||
void AddIndices(int firstvert, TArray<int> &v);
|
||||
bool SetStyle(FTexture *tex, DrawParms &parms, PalEntry &color0, RenderCommand &quad);
|
||||
bool SetStyle(FGameTexture *tex, DrawParms &parms, PalEntry &color0, RenderCommand &quad);
|
||||
void SetColorOverlay(PalEntry color, float alpha, PalEntry &vertexcolor, PalEntry &overlaycolor);
|
||||
|
||||
public:
|
||||
void AddTexture(FTexture *img, DrawParms &parms);
|
||||
void AddShape(FTexture *img, DShape2D *shape, DrawParms &parms);
|
||||
void AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
float GetClassicFlatScalarWidth();
|
||||
float GetClassicFlatScalarHeight();
|
||||
void AddTexture(FGameTexture* img, DrawParms& parms);
|
||||
void AddShape(FGameTexture *img, DShape2D *shape, DrawParms &parms);
|
||||
void AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double lightlevel, uint32_t *indices, size_t indexcount);
|
||||
void AddPoly(FTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
|
||||
int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin = false);
|
||||
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0);
|
||||
|
||||
void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr);
|
||||
void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr, bool prepend = false);
|
||||
void ClearScreen(PalEntry color = 0xff000000);
|
||||
void AddDim(PalEntry color, float damount, int x1, int y1, int w, int h);
|
||||
void AddClear(int left, int top, int right, int bottom, int palcolor, uint32_t color);
|
||||
|
||||
|
||||
void AddLine(float x1, float y1, float x2, float y2, int cx, int cy, int cx2, int cy2, uint32_t color, uint8_t alpha = 255);
|
||||
void AddLine(double x1, double y1, double x2, double y2, int cx, int cy, int cx2, int cy2, uint32_t color, uint8_t alpha = 255);
|
||||
void AddThickLine(int x1, int y1, int x2, int y2, double thickness, uint32_t color, uint8_t alpha = 255);
|
||||
void AddPixel(int x1, int y1, uint32_t color);
|
||||
|
||||
|
@ -198,7 +200,7 @@ public:
|
|||
int GetWidth() const { return Width; }
|
||||
int GetHeight() const { return Height; }
|
||||
void SetSize(int w, int h) { Width = w; Height = h; }
|
||||
void Begin() { isIn2D = true; }
|
||||
void Begin(int w, int h) { isIn2D = true; Width = w; Height = h; }
|
||||
void End() { isIn2D = false; }
|
||||
bool HasBegun2D() { return isIn2D; }
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
EXTERN_CVAR(Int, vid_aspect)
|
||||
EXTERN_CVAR(Int, uiscale)
|
||||
CVAR(Bool, ui_screenborder_classic_scaling, true, CVAR_ARCHIVE)
|
||||
|
||||
// Helper for ActiveRatio and CheckRatio. Returns the forced ratio type, or -1 if none.
|
||||
int ActiveFakeRatio(int width, int height)
|
||||
|
@ -180,7 +181,7 @@ int CleanXfac_1, CleanYfac_1, CleanWidth_1, CleanHeight_1;
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DrawTexture(F2DDrawer *drawer, FTexture* img, double x, double y, int tags_first, ...)
|
||||
void DrawTexture(F2DDrawer *drawer, FGameTexture* img, double x, double y, int tags_first, ...)
|
||||
{
|
||||
Va_List tags;
|
||||
va_start(tags.list, tags_first);
|
||||
|
@ -203,7 +204,7 @@ void DrawTexture(F2DDrawer *drawer, FTexture* img, double x, double y, int tags_
|
|||
|
||||
int ListGetInt(VMVa_List &tags);
|
||||
|
||||
static void DrawTexture(F2DDrawer *drawer, FTexture *img, double x, double y, VMVa_List &args)
|
||||
static void DrawTexture(F2DDrawer *drawer, FGameTexture *img, double x, double y, VMVa_List &args)
|
||||
{
|
||||
DrawParms parms;
|
||||
uint32_t tag = ListGetInt(args);
|
||||
|
@ -224,7 +225,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
|
|||
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
||||
FTexture *tex = TexMan.ByIndex(texid, animate);
|
||||
auto tex = TexMan.GameByIndex(texid, animate);
|
||||
VMVa_List args = { param + 4, 0, numparam - 5, va_reginfo + 4 };
|
||||
DrawTexture(twod, tex, x, y, args);
|
||||
return 0;
|
||||
|
@ -236,7 +237,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DrawShape(F2DDrawer *drawer, FTexture *img, DShape2D *shape, int tags_first, ...)
|
||||
void DrawShape(F2DDrawer *drawer, FGameTexture *img, DShape2D *shape, int tags_first, ...)
|
||||
{
|
||||
Va_List tags;
|
||||
va_start(tags.list, tags_first);
|
||||
|
@ -248,7 +249,7 @@ void DrawShape(F2DDrawer *drawer, FTexture *img, DShape2D *shape, int tags_first
|
|||
drawer->AddShape(img, shape, parms);
|
||||
}
|
||||
|
||||
void DrawShape(F2DDrawer *drawer, FTexture *img, DShape2D *shape, VMVa_List &args)
|
||||
void DrawShape(F2DDrawer *drawer, FGameTexture *img, DShape2D *shape, VMVa_List &args)
|
||||
{
|
||||
DrawParms parms;
|
||||
uint32_t tag = ListGetInt(args);
|
||||
|
@ -269,7 +270,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawShape)
|
|||
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
||||
FTexture *tex = TexMan.ByIndex(texid, animate);
|
||||
auto tex = TexMan.GameByIndex(texid, animate);
|
||||
VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 };
|
||||
|
||||
DrawShape(twod, tex, shape, args);
|
||||
|
@ -334,7 +335,7 @@ DEFINE_ACTION_FUNCTION(_Screen, GetClipRect)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double xx, double yy)
|
||||
bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, double xx, double yy)
|
||||
{
|
||||
auto GetWidth = [=]() { return drawer->GetWidth(); };
|
||||
auto GetHeight = [=]() {return drawer->GetHeight(); };
|
||||
|
@ -342,8 +343,8 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double
|
|||
{
|
||||
parms->x = xx;
|
||||
parms->y = yy;
|
||||
parms->texwidth = img->GetDisplayWidthDouble();
|
||||
parms->texheight = img->GetDisplayHeightDouble();
|
||||
parms->texwidth = img->GetDisplayWidth();
|
||||
parms->texheight = img->GetDisplayHeight();
|
||||
if (parms->top == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->top = img->GetDisplayTopOffset();
|
||||
|
@ -354,11 +355,11 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double
|
|||
}
|
||||
if (parms->destwidth == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->destwidth = img->GetDisplayWidthDouble();
|
||||
parms->destwidth = img->GetDisplayWidth();
|
||||
}
|
||||
if (parms->destheight == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->destheight = img->GetDisplayHeightDouble();
|
||||
parms->destheight = img->GetDisplayHeight();
|
||||
}
|
||||
|
||||
switch (parms->cleanmode)
|
||||
|
@ -387,8 +388,8 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double
|
|||
case DTA_FullscreenEx:
|
||||
{
|
||||
double aspect;
|
||||
double srcwidth = img->GetDisplayWidthDouble();
|
||||
double srcheight = img->GetDisplayHeightDouble();
|
||||
double srcwidth = img->GetDisplayWidth();
|
||||
double srcheight = img->GetDisplayHeight();
|
||||
int autoaspect = parms->fsscalemode;
|
||||
if (srcheight == 200) aspect = srcwidth / 240.;
|
||||
else if (srcheight == 400) aspect = srcwidth / 480;
|
||||
|
@ -533,7 +534,7 @@ static inline FSpecialColormap * ListGetSpecialColormap(VMVa_List &tags)
|
|||
//==========================================================================
|
||||
|
||||
template<class T>
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y, uint32_t tag, T& tags, DrawParms *parms, bool fortext)
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double y, uint32_t tag, T& tags, DrawParms *parms, bool fortext)
|
||||
{
|
||||
INTBOOL boolval;
|
||||
int intval;
|
||||
|
@ -726,8 +727,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (img == NULL) return false;
|
||||
parms->cleanmode = DTA_Fullscreen;
|
||||
parms->fsscalemode = (uint8_t)twod->fullscreenautoaspect;
|
||||
parms->virtWidth = img->GetDisplayWidthDouble();
|
||||
parms->virtHeight = img->GetDisplayHeightDouble();
|
||||
parms->virtWidth = img->GetDisplayWidth();
|
||||
parms->virtHeight = img->GetDisplayHeight();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -740,8 +741,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (img == NULL) return false;
|
||||
parms->cleanmode = DTA_Fullscreen;
|
||||
parms->fsscalemode = (uint8_t)intval;
|
||||
parms->virtWidth = img->GetDisplayWidthDouble();
|
||||
parms->virtHeight = img->GetDisplayHeightDouble();
|
||||
parms->virtWidth = img->GetDisplayWidth();
|
||||
parms->virtHeight = img->GetDisplayHeight();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -787,19 +788,19 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
break;
|
||||
|
||||
case DTA_SrcX:
|
||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidthDouble();
|
||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidth();
|
||||
break;
|
||||
|
||||
case DTA_SrcY:
|
||||
parms->srcy = ListGetDouble(tags) / img->GetDisplayHeightDouble();
|
||||
parms->srcy = ListGetDouble(tags) / img->GetDisplayHeight();
|
||||
break;
|
||||
|
||||
case DTA_SrcWidth:
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetDisplayWidthDouble();
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetDisplayWidth();
|
||||
break;
|
||||
|
||||
case DTA_SrcHeight:
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetDisplayHeightDouble();
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetDisplayHeight();
|
||||
break;
|
||||
|
||||
case DTA_TopOffset:
|
||||
|
@ -831,8 +832,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
{
|
||||
parms->left = img->GetDisplayWidthDouble() * 0.5;
|
||||
parms->top = img->GetDisplayHeightDouble() * 0.5;
|
||||
parms->left = img->GetDisplayWidth() * 0.5;
|
||||
parms->top = img->GetDisplayHeight() * 0.5;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -841,8 +842,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
{
|
||||
parms->left = img->GetDisplayWidthDouble() * 0.5;
|
||||
parms->top = img->GetDisplayHeightDouble();
|
||||
parms->left = img->GetDisplayWidth() * 0.5;
|
||||
parms->top = img->GetDisplayHeight();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1040,8 +1041,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
}
|
||||
// explicitly instantiate both versions for v_text.cpp.
|
||||
|
||||
template bool ParseDrawTextureTags<Va_List>(F2DDrawer* drawer, FTexture *img, double x, double y, uint32_t tag, Va_List& tags, DrawParms *parms, bool fortext);
|
||||
template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FTexture *img, double x, double y, uint32_t tag, VMVa_List& tags, DrawParms *parms, bool fortext);
|
||||
template bool ParseDrawTextureTags<Va_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, Va_List& tags, DrawParms *parms, bool fortext);
|
||||
template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, VMVa_List& tags, DrawParms *parms, bool fortext);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -1133,7 +1134,7 @@ void VirtualToRealCoordsInt(F2DDrawer *drawer, int &x, int &y, int &w, int &h,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FillBorder (F2DDrawer *drawer, FTexture *img)
|
||||
void FillBorder (F2DDrawer *drawer, FGameTexture *img)
|
||||
{
|
||||
auto Width = drawer->GetWidth();
|
||||
auto Height = drawer->GetHeight();
|
||||
|
@ -1161,10 +1162,11 @@ void FillBorder (F2DDrawer *drawer, FTexture *img)
|
|||
|
||||
if (img != NULL)
|
||||
{
|
||||
drawer->AddFlatFill(0, 0, Width, bordtop, img); // Top
|
||||
drawer->AddFlatFill(0, bordtop, bordleft, Height - bordbottom, img); // Left
|
||||
drawer->AddFlatFill(Width - bordright, bordtop, Width, Height - bordbottom, img); // Right
|
||||
drawer->AddFlatFill(0, Height - bordbottom, Width, Height, img); // Bottom
|
||||
int filltype = (ui_screenborder_classic_scaling) ? -1 : 0;
|
||||
drawer->AddFlatFill(0, 0, Width, bordtop, img, filltype); // Top
|
||||
drawer->AddFlatFill(0, bordtop, bordleft, Height - bordbottom, img, filltype); // Left
|
||||
drawer->AddFlatFill(Width - bordright, bordtop, Width, Height - bordbottom, img, filltype); // Right
|
||||
drawer->AddFlatFill(0, Height - bordbottom, Width, Height, img, filltype); // Bottom
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1222,7 +1224,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Screen, DrawThickLine, DrawThickLine)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// DCanvas :: Clear
|
||||
// ClearRect
|
||||
//
|
||||
// Set an area to a specified color.
|
||||
//
|
||||
|
@ -1281,7 +1283,7 @@ DEFINE_ACTION_FUNCTION(_Screen, Clear)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// DCanvas :: Dim
|
||||
// DoDim
|
||||
//
|
||||
// Applies a colored overlay to an area of the screen.
|
||||
//
|
||||
|
@ -1351,9 +1353,10 @@ DEFINE_ACTION_FUNCTION(_Screen, Dim)
|
|||
|
||||
void DrawBorder (F2DDrawer *drawer, FTextureID picnum, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int filltype = (ui_screenborder_classic_scaling) ? -1 : 0;
|
||||
if (picnum.isValid())
|
||||
{
|
||||
drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetTexture(picnum, false));
|
||||
drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetGameTexture(picnum, false), filltype);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1384,3 +1387,9 @@ void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, in
|
|||
twod->AddColorOnlyQuad(right, top - offset, offset, height + 2 * offset, color);
|
||||
}
|
||||
|
||||
void V_CalcCleanFacs(int designwidth, int designheight, int realwidth, int realheight, int* cleanx, int* cleany, int* _cx1, int* _cx2)
|
||||
{
|
||||
if (designheight < 240 && realheight >= 480) designheight = 240;
|
||||
*cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight);
|
||||
}
|
||||
|
||||
|
|
|
@ -203,22 +203,22 @@ inline int active_con_scale(F2DDrawer *drawer)
|
|||
#endif
|
||||
|
||||
template<class T>
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture* img, double x, double y, uint32_t tag, T& tags, DrawParms* parms, bool fortext);
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture* img, double x, double y, uint32_t tag, T& tags, DrawParms* parms, bool fortext);
|
||||
|
||||
template<class T>
|
||||
void DrawTextCommon(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double y, const T* string, DrawParms& parms);
|
||||
bool SetTextureParms(F2DDrawer *drawer, DrawParms* parms, FTexture* img, double x, double y);
|
||||
bool SetTextureParms(F2DDrawer *drawer, DrawParms* parms, FGameTexture* img, double x, double y);
|
||||
|
||||
void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char* string, int tag_first, ...);
|
||||
void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char32_t* string, int tag_first, ...);
|
||||
void DrawChar(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, int character, int tag_first, ...);
|
||||
void DrawTexture(F2DDrawer* drawer, FTexture* img, double x, double y, int tags_first, ...);
|
||||
|
||||
void DrawTexture(F2DDrawer* drawer, FGameTexture* img, double x, double y, int tags_first, ...);
|
||||
|
||||
void DoDim(F2DDrawer* drawer, PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr);
|
||||
void Dim(F2DDrawer* drawer, PalEntry color, float damount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr);
|
||||
void FillBorder(F2DDrawer *drawer, FTexture* img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
|
||||
void FillBorder(F2DDrawer *drawer, FGameTexture* img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
|
||||
|
||||
void DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height);
|
||||
void DrawBorder(F2DDrawer* drawer, FTextureID, int x1, int y1, int x2, int y2);
|
||||
void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, int height, int thickness);
|
||||
|
||||
|
@ -232,3 +232,39 @@ void VirtualToRealCoordsInt(F2DDrawer* drawer, int& x, int& y, int& w, int& h, i
|
|||
|
||||
extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac;
|
||||
extern int CleanWidth_1, CleanHeight_1, CleanXfac_1, CleanYfac_1;
|
||||
|
||||
void V_CalcCleanFacs(int designwidth, int designheight, int realwidth, int realheight, int* cleanx, int* cleany, int* cx1 = NULL, int* cx2 = NULL);
|
||||
|
||||
class ScaleOverrider
|
||||
{
|
||||
int savedxfac, savedyfac, savedwidth, savedheight;
|
||||
|
||||
public:
|
||||
// This is to allow certain elements to use an optimal fullscreen scale which for the menu would be too large.
|
||||
// The old code contained far too much mess to compensate for the menus which negatively affected everything else.
|
||||
// However, for compatibility reasons the currently used variables cannot be changed so they have to be overridden temporarily.
|
||||
// This class provides a safe interface for this because it ensures that the values get restored afterward.
|
||||
// Currently, the intermission and the level summary screen use this.
|
||||
ScaleOverrider(F2DDrawer *drawer)
|
||||
{
|
||||
savedxfac = CleanXfac;
|
||||
savedyfac = CleanYfac;
|
||||
savedwidth = CleanWidth;
|
||||
savedheight = CleanHeight;
|
||||
|
||||
if (drawer)
|
||||
{
|
||||
V_CalcCleanFacs(320, 200, drawer->GetWidth(), drawer->GetHeight(), &CleanXfac, &CleanYfac);
|
||||
CleanWidth = drawer->GetWidth() / CleanXfac;
|
||||
CleanHeight = drawer->GetHeight() / CleanYfac;
|
||||
}
|
||||
}
|
||||
|
||||
~ScaleOverrider()
|
||||
{
|
||||
CleanXfac = savedxfac;
|
||||
CleanYfac = savedyfac;
|
||||
CleanWidth = savedwidth;
|
||||
CleanHeight = savedheight;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ int ListGetInt(VMVa_List &tags);
|
|||
//
|
||||
//==========================================================================
|
||||
#if 0
|
||||
FTexture * BuildTextTexture(FFont *font, const char *string, int textcolor)
|
||||
FGameTexture * BuildTextTexture(FFont *font, const char *string, int textcolor)
|
||||
{
|
||||
int w;
|
||||
const uint8_t *ch;
|
||||
|
@ -61,7 +61,7 @@ FTexture * BuildTextTexture(FFont *font, const char *string, int textcolor)
|
|||
int cy;
|
||||
int trans = -1;
|
||||
int kerning;
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
|
||||
kerning = font->GetDefaultKerning();
|
||||
|
||||
|
@ -170,7 +170,7 @@ void DrawChar(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
|
|||
if (normalcolor >= NumTextColors)
|
||||
normalcolor = CR_UNTRANSLATED;
|
||||
|
||||
FTexture* pic;
|
||||
FGameTexture* pic;
|
||||
int dummy;
|
||||
bool redirected;
|
||||
|
||||
|
@ -200,7 +200,7 @@ void DrawChar(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
|
|||
if (normalcolor >= NumTextColors)
|
||||
normalcolor = CR_UNTRANSLATED;
|
||||
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
int dummy;
|
||||
bool redirected;
|
||||
|
||||
|
@ -256,7 +256,7 @@ void DrawTextCommon(F2DDrawer *drawer, FFont *font, int normalcolor, double x, d
|
|||
int boldcolor;
|
||||
int trans = -1;
|
||||
int kerning;
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
|
||||
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
|
||||
parms.celly *= parms.scaley;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "i_sound.h"
|
||||
#include "i_music.h"
|
||||
|
@ -166,9 +166,9 @@ static bool S_StartMusicPlaying(ZMusic_MusicStream song, bool loop, float rel_vo
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_PauseSound
|
||||
// S_PauseMusic
|
||||
//
|
||||
// Stop music and sound effects, during game PAUSE.
|
||||
// Stop music, during game PAUSE.
|
||||
//==========================================================================
|
||||
|
||||
void S_PauseMusic ()
|
||||
|
@ -183,9 +183,9 @@ void S_PauseMusic ()
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_ResumeSound
|
||||
// S_ResumeMusic
|
||||
//
|
||||
// Resume music and sound effects, after game PAUSE.
|
||||
// Resume music, after game PAUSE.
|
||||
//==========================================================================
|
||||
|
||||
void S_ResumeMusic ()
|
||||
|
|
|
@ -486,3 +486,4 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length)
|
|||
if (data) delete[] data;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ struct FISoundChannel
|
|||
|
||||
class SoundStream;
|
||||
|
||||
|
||||
void S_SetSoundPaused(int state);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1420,7 +1420,10 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
|
|||
|
||||
if(!reuse_chan || reuse_chan->StartTime == 0)
|
||||
{
|
||||
float st = (chanflags & SNDF_LOOP) ? fmod(startTime, (float)GetMSLength(sfx) / 1000.f) : clamp<float>(startTime, 0.f, (float)GetMSLength(sfx) / 1000.f);
|
||||
float sfxlength = (float)GetMSLength(sfx) / 1000.f;
|
||||
float st = (chanflags & SNDF_LOOP)
|
||||
? (sfxlength > 0 ? fmod(startTime, sfxlength) : 0)
|
||||
: clamp<float>(startTime, 0.f, sfxlength);
|
||||
alSourcef(source, AL_SEC_OFFSET, st);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -494,26 +494,9 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
int seen = 0;
|
||||
if (source != NULL && channel == CHAN_AUTO)
|
||||
{
|
||||
// Select a channel that isn't already playing something.
|
||||
// Try channel 0 first, then travel from channel 7 down.
|
||||
if (!IsChannelUsed(type, source, 0, &seen))
|
||||
{
|
||||
channel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (channel = 7; channel > 0; --channel)
|
||||
{
|
||||
if (!IsChannelUsed(type, source, channel, &seen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (channel == 0)
|
||||
{ // Crap. No free channels.
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// In the old sound system, 'AUTO' hijacked one of the other channels.
|
||||
// Now, with CHANF_OVERLAP at our disposal that isn't needed anymore. Just set the flag and let all sounds play on channel 0.
|
||||
chanflags |= CHANF_OVERLAP;
|
||||
}
|
||||
|
||||
// If this actor is already playing something on the selected channel, stop it.
|
||||
|
@ -564,9 +547,10 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
if (chanflags & (CHANF_UI|CHANF_NOPAUSE)) startflags |= SNDF_NOPAUSE;
|
||||
if (chanflags & CHANF_UI) startflags |= SNDF_NOREVERB;
|
||||
|
||||
float sfxlength = (float)GSnd->GetMSLength(sfx->data) / 1000.f;
|
||||
startTime = (startflags & SNDF_LOOP)
|
||||
? fmod(startTime, (float)GSnd->GetMSLength(sfx->data) / 1000.f)
|
||||
: clamp<float>(startTime, 0.f, (float)GSnd->GetMSLength(sfx->data) / 1000.f);
|
||||
? (sfxlength > 0 ? fmod(startTime, sfxlength) : 0)
|
||||
: clamp<float>(startTime, 0.f, sfxlength);
|
||||
|
||||
if (attenuation > 0 && type != SOURCE_None)
|
||||
{
|
||||
|
|
|
@ -171,7 +171,7 @@ public:
|
|||
|
||||
static void ListVars (const char *filter, bool plain);
|
||||
|
||||
const char *GetDescription() const { return Description; };
|
||||
const FString &GetDescription() const { return Description; };
|
||||
|
||||
protected:
|
||||
virtual void DoSet (UCVarValue value, ECVarType type) = 0;
|
||||
|
|
|
@ -301,6 +301,7 @@ void C_DoCommand (const char *cmd, int keynum)
|
|||
}
|
||||
else
|
||||
{ // Get the variable's value
|
||||
if (var->GetDescription().Len()) Printf("%s\n", var->GetDescription().GetChars());
|
||||
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#include "i_interface.h"
|
||||
|
||||
// Some global engine variables taken out of the backend code.
|
||||
SystemCallbacks *sysCallbacks;
|
||||
double refreshfreq;
|
||||
FString endoomName;
|
||||
bool batchrun;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "zstring.h"
|
||||
#include "intrect.h"
|
||||
|
||||
struct SystemCallbacks
|
||||
{
|
||||
|
@ -8,6 +10,23 @@ struct SystemCallbacks
|
|||
bool (*NetGame)();
|
||||
bool (*WantNativeMouse)();
|
||||
bool (*CaptureModeInGame)();
|
||||
void (*CrashInfo)(char* buffer, size_t bufflen, const char* lfstr);
|
||||
void (*PlayStartupSound)(const char* name);
|
||||
bool (*IsSpecialUI)();
|
||||
bool (*DisableTextureFilter)();
|
||||
void (*OnScreenSizeChanged)();
|
||||
IntRect(*GetSceneRect)();
|
||||
FString(*GetLocationDescription)();
|
||||
};
|
||||
|
||||
extern SystemCallbacks *sysCallbacks;
|
||||
|
||||
struct WadStuff
|
||||
{
|
||||
FString Path;
|
||||
FString Name;
|
||||
};
|
||||
|
||||
|
||||
extern FString endoomName;
|
||||
extern bool batchrun;
|
||||
|
|
22
src/common/engine/i_specialpaths.h
Normal file
22
src/common/engine/i_specialpaths.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include "zstring.h"
|
||||
|
||||
#ifdef __unix__
|
||||
FString GetUserFile (const char *path);
|
||||
#endif
|
||||
FString M_GetAppDataPath(bool create);
|
||||
FString M_GetCachePath(bool create);
|
||||
FString M_GetAutoexecPath();
|
||||
FString M_GetConfigPath(bool for_reading);
|
||||
FString M_GetScreenshotsPath();
|
||||
FString M_GetSavegamesPath();
|
||||
FString M_GetDocumentsPath();
|
||||
FString M_GetDemoPath();
|
||||
|
||||
FString M_GetNormalizedPath(const char* path);
|
||||
|
||||
#ifdef __APPLE__
|
||||
FString M_GetMacAppSupportPath(const bool create = true);
|
||||
void M_GetMacSearchDirectories(FString& user_docs, FString& user_app_support, FString& local_app_support);
|
||||
#endif // __APPLE__
|
|
@ -462,6 +462,7 @@ xx(Friend)
|
|||
xx(Strifeally)
|
||||
xx(Standing)
|
||||
xx(Countsecret)
|
||||
xx(NoCount)
|
||||
xx(Score)
|
||||
xx(Roll)
|
||||
xx(Scale)
|
||||
|
@ -809,6 +810,7 @@ xx(MoveBob)
|
|||
xx(StillBob)
|
||||
xx(ClassicFlight)
|
||||
xx(WBobSpeed)
|
||||
xx(WBobFire)
|
||||
xx(PlayerClass)
|
||||
xx(MonsterClass)
|
||||
xx(MorphedMonster)
|
||||
|
|
|
@ -34,6 +34,7 @@ struct FRemapTable
|
|||
int Index;
|
||||
int NumEntries; // # of elements in this table (usually 256)
|
||||
bool Inactive = false; // This table is inactive and should be treated as if it was passed as NULL
|
||||
bool TwodOnly = false; // Only used for 2D rendering
|
||||
bool ForFont = false; // Mark font translations because they may require different handling than the ones for sprites-
|
||||
|
||||
private:
|
||||
|
|
|
@ -1119,7 +1119,7 @@ void FScanner::CheckOpen()
|
|||
{
|
||||
if (ScriptOpen == false)
|
||||
{
|
||||
I_FatalError ("SC_ call before SC_Open().");
|
||||
I_Error ("SC_ call before SC_Open().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1081,16 +1081,17 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe
|
|||
}
|
||||
FTextureID chk = value;
|
||||
if (chk.GetIndex() >= TexMan.NumTextures()) chk.SetNull();
|
||||
FTexture *pic = TexMan.GetTexture(chk);
|
||||
auto pic = TexMan.GetGameTexture(chk);
|
||||
const char *name;
|
||||
auto lump = pic->GetSourceLump();
|
||||
|
||||
if (fileSystem.GetLinkedTexture(pic->SourceLump) == pic)
|
||||
if (fileSystem.GetLinkedTexture(lump) == pic)
|
||||
{
|
||||
name = fileSystem.GetFileFullName(pic->SourceLump);
|
||||
name = fileSystem.GetFileFullName(lump);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = pic->Name;
|
||||
name = pic->GetName();
|
||||
}
|
||||
arc.WriteKey(key);
|
||||
arc.w->StartArray();
|
||||
|
@ -1503,7 +1504,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary
|
|||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
FString contents { dict ? DictionaryToString(*dict) : "null" };
|
||||
FString contents { dict ? DictionaryToString(*dict) : FString("null") };
|
||||
return arc(key, contents);
|
||||
}
|
||||
else
|
||||
|
|
207
src/common/engine/st_start.h
Normal file
207
src/common/engine/st_start.h
Normal file
|
@ -0,0 +1,207 @@
|
|||
#pragma once
|
||||
/*
|
||||
** st_start.h
|
||||
** Interface for the startup screen.
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2006-2007 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. 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.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
** The startup screen interface is based on a mix of Heretic and Hexen.
|
||||
** Actual implementation is system-specific.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
class FStartupScreen
|
||||
{
|
||||
public:
|
||||
static FStartupScreen *CreateInstance(int max_progress);
|
||||
|
||||
FStartupScreen(int max_progress)
|
||||
{
|
||||
MaxPos = max_progress;
|
||||
CurPos = 0;
|
||||
NotchPos = 0;
|
||||
}
|
||||
|
||||
virtual ~FStartupScreen() = default;
|
||||
|
||||
virtual void Progress() {}
|
||||
|
||||
virtual void NetInit(const char *message, int num_players) {}
|
||||
virtual void NetProgress(int count) {}
|
||||
virtual void NetMessage(const char *format, ...) {} // cover for printf
|
||||
virtual void NetDone() {}
|
||||
virtual bool NetLoop(bool (*timer_callback)(void *), void *userdata) { return false; }
|
||||
protected:
|
||||
int MaxPos, CurPos, NotchPos;
|
||||
};
|
||||
|
||||
class FBasicStartupScreen : public FStartupScreen
|
||||
{
|
||||
public:
|
||||
FBasicStartupScreen(int max_progress, bool show_bar);
|
||||
~FBasicStartupScreen();
|
||||
|
||||
void Progress();
|
||||
void NetInit(const char* message, int num_players);
|
||||
void NetProgress(int count);
|
||||
void NetMessage(const char* format, ...); // cover for printf
|
||||
void NetDone();
|
||||
bool NetLoop(bool (*timer_callback)(void*), void* userdata);
|
||||
protected:
|
||||
long long NetMarqueeMode;
|
||||
int NetMaxPos, NetCurPos;
|
||||
};
|
||||
|
||||
class FGraphicalStartupScreen : public FBasicStartupScreen
|
||||
{
|
||||
public:
|
||||
FGraphicalStartupScreen(int max_progress);
|
||||
~FGraphicalStartupScreen();
|
||||
};
|
||||
|
||||
class FHereticStartupScreen : public FGraphicalStartupScreen
|
||||
{
|
||||
public:
|
||||
FHereticStartupScreen(int max_progress, long &hr);
|
||||
|
||||
void Progress();
|
||||
void LoadingStatus(const char *message, int colors);
|
||||
void AppendStatusLine(const char *status);
|
||||
protected:
|
||||
void SetWindowSize();
|
||||
|
||||
int ThermX, ThermY, ThermWidth, ThermHeight;
|
||||
int HMsgY, SMsgX;
|
||||
};
|
||||
|
||||
class FHexenStartupScreen : public FGraphicalStartupScreen
|
||||
{
|
||||
public:
|
||||
FHexenStartupScreen(int max_progress, long &hr);
|
||||
~FHexenStartupScreen();
|
||||
|
||||
void Progress();
|
||||
void NetProgress(int count);
|
||||
void NetDone();
|
||||
void SetWindowSize();
|
||||
|
||||
// Hexen's notch graphics, converted to chunky pixels.
|
||||
uint8_t * NotchBits;
|
||||
uint8_t * NetNotchBits;
|
||||
};
|
||||
|
||||
class FStrifeStartupScreen : public FGraphicalStartupScreen
|
||||
{
|
||||
public:
|
||||
FStrifeStartupScreen(int max_progress, long &hr);
|
||||
~FStrifeStartupScreen();
|
||||
|
||||
void Progress();
|
||||
protected:
|
||||
void DrawStuff(int old_laser, int new_laser);
|
||||
void SetWindowSize();
|
||||
|
||||
uint8_t *StartupPics[4+2+1];
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern FStartupScreen *StartScreen;
|
||||
|
||||
void DeleteStartupScreen();
|
||||
extern void ST_Endoom();
|
||||
|
||||
// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary
|
||||
|
||||
struct BitmapInfoHeader
|
||||
{
|
||||
uint32_t biSize;
|
||||
int32_t biWidth;
|
||||
int32_t biHeight;
|
||||
uint16_t biPlanes;
|
||||
uint16_t biBitCount;
|
||||
uint32_t biCompression;
|
||||
uint32_t biSizeImage;
|
||||
int32_t biXPelsPerMeter;
|
||||
int32_t biYPelsPerMeter;
|
||||
uint32_t biClrUsed;
|
||||
uint32_t biClrImportant;
|
||||
};
|
||||
|
||||
struct RgbQuad
|
||||
{
|
||||
uint8_t rgbBlue;
|
||||
uint8_t rgbGreen;
|
||||
uint8_t rgbRed;
|
||||
uint8_t rgbReserved;
|
||||
};
|
||||
|
||||
|
||||
struct BitmapInfo
|
||||
{
|
||||
BitmapInfoHeader bmiHeader;
|
||||
RgbQuad bmiColors[1];
|
||||
};
|
||||
|
||||
extern BitmapInfo* StartupBitmap;
|
||||
|
||||
|
||||
void ST_Util_PlanarToChunky4(uint8_t* dest, const uint8_t* src, int width, int height);
|
||||
void ST_Util_DrawBlock(BitmapInfo* bitmap_info, const uint8_t* src, int x, int y, int bytewidth, int height);
|
||||
void ST_Util_ClearBlock(BitmapInfo* bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height);
|
||||
BitmapInfo* ST_Util_CreateBitmap(int width, int height, int color_bits);
|
||||
uint8_t* ST_Util_BitsForBitmap(BitmapInfo* bitmap_info);
|
||||
void ST_Util_FreeBitmap(BitmapInfo* bitmap_info);
|
||||
void ST_Util_BitmapColorsFromPlaypal(BitmapInfo* bitmap_info);
|
||||
uint8_t* ST_Util_LoadFont(const char* filename);
|
||||
void ST_Util_FreeFont(uint8_t* font);
|
||||
BitmapInfo* ST_Util_AllocTextBitmap(const uint8_t* font);
|
||||
void ST_Util_DrawTextScreen(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font);
|
||||
void ST_Util_DrawChar(BitmapInfo* screen, const uint8_t* font, int x, int y, uint8_t charnum, uint8_t attrib);
|
||||
void ST_Util_UpdateTextBlink(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font, bool on);
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// DeleteStartupScreen
|
||||
//
|
||||
// Makes sure the startup screen has been deleted before quitting.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
inline void DeleteStartupScreen()
|
||||
{
|
||||
if (StartScreen != nullptr)
|
||||
{
|
||||
delete StartScreen;
|
||||
StartScreen = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
28
src/common/engine/startupinfo.h
Normal file
28
src/common/engine/startupinfo.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "zstring.h"
|
||||
|
||||
struct FStartupInfo
|
||||
{
|
||||
FString Name;
|
||||
uint32_t FgColor; // Foreground color for title banner
|
||||
uint32_t BkColor; // Background color for title banner
|
||||
FString Song;
|
||||
int Type;
|
||||
int LoadLights = -1;
|
||||
int LoadBrightmaps = -1;
|
||||
int modern = 0;
|
||||
enum
|
||||
{
|
||||
DefaultStartup,
|
||||
DoomStartup,
|
||||
HereticStartup,
|
||||
HexenStartup,
|
||||
StrifeStartup,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
extern FStartupInfo GameStartupInfo;
|
||||
|
|
@ -57,7 +57,7 @@ extern FILE* hashfile;
|
|||
struct FileSystem::LumpRecord
|
||||
{
|
||||
FResourceLump *lump;
|
||||
FTexture* linkedTexture;
|
||||
FGameTexture* linkedTexture;
|
||||
LumpShortName shortName;
|
||||
FString longName;
|
||||
int rfnum;
|
||||
|
@ -725,7 +725,7 @@ int FileSystem::GetResource (int resid, const char *type, int filenum) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FileSystem::SetLinkedTexture(int lump, FTexture *tex)
|
||||
void FileSystem::SetLinkedTexture(int lump, FGameTexture *tex)
|
||||
{
|
||||
if ((size_t)lump < NumEntries)
|
||||
{
|
||||
|
@ -739,7 +739,7 @@ void FileSystem::SetLinkedTexture(int lump, FTexture *tex)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FileSystem::GetLinkedTexture(int lump)
|
||||
FGameTexture *FileSystem::GetLinkedTexture(int lump)
|
||||
{
|
||||
if ((size_t)lump < NumEntries)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
class FResourceFile;
|
||||
struct FResourceLump;
|
||||
class FTexture;
|
||||
class FGameTexture;
|
||||
|
||||
union LumpShortName
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
~FileData ();
|
||||
void *GetMem () { return Block.Len() == 0 ? NULL : (void *)Block.GetChars(); }
|
||||
size_t GetSize () { return Block.Len(); }
|
||||
FString GetString () { return Block; }
|
||||
const FString &GetString () const { return Block; }
|
||||
|
||||
private:
|
||||
FileData (const FString &source);
|
||||
|
@ -124,8 +124,8 @@ public:
|
|||
inline int CheckNumForFullName (const FString &name, int wadfile) { return CheckNumForFullName(name.GetChars(), wadfile); }
|
||||
inline int GetNumForFullName (const FString &name) { return GetNumForFullName(name.GetChars()); }
|
||||
|
||||
void SetLinkedTexture(int lump, FTexture *tex);
|
||||
FTexture *GetLinkedTexture(int lump);
|
||||
void SetLinkedTexture(int lump, FGameTexture *tex);
|
||||
FGameTexture *GetLinkedTexture(int lump);
|
||||
|
||||
|
||||
void ReadFile (int lump, void *dest);
|
||||
|
|
|
@ -19,7 +19,6 @@ struct LumpFilterInfo
|
|||
};
|
||||
|
||||
class FResourceFile;
|
||||
class FTexture;
|
||||
|
||||
// [RH] Namespaces from BOOM.
|
||||
// These are needed here in the low level part so that WAD files can be properly set up.
|
||||
|
|
|
@ -73,7 +73,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
int i;
|
||||
FTextureID lump;
|
||||
char buffer[12];
|
||||
int maxyoffs;
|
||||
DVector2 Scale = { 1, 1 };
|
||||
|
||||
noTranslate = notranslate;
|
||||
|
@ -91,9 +90,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
translateUntranslated = false;
|
||||
int FixedWidth = 0;
|
||||
|
||||
maxyoffs = 0;
|
||||
|
||||
TMap<int, FTexture*> charMap;
|
||||
TMap<int, FGameTexture*> charMap;
|
||||
int minchar = INT_MAX;
|
||||
int maxchar = INT_MIN;
|
||||
|
||||
|
@ -231,13 +228,13 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
Type = Multilump;
|
||||
if (position < minchar) minchar = position;
|
||||
if (position > maxchar) maxchar = position;
|
||||
charMap.Insert(position, TexMan.GetTexture(lump));
|
||||
charMap.Insert(position, TexMan.GetGameTexture(lump));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FTexture *texs[256] = {};
|
||||
FGameTexture *texs[256] = {};
|
||||
if (lcount > 256 - start) lcount = 256 - start;
|
||||
for (i = 0; i < lcount; i++)
|
||||
{
|
||||
|
@ -247,8 +244,8 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
TexMan.ListTextures(buffer, array, true);
|
||||
for (auto entry : array)
|
||||
{
|
||||
FTexture *tex = TexMan.GetTexture(entry, false);
|
||||
if (tex && tex->GetSourceLump() >= 0 && fileSystem.GetFileContainer(tex->GetSourceLump()) <= fileSystem.GetMaxIwadNum() && tex->GetUseType() == ETextureType::MiscPatch)
|
||||
auto tex = TexMan.GetGameTexture(entry, false);
|
||||
if (tex && !tex->isUserContent() && tex->GetUseType() == ETextureType::MiscPatch)
|
||||
{
|
||||
texs[i] = tex;
|
||||
}
|
||||
|
@ -292,8 +289,8 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
{
|
||||
if ((int)position < minchar) minchar = (int)position;
|
||||
if ((int)position > maxchar) maxchar = (int)position;
|
||||
auto tex = TexMan.GetTexture(lump);
|
||||
tex->SetScale(Scale);
|
||||
auto tex = TexMan.GetGameTexture(lump);
|
||||
tex->SetScale((float)Scale.X, (float)Scale.Y);
|
||||
charMap.Insert((int)position, tex);
|
||||
Type = Folder;
|
||||
}
|
||||
|
@ -312,17 +309,13 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
auto lump = charMap.CheckKey(FirstChar + i);
|
||||
if (lump != nullptr)
|
||||
{
|
||||
FTexture *pic = *lump;
|
||||
auto pic = *lump;
|
||||
if (pic != nullptr)
|
||||
{
|
||||
int height = pic->GetDisplayHeight();
|
||||
int yoffs = pic->GetDisplayTopOffset();
|
||||
double fheight = pic->GetDisplayHeight();
|
||||
double yoffs = pic->GetDisplayTopOffset();
|
||||
|
||||
if (yoffs > maxyoffs)
|
||||
{
|
||||
maxyoffs = yoffs;
|
||||
}
|
||||
height += abs(yoffs);
|
||||
int height = int(fheight + abs(yoffs) + 0.5);
|
||||
if (height > fontheight)
|
||||
{
|
||||
fontheight = height;
|
||||
|
@ -333,24 +326,24 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
}
|
||||
}
|
||||
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
auto orig = pic->GetTexture();
|
||||
auto tex = MakeGameTexture(orig, nullptr, ETextureType::FontChar);
|
||||
tex->CopySize(pic);
|
||||
TexMan.AddGameTexture(tex);
|
||||
Chars[i].OriginalPic = tex;
|
||||
|
||||
if (!noTranslate)
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1(pic->GetImage()), "");
|
||||
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(orig->GetImage())), nullptr, ETextureType::FontChar);
|
||||
Chars[i].TranslatedPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
else
|
||||
{
|
||||
Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||
Chars[i].TranslatedPic = tex;
|
||||
}
|
||||
|
||||
Chars[i].XMove = Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -379,17 +372,13 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
|
||||
FixXMoves();
|
||||
}
|
||||
|
||||
if (!noTranslate) LoadTranslations();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale)
|
||||
{
|
||||
// all valid lumps must be named with a hex number that represents the Unicode character index for its first character,
|
||||
TArray<TexPart> part(1, true);
|
||||
TMap<int, FTexture*> charMap;
|
||||
TArray<TexPartBuild> part(1, true);
|
||||
TMap<int, FGameTexture*> charMap;
|
||||
int minchar = INT_MAX;
|
||||
int maxchar = INT_MIN;
|
||||
for (auto &entry : folderdata)
|
||||
|
@ -402,7 +391,7 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
auto lump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
||||
if (lump.isValid())
|
||||
{
|
||||
auto tex = TexMan.GetTexture(lump);
|
||||
auto tex = TexMan.GetGameTexture(lump);
|
||||
int numtex_x = tex->GetTexelWidth() / width;
|
||||
int numtex_y = tex->GetTexelHeight() / height;
|
||||
int maxinsheet = int(position) + numtex_x * numtex_y - 1;
|
||||
|
@ -415,25 +404,16 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
{
|
||||
part[0].OriginX = -width * x;
|
||||
part[0].OriginY = -height * y;
|
||||
part[0].Image = tex->GetImage();
|
||||
part[0].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
||||
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
||||
FImageTexture *tex = new FImageTexture(image, "");
|
||||
tex->SetUseType(ETextureType::FontChar);
|
||||
tex->bMultiPatch = true;
|
||||
tex->Width = width;
|
||||
tex->Height = height;
|
||||
tex->_LeftOffset[0] =
|
||||
tex->_LeftOffset[1] =
|
||||
tex->_TopOffset[0] =
|
||||
tex->_TopOffset[1] = 0;
|
||||
tex->Scale = Scale;
|
||||
tex->bMasked = true;
|
||||
tex->bTranslucent = -1;
|
||||
tex->bWorldPanning = true;
|
||||
tex->bNoDecals = false;
|
||||
tex->SourceLump = -1; // We do not really care.
|
||||
TexMan.AddTexture(tex);
|
||||
charMap.Insert(int(position) + x + y * numtex_x, tex);
|
||||
FImageTexture *tex = new FImageTexture(image);
|
||||
auto gtex = MakeGameTexture(tex, nullptr, ETextureType::FontChar);
|
||||
gtex->SetWorldPanning(true);
|
||||
gtex->SetOffsets(0, 0, 0);
|
||||
gtex->SetOffsets(1, 0, 0);
|
||||
gtex->SetScale((float)Scale.X, (float)Scale.Y);
|
||||
TexMan.AddGameTexture(gtex);
|
||||
charMap.Insert(int(position) + x + y * numtex_x, gtex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -458,18 +438,15 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
auto lump = charMap.CheckKey(FirstChar + i);
|
||||
if (lump != nullptr)
|
||||
{
|
||||
FTexture *pic = *lump;
|
||||
|
||||
auto b = pic->Get8BitPixels(false);
|
||||
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
auto pic = (*lump)->GetTexture();
|
||||
Chars[i].OriginalPic = (*lump)->GetUseType() == ETextureType::FontChar? (*lump) : MakeGameTexture(pic, nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1(pic->GetImage()), "");
|
||||
Chars[i].TranslatedPic->CopySize(pic);
|
||||
Chars[i].OriginalPic->CopySize(*lump);
|
||||
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(pic->GetImage())), nullptr, ETextureType::FontChar);
|
||||
Chars[i].TranslatedPic->CopySize(*lump);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
if (Chars[i].OriginalPic != *lump) TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
Chars[i].XMove = width;
|
||||
}
|
||||
|
@ -619,7 +596,7 @@ void FFont::RecordAllTextureColors(uint32_t *usedcolors)
|
|||
{
|
||||
if (Chars[i].TranslatedPic)
|
||||
{
|
||||
FFontChar1 *pic = static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetImage());
|
||||
FFontChar1 *pic = static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetTexture()->GetImage());
|
||||
if (pic)
|
||||
{
|
||||
// The remap must be temporarily reset here because this can be called on an initialized font.
|
||||
|
@ -982,7 +959,7 @@ int FFont::GetCharCode(int code, bool needpic) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
FGameTexture *FFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
{
|
||||
code = GetCharCode(code, true);
|
||||
int xmove = SpaceWidth;
|
||||
|
@ -1006,12 +983,12 @@ FTexture *FFont::GetChar (int code, int translation, int *const width, bool *red
|
|||
if (redirected) *redirected = redirect;
|
||||
if (redirect)
|
||||
{
|
||||
assert(Chars[code].OriginalPic->UseType == ETextureType::FontChar);
|
||||
assert(Chars[code].OriginalPic->GetUseType() == ETextureType::FontChar);
|
||||
return Chars[code].OriginalPic;
|
||||
}
|
||||
}
|
||||
if (redirected) *redirected = false;
|
||||
assert(Chars[code].TranslatedPic->UseType == ETextureType::FontChar);
|
||||
assert(Chars[code].TranslatedPic->GetUseType() == ETextureType::FontChar);
|
||||
return Chars[code].TranslatedPic;
|
||||
}
|
||||
|
||||
|
@ -1037,11 +1014,11 @@ int FFont::GetCharWidth (int code) const
|
|||
double GetBottomAlignOffset(FFont *font, int c)
|
||||
{
|
||||
int w;
|
||||
FTexture *tex_zero = font->GetChar('0', CR_UNDEFINED, &w);
|
||||
FTexture *texc = font->GetChar(c, CR_UNDEFINED, &w);
|
||||
auto tex_zero = font->GetChar('0', CR_UNDEFINED, &w);
|
||||
auto texc = font->GetChar(c, CR_UNDEFINED, &w);
|
||||
double offset = 0;
|
||||
if (texc) offset += texc->GetDisplayTopOffsetDouble();
|
||||
if (tex_zero) offset += -tex_zero->GetDisplayTopOffsetDouble() + tex_zero->GetDisplayHeightDouble();
|
||||
if (texc) offset += texc->GetDisplayTopOffset();
|
||||
if (tex_zero) offset += -tex_zero->GetDisplayTopOffset() + tex_zero->GetDisplayHeight();
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -1200,7 +1177,7 @@ void FFont::LoadTranslations()
|
|||
{
|
||||
if (Chars[i].TranslatedPic)
|
||||
{
|
||||
FFontChar1 *pic = static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetImage());
|
||||
FFontChar1 *pic = static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetTexture()->GetImage());
|
||||
if (pic)
|
||||
{
|
||||
pic->SetSourceRemap(nullptr); // Force the FFontChar1 to return the same pixels as the base texture
|
||||
|
@ -1214,7 +1191,7 @@ void FFont::LoadTranslations()
|
|||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
if(Chars[i].TranslatedPic)
|
||||
static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetImage())->SetSourceRemap(PatchRemap);
|
||||
static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetTexture()->GetImage())->SetSourceRemap(PatchRemap);
|
||||
}
|
||||
|
||||
BuildTranslations (Luminosity.Data(), identity, &TranslationParms[TranslationType][0], ActiveColors, nullptr);
|
||||
|
@ -1290,7 +1267,7 @@ void FFont::FixXMoves()
|
|||
}
|
||||
if (Chars[i].OriginalPic)
|
||||
{
|
||||
int ofs = Chars[i].OriginalPic->GetDisplayTopOffset();
|
||||
int ofs = (int)Chars[i].OriginalPic->GetDisplayTopOffset();
|
||||
if (ofs > Displacement) Displacement = ofs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,6 +245,7 @@ public:
|
|||
FHexFont (const char *fontname, int lump)
|
||||
: FFont(lump)
|
||||
{
|
||||
const int spacing = 9;
|
||||
assert(lump >= 0);
|
||||
|
||||
FontName = fontname;
|
||||
|
@ -258,8 +259,22 @@ public:
|
|||
SpaceWidth = 9;
|
||||
GlobalKerning = 0;
|
||||
translateUntranslated = true;
|
||||
|
||||
LoadTranslations();
|
||||
|
||||
Chars.Resize(LastChar - FirstChar + 1);
|
||||
for (int i = FirstChar; i <= LastChar; i++)
|
||||
{
|
||||
if (hexdata.glyphmap[i] > 0)
|
||||
{
|
||||
auto offset = hexdata.glyphmap[i];
|
||||
int size = hexdata.glyphdata[offset] / 16;
|
||||
Chars[i - FirstChar].TranslatedPic = MakeGameTexture(new FImageTexture(new FHexFontChar(&hexdata.glyphdata[offset + 1], size, size * 9, 16)), nullptr, ETextureType::FontChar);
|
||||
Chars[i - FirstChar].OriginalPic = Chars[i - FirstChar].TranslatedPic;
|
||||
Chars[i - FirstChar].XMove = size * spacing;
|
||||
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
|
||||
}
|
||||
else Chars[i - FirstChar].XMove = spacing;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -270,7 +285,6 @@ public:
|
|||
|
||||
void LoadTranslations()
|
||||
{
|
||||
const int spacing = 9;
|
||||
double luminosity[256];
|
||||
|
||||
memset (PatchRemap, 0, 256);
|
||||
|
@ -282,21 +296,6 @@ public:
|
|||
}
|
||||
ActiveColors = 18;
|
||||
|
||||
Chars.Resize(LastChar - FirstChar + 1);
|
||||
for (int i = FirstChar; i <= LastChar; i++)
|
||||
{
|
||||
if (hexdata.glyphmap[i] > 0)
|
||||
{
|
||||
auto offset = hexdata.glyphmap[i];
|
||||
int size = hexdata.glyphdata[offset] / 16;
|
||||
Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar (&hexdata.glyphdata[offset+1], size, size * 9, 16));
|
||||
Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i - FirstChar].XMove = size * spacing;
|
||||
TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic);
|
||||
}
|
||||
else Chars[i - FirstChar].XMove = spacing;
|
||||
|
||||
}
|
||||
BuildTranslations (luminosity, nullptr, &TranslationParms[1][0], ActiveColors, nullptr);
|
||||
}
|
||||
|
||||
|
@ -318,6 +317,7 @@ public:
|
|||
FHexFont2(const char *fontname, int lump)
|
||||
: FFont(lump)
|
||||
{
|
||||
const int spacing = 9;
|
||||
assert(lump >= 0);
|
||||
|
||||
FontName = fontname;
|
||||
|
@ -331,8 +331,21 @@ public:
|
|||
SpaceWidth = 9;
|
||||
GlobalKerning = -1;
|
||||
translateUntranslated = true;
|
||||
Chars.Resize(LastChar - FirstChar + 1);
|
||||
for (int i = FirstChar; i <= LastChar; i++)
|
||||
{
|
||||
if (hexdata.glyphmap[i] > 0)
|
||||
{
|
||||
auto offset = hexdata.glyphmap[i];
|
||||
int size = hexdata.glyphdata[offset] / 16;
|
||||
Chars[i - FirstChar].TranslatedPic = MakeGameTexture(new FImageTexture(new FHexFontChar2(&hexdata.glyphdata[offset + 1], size, 2 + size * 8, 18)), nullptr, ETextureType::FontChar);
|
||||
Chars[i - FirstChar].OriginalPic = Chars[i - FirstChar].TranslatedPic;
|
||||
Chars[i - FirstChar].XMove = size * spacing;
|
||||
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
|
||||
}
|
||||
else Chars[i - FirstChar].XMove = spacing;
|
||||
|
||||
LoadTranslations();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -343,7 +356,6 @@ public:
|
|||
|
||||
void LoadTranslations() override
|
||||
{
|
||||
const int spacing = 9;
|
||||
double luminosity[256];
|
||||
|
||||
memset(PatchRemap, 0, 256);
|
||||
|
@ -355,21 +367,6 @@ public:
|
|||
}
|
||||
ActiveColors = 18;
|
||||
|
||||
Chars.Resize(LastChar - FirstChar + 1);
|
||||
for (int i = FirstChar; i <= LastChar; i++)
|
||||
{
|
||||
if (hexdata.glyphmap[i] > 0)
|
||||
{
|
||||
auto offset = hexdata.glyphmap[i];
|
||||
int size = hexdata.glyphdata[offset] / 16;
|
||||
Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar2(&hexdata.glyphdata[offset + 1], size, 2 + size * 8, 18));
|
||||
Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i - FirstChar].XMove = size * spacing;
|
||||
TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic);
|
||||
}
|
||||
else Chars[i - FirstChar].XMove = spacing;
|
||||
|
||||
}
|
||||
BuildTranslations(luminosity, nullptr, &TranslationParms[0][0], ActiveColors, nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,15 +167,16 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
|
|||
|
||||
void FSingleLumpFont::CreateFontFromPic (FTextureID picnum)
|
||||
{
|
||||
FTexture *pic = TexMan.GetTexture(picnum);
|
||||
auto pic = TexMan.GetGameTexture(picnum);
|
||||
|
||||
FontHeight = pic->GetDisplayHeight ();
|
||||
SpaceWidth = pic->GetDisplayWidth ();
|
||||
FontHeight = (int)pic->GetDisplayHeight ();
|
||||
SpaceWidth = (int)pic->GetDisplayWidth ();
|
||||
GlobalKerning = 0;
|
||||
|
||||
FirstChar = LastChar = 'A';
|
||||
Chars.Resize(1);
|
||||
Chars[0].TranslatedPic = pic;
|
||||
Chars[0].OriginalPic = pic;
|
||||
|
||||
// Only one color range. Don't bother with the others.
|
||||
ActiveColors = 0;
|
||||
|
@ -222,7 +223,7 @@ void FSingleLumpFont::LoadTranslations()
|
|||
for(unsigned int i = 0;i < count;++i)
|
||||
{
|
||||
if(Chars[i].TranslatedPic)
|
||||
static_cast<FFontChar2*>(Chars[i].TranslatedPic->GetImage())->SetSourceRemap(PatchRemap);
|
||||
static_cast<FFontChar2*>(Chars[i].TranslatedPic->GetTexture()->GetImage())->SetSourceRemap(PatchRemap);
|
||||
}
|
||||
|
||||
BuildTranslations (luminosity, useidentity ? identity : nullptr, ranges, ActiveColors, usepalette ? local_palette : nullptr);
|
||||
|
@ -255,7 +256,6 @@ void FSingleLumpFont::LoadFON1 (int lump, const uint8_t *data)
|
|||
LastChar = 255; // This is to allow LoadTranslations to function. The way this is all set up really needs to be changed.
|
||||
GlobalKerning = 0;
|
||||
translateUntranslated = true;
|
||||
LoadTranslations();
|
||||
LastChar = 0x2122;
|
||||
|
||||
// Move the Windows-1252 characters to their proper place.
|
||||
|
@ -350,12 +350,13 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
|
|||
if (destSize <= 0)
|
||||
{
|
||||
Chars[i].TranslatedPic = nullptr;
|
||||
Chars[i].OriginalPic = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar2 (lump, int(data_p - data), widths2[i], FontHeight));
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar2 (lump, int(data_p - data), widths2[i], FontHeight)), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic = Chars[i].TranslatedPic;
|
||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||
do
|
||||
{
|
||||
int8_t code = *data_p++;
|
||||
|
@ -377,8 +378,6 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
|
|||
I_Error ("Overflow decompressing char %d (%c) of %s", i, i, FontName.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
LoadTranslations();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -483,15 +482,15 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
|
|||
{ // Empty character: skip it.
|
||||
continue;
|
||||
}
|
||||
auto tex = new FImageTexture(new FFontChar2(lump, int(chardata + chari + 6 - data),
|
||||
auto tex = MakeGameTexture(new FImageTexture(new FFontChar2(lump, int(chardata + chari + 6 - data),
|
||||
chardata[chari+1], // width
|
||||
chardata[chari+2], // height
|
||||
-(int8_t)chardata[chari+3], // x offset
|
||||
-(int8_t)chardata[chari+4] // y offset
|
||||
));
|
||||
tex->SetUseType(ETextureType::FontChar);
|
||||
)), nullptr, ETextureType::FontChar);
|
||||
Chars[chardata[chari] - FirstChar].TranslatedPic = tex;
|
||||
TexMan.AddTexture(tex);
|
||||
Chars[chardata[chari] - FirstChar].OriginalPic = tex;
|
||||
TexMan.AddGameTexture(tex);
|
||||
}
|
||||
|
||||
// If the font did not define a space character, determine a suitable space width now.
|
||||
|
@ -508,7 +507,6 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
|
|||
}
|
||||
|
||||
FixXMoves();
|
||||
LoadTranslations();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -556,10 +554,10 @@ void FSingleLumpFont::CheckFON1Chars (double *luminosity)
|
|||
|
||||
if(!Chars[i].TranslatedPic)
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar2 (Lump, int(data_p - data), SpaceWidth, FontHeight));
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar2 (Lump, int(data_p - data), SpaceWidth, FontHeight)), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic = Chars[i].TranslatedPic;
|
||||
Chars[i].XMove = SpaceWidth;
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
|
||||
// Advance to next char's data and count the used colors.
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
FSinglePicFont(const char *picname);
|
||||
|
||||
// FFont interface
|
||||
FTexture *GetChar(int code, int translation, int *const width, bool *redirected = nullptr) const override;
|
||||
FGameTexture *GetChar(int code, int translation, int *const width, bool *redirected = nullptr) const override;
|
||||
int GetCharWidth (int code) const;
|
||||
|
||||
protected:
|
||||
|
@ -72,11 +72,11 @@ FSinglePicFont::FSinglePicFont(const char *picname) :
|
|||
I_FatalError ("%s is not a font or texture", picname);
|
||||
}
|
||||
|
||||
FTexture *pic = TexMan.GetTexture(picnum);
|
||||
auto pic = TexMan.GetGameTexture(picnum);
|
||||
|
||||
FontName = picname;
|
||||
FontHeight = pic->GetDisplayHeight();
|
||||
SpaceWidth = pic->GetDisplayWidth();
|
||||
FontHeight = (int)pic->GetDisplayHeight();
|
||||
SpaceWidth = (int)pic->GetDisplayWidth();
|
||||
GlobalKerning = 0;
|
||||
FirstChar = LastChar = 'A';
|
||||
ActiveColors = 0;
|
||||
|
@ -94,13 +94,13 @@ FSinglePicFont::FSinglePicFont(const char *picname) :
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FSinglePicFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
FGameTexture *FSinglePicFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
{
|
||||
*width = SpaceWidth;
|
||||
if (redirected) *redirected = false;
|
||||
if (code == 'a' || code == 'A')
|
||||
{
|
||||
return TexMan.GetPalettedTexture(PicNum, true);
|
||||
return TexMan.GetGameTexture(PicNum, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
class FSpecialFont : public FFont
|
||||
{
|
||||
public:
|
||||
FSpecialFont (const char *name, int first, int count, FTexture **lumplist, const bool *notranslate, int lump, bool donttranslate);
|
||||
FSpecialFont (const char *name, int first, int count, FGameTexture **lumplist, const bool *notranslate, int lump, bool donttranslate);
|
||||
|
||||
void LoadTranslations();
|
||||
|
||||
|
@ -60,13 +60,13 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **lumplist, const bool *notranslate, int lump, bool donttranslate)
|
||||
FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture **lumplist, const bool *notranslate, int lump, bool donttranslate)
|
||||
: FFont(lump)
|
||||
{
|
||||
int i;
|
||||
TArray<FTexture *> charlumps(count, true);
|
||||
TArray<FGameTexture *> charlumps(count, true);
|
||||
int maxyoffs;
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
|
||||
memcpy(this->notranslate, notranslate, 256*sizeof(bool));
|
||||
|
||||
|
@ -87,8 +87,8 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l
|
|||
pic = charlumps[i] = lumplist[i];
|
||||
if (pic != nullptr)
|
||||
{
|
||||
int height = pic->GetDisplayHeight();
|
||||
int yoffs = pic->GetDisplayTopOffset();
|
||||
int height = (int)pic->GetDisplayHeight();
|
||||
int yoffs = (int)pic->GetDisplayTopOffset();
|
||||
|
||||
if (yoffs > maxyoffs)
|
||||
{
|
||||
|
@ -104,20 +104,18 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l
|
|||
if (charlumps[i] != nullptr)
|
||||
{
|
||||
auto pic = charlumps[i];
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||
|
||||
if (!noTranslate)
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1 (charlumps[i]->GetImage()), "");
|
||||
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1 (charlumps[i]->GetTexture()->GetImage())), nullptr, ETextureType::FontChar);
|
||||
Chars[i].TranslatedPic->CopySize(charlumps[i]);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
else Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||
Chars[i].XMove = Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -142,10 +140,6 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l
|
|||
{
|
||||
ActiveColors = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadTranslations();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -167,7 +161,7 @@ void FSpecialFont::LoadTranslations()
|
|||
{
|
||||
if (Chars[i].TranslatedPic)
|
||||
{
|
||||
FFontChar1 *pic = static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetImage());
|
||||
FFontChar1 *pic = static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetTexture()->GetImage());
|
||||
if (pic)
|
||||
{
|
||||
pic->SetSourceRemap(nullptr); // Force the FFontChar1 to return the same pixels as the base texture
|
||||
|
@ -197,7 +191,7 @@ void FSpecialFont::LoadTranslations()
|
|||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if(Chars[i].TranslatedPic)
|
||||
static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetImage())->SetSourceRemap(PatchRemap);
|
||||
static_cast<FFontChar1 *>(Chars[i].TranslatedPic->GetTexture()->GetImage())->SetSourceRemap(PatchRemap);
|
||||
}
|
||||
|
||||
BuildTranslations(Luminosity.Data(), identity, &TranslationParms[0][0], TotalColors, nullptr, [=](FRemapTable* remap)
|
||||
|
@ -217,7 +211,7 @@ void FSpecialFont::LoadTranslations()
|
|||
ActiveColors = TotalColors;
|
||||
}
|
||||
|
||||
FFont *CreateSpecialFont (const char *name, int first, int count, FTexture **lumplist, const bool *notranslate, int lump, bool donttranslate)
|
||||
FFont *CreateSpecialFont (const char *name, int first, int count, FGameTexture **lumplist, const bool *notranslate, int lump, bool donttranslate)
|
||||
{
|
||||
return new FSpecialFont(name, first, count, lumplist, notranslate, lump, donttranslate);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ FFont* SmallFont, * SmallFont2, * BigFont, * BigUpper, * ConFont, * Intermission
|
|||
|
||||
FFont *FFont::FirstFont = nullptr;
|
||||
int NumTextColors;
|
||||
static bool translationsLoaded;
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
|
@ -138,22 +139,27 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
head == MAKE_ID(0xE1,0xE6,0xD5,0x1A))
|
||||
{
|
||||
FFont *CreateSingleLumpFont (const char *fontname, int lump);
|
||||
return CreateSingleLumpFont (name, lump);
|
||||
font = CreateSingleLumpFont (name, lump);
|
||||
if (translationsLoaded) font->LoadTranslations();
|
||||
return font;
|
||||
}
|
||||
}
|
||||
FTextureID picnum = TexMan.CheckForTexture (name, ETextureType::Any);
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FTexture *tex = TexMan.GetTexture(picnum);
|
||||
auto tex = TexMan.GetGameTexture(picnum);
|
||||
if (tex && tex->GetSourceLump() >= folderfile)
|
||||
{
|
||||
FFont *CreateSinglePicFont(const char *name);
|
||||
return CreateSinglePicFont (name);
|
||||
font = CreateSinglePicFont (name);
|
||||
return font;
|
||||
}
|
||||
}
|
||||
if (folderdata.Size() > 0)
|
||||
{
|
||||
return new FFont(name, nullptr, name, HU_FONTSTART, HU_FONTSIZE, 1, -1);
|
||||
font = new FFont(name, nullptr, name, HU_FONTSTART, HU_FONTSIZE, 1, -1);
|
||||
if (translationsLoaded) font->LoadTranslations();
|
||||
return font;
|
||||
}
|
||||
}
|
||||
return font;
|
||||
|
@ -170,7 +176,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
void V_InitCustomFonts()
|
||||
{
|
||||
FScanner sc;
|
||||
FTexture *lumplist[256];
|
||||
FGameTexture *lumplist[256];
|
||||
bool notranslate[256];
|
||||
bool donttranslate;
|
||||
FString namebuffer, templatebuf;
|
||||
|
@ -266,12 +272,12 @@ void V_InitCustomFonts()
|
|||
else
|
||||
{
|
||||
if (format == 1) goto wrong;
|
||||
FTexture **p = &lumplist[*(unsigned char*)sc.String];
|
||||
FGameTexture **p = &lumplist[*(unsigned char*)sc.String];
|
||||
sc.MustGetString();
|
||||
FTextureID texid = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
|
||||
if (texid.Exists())
|
||||
{
|
||||
*p = TexMan.GetTexture(texid);
|
||||
*p = TexMan.GetGameTexture(texid);
|
||||
}
|
||||
else if (fileSystem.GetFileContainer(sc.LumpNum) >= fileSystem.GetIwadNum())
|
||||
{
|
||||
|
@ -307,7 +313,7 @@ void V_InitCustomFonts()
|
|||
}
|
||||
if (count > 0)
|
||||
{
|
||||
FFont *CreateSpecialFont (const char *name, int first, int count, FTexture **lumplist, const bool *notranslate, int lump, bool donttranslate);
|
||||
FFont *CreateSpecialFont (const char *name, int first, int count, FGameTexture **lumplist, const bool *notranslate, int lump, bool donttranslate);
|
||||
FFont *fnt = CreateSpecialFont (namebuffer, first, count, &lumplist[first], notranslate, llump, donttranslate);
|
||||
fnt->SetCursor(cursor);
|
||||
fnt->SetKerning(kerning);
|
||||
|
@ -728,13 +734,6 @@ void V_InitFonts()
|
|||
OriginalSmallFont = new FFont("OriginalSmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true);
|
||||
}
|
||||
|
||||
if (SmallFont)
|
||||
{
|
||||
uint32_t colors[256] = {};
|
||||
SmallFont->RecordAllTextureColors(colors);
|
||||
if (OriginalSmallFont != nullptr) OriginalSmallFont->SetDefaultTranslation(colors);
|
||||
NewSmallFont->SetDefaultTranslation(colors);
|
||||
}
|
||||
|
||||
if (!(SmallFont2 = V_GetFont("SmallFont2"))) // Only used by Strife
|
||||
{
|
||||
|
@ -770,13 +769,6 @@ void V_InitFonts()
|
|||
OriginalBigFont = new FFont("OriginalBigFont", nullptr, "bigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
|
||||
}
|
||||
|
||||
if (BigFont)
|
||||
{
|
||||
uint32_t colors[256] = {};
|
||||
BigFont->RecordAllTextureColors(colors);
|
||||
if (OriginalBigFont != nullptr) OriginalBigFont->SetDefaultTranslation(colors);
|
||||
}
|
||||
|
||||
// let PWAD BIGFONTs override the stock BIGUPPER font. (This check needs to be made smarter.)
|
||||
if (BigUpper && BigFont->Type != FFont::Folder && BigUpper->Type == FFont::Folder)
|
||||
{
|
||||
|
@ -828,6 +820,29 @@ void V_InitFonts()
|
|||
AlternativeSmallFont = OriginalSmallFont;
|
||||
}
|
||||
|
||||
void V_LoadTranslations()
|
||||
{
|
||||
for (auto font = FFont::FirstFont; font; font = font->Next)
|
||||
{
|
||||
if (!font->noTranslate) font->LoadTranslations();
|
||||
else font->ActiveColors = 0;
|
||||
}
|
||||
if (BigFont)
|
||||
{
|
||||
uint32_t colors[256] = {};
|
||||
BigFont->RecordAllTextureColors(colors);
|
||||
if (OriginalBigFont != nullptr) OriginalBigFont->SetDefaultTranslation(colors);
|
||||
}
|
||||
if (SmallFont)
|
||||
{
|
||||
uint32_t colors[256] = {};
|
||||
SmallFont->RecordAllTextureColors(colors);
|
||||
if (OriginalSmallFont != nullptr) OriginalSmallFont->SetDefaultTranslation(colors);
|
||||
NewSmallFont->SetDefaultTranslation(colors);
|
||||
}
|
||||
translationsLoaded = true;
|
||||
}
|
||||
|
||||
void V_ClearFonts()
|
||||
{
|
||||
while (FFont::FirstFont != nullptr)
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
#include "palentry.h"
|
||||
#include "name.h"
|
||||
|
||||
class DCanvas;
|
||||
class FTexture;
|
||||
class FGameTexture;
|
||||
struct FRemapTable;
|
||||
|
||||
enum EColorRange : int
|
||||
|
@ -77,10 +76,11 @@ enum EColorRange : int
|
|||
|
||||
extern int NumTextColors;
|
||||
|
||||
using GlyphSet = TMap<int, FTexture*>;
|
||||
using GlyphSet = TMap<int, FGameTexture*>;
|
||||
|
||||
class FFont
|
||||
{
|
||||
friend void V_LoadTranslations();
|
||||
public:
|
||||
|
||||
enum EFontType
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false, bool iwadonly = false, bool doomtemplate = false, GlyphSet *baseGlpyphs = nullptr);
|
||||
virtual ~FFont ();
|
||||
|
||||
virtual FTexture *GetChar (int code, int translation, int *const width, bool *redirected = nullptr) const;
|
||||
virtual FGameTexture *GetChar (int code, int translation, int *const width, bool *redirected = nullptr) const;
|
||||
virtual int GetCharWidth (int code) const;
|
||||
int GetColorTranslation (EColorRange range, PalEntry *color = nullptr) const;
|
||||
int GetLump() const { return Lump; }
|
||||
|
@ -155,18 +155,18 @@ protected:
|
|||
int TranslationType = 0;
|
||||
int Displacement = 0;
|
||||
char Cursor;
|
||||
bool noTranslate;
|
||||
bool noTranslate = false;
|
||||
bool translateUntranslated;
|
||||
bool MixedCase = false;
|
||||
bool forceremap = false;
|
||||
struct CharData
|
||||
{
|
||||
FTexture *TranslatedPic = nullptr; // Texture for use with font translations.
|
||||
FTexture *OriginalPic = nullptr; // Texture for use with CR_UNTRANSLATED or font colorization.
|
||||
FGameTexture *TranslatedPic = nullptr; // Texture for use with font translations.
|
||||
FGameTexture *OriginalPic = nullptr; // Texture for use with CR_UNTRANSLATED or font colorization.
|
||||
int XMove = INT_MIN;
|
||||
};
|
||||
TArray<CharData> Chars;
|
||||
int ActiveColors;
|
||||
int ActiveColors = -1;
|
||||
TArray<int> Translations;
|
||||
uint8_t PatchRemap[256];
|
||||
|
||||
|
@ -192,5 +192,6 @@ EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int
|
|||
FFont *V_GetFont(const char *fontname, const char *fontlumpname = nullptr);
|
||||
void V_InitFontColors();
|
||||
char* CleanseString(char* str);
|
||||
void V_LoadTranslations();
|
||||
|
||||
|
||||
|
|
10
src/common/menu/menustate.h
Normal file
10
src/common/menu/menustate.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
enum EMenuState : int
|
||||
{
|
||||
MENU_Off, // Menu is closed
|
||||
MENU_On, // Menu is opened
|
||||
MENU_WaitKey, // Menu is opened and waiting for a key in the controls menu
|
||||
MENU_OnNoPause, // Menu is opened but does not pause the game
|
||||
};
|
||||
extern EMenuState menuactive; // Menu overlayed?
|
236
src/common/models/model.cpp
Normal file
236
src/common/models/model.cpp
Normal file
|
@ -0,0 +1,236 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2005-2016 Christoph Oelckers
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_models.cpp
|
||||
**
|
||||
** General model handling code
|
||||
**
|
||||
**/
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "cmdlib.h"
|
||||
#include "sc_man.h"
|
||||
#include "m_crc32.h"
|
||||
#include "printf.h"
|
||||
#include "model_ue1.h"
|
||||
#include "model_obj.h"
|
||||
#include "model_md2.h"
|
||||
#include "model_md3.h"
|
||||
#include "model_kvx.h"
|
||||
#include "i_time.h"
|
||||
#include "voxels.h"
|
||||
#include "texturemanager.h"
|
||||
#include "modelrenderer.h"
|
||||
|
||||
|
||||
TDeletingArray<FModel*> Models;
|
||||
TArray<FSpriteModelFrame> SpriteModelFrames;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void FlushModels()
|
||||
{
|
||||
for (int i = Models.Size() - 1; i >= 0; i--)
|
||||
{
|
||||
Models[i]->DestroyVertexBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FModel::FModel()
|
||||
{
|
||||
for (int i = 0; i < NumModelRendererTypes; i++)
|
||||
mVBuf[i] = nullptr;
|
||||
}
|
||||
|
||||
FModel::~FModel()
|
||||
{
|
||||
DestroyVertexBuffer();
|
||||
}
|
||||
|
||||
void FModel::DestroyVertexBuffer()
|
||||
{
|
||||
for (int i = 0; i < NumModelRendererTypes; i++)
|
||||
{
|
||||
delete mVBuf[i];
|
||||
mVBuf[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FindGFXFile
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
static int FindGFXFile(FString & fn)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(fn); // if we find something that matches the name plus the extension, return it and do not enter the substitution logic below.
|
||||
if (lump != -1) return lump;
|
||||
|
||||
int best = -1;
|
||||
int dot = fn.LastIndexOf('.');
|
||||
int slash = fn.LastIndexOf('/');
|
||||
if (dot > slash) fn.Truncate(dot);
|
||||
|
||||
static const char * extensions[] = { ".png", ".jpg", ".tga", ".pcx", nullptr };
|
||||
|
||||
for (const char ** extp=extensions; *extp; extp++)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(fn + *extp);
|
||||
if (lump >= best) best = lump;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// LoadSkin
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FTextureID LoadSkin(const char * path, const char * fn)
|
||||
{
|
||||
FString buffer;
|
||||
|
||||
buffer.Format("%s%s", path, fn);
|
||||
|
||||
int texlump = FindGFXFile(buffer);
|
||||
const char * const texname = texlump < 0 ? fn : fileSystem.GetFileFullName(texlump);
|
||||
return TexMan.CheckForTexture(texname, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// ModelFrameHash
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int ModelFrameHash(FSpriteModelFrame * smf)
|
||||
{
|
||||
const uint32_t *table = GetCRCTable ();
|
||||
uint32_t hash = 0xffffffff;
|
||||
|
||||
const char * s = (const char *)(&smf->type); // this uses type, sprite and frame for hashing
|
||||
const char * se= (const char *)(&smf->hashnext);
|
||||
|
||||
for (; s<se; s++)
|
||||
{
|
||||
hash = CRC1 (hash, *s, table);
|
||||
}
|
||||
return hash ^ 0xffffffff;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FindModel
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
unsigned FindModel(const char * path, const char * modelfile)
|
||||
{
|
||||
FModel * model = nullptr;
|
||||
FString fullname;
|
||||
|
||||
fullname.Format("%s%s", path, modelfile);
|
||||
int lump = fileSystem.CheckNumForFullName(fullname);
|
||||
|
||||
if (lump<0)
|
||||
{
|
||||
Printf("FindModel: '%s' not found\n", fullname.GetChars());
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(unsigned i = 0; i< Models.Size(); i++)
|
||||
{
|
||||
if (!Models[i]->mFileName.CompareNoCase(fullname)) return i;
|
||||
}
|
||||
|
||||
int len = fileSystem.FileLength(lump);
|
||||
FileData lumpd = fileSystem.ReadFile(lump);
|
||||
char * buffer = (char*)lumpd.GetMem();
|
||||
|
||||
if ( (size_t)fullname.LastIndexOf("_d.3d") == fullname.Len()-5 )
|
||||
{
|
||||
FString anivfile = fullname.GetChars();
|
||||
anivfile.Substitute("_d.3d","_a.3d");
|
||||
if ( fileSystem.CheckNumForFullName(anivfile) > 0 )
|
||||
{
|
||||
model = new FUE1Model;
|
||||
}
|
||||
}
|
||||
else if ( (size_t)fullname.LastIndexOf("_a.3d") == fullname.Len()-5 )
|
||||
{
|
||||
FString datafile = fullname.GetChars();
|
||||
datafile.Substitute("_a.3d","_d.3d");
|
||||
if ( fileSystem.CheckNumForFullName(datafile) > 0 )
|
||||
{
|
||||
model = new FUE1Model;
|
||||
}
|
||||
}
|
||||
else if ( (size_t)fullname.LastIndexOf(".obj") == fullname.Len() - 4 )
|
||||
{
|
||||
model = new FOBJModel;
|
||||
}
|
||||
else if (!memcmp(buffer, "DMDM", 4))
|
||||
{
|
||||
model = new FDMDModel;
|
||||
}
|
||||
else if (!memcmp(buffer, "IDP2", 4))
|
||||
{
|
||||
model = new FMD2Model;
|
||||
}
|
||||
else if (!memcmp(buffer, "IDP3", 4))
|
||||
{
|
||||
model = new FMD3Model;
|
||||
}
|
||||
|
||||
if (model != nullptr)
|
||||
{
|
||||
if (!model->Load(path, lump, buffer, len))
|
||||
{
|
||||
delete model;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// try loading as a voxel
|
||||
FVoxel *voxel = R_LoadKVX(lump);
|
||||
if (voxel != nullptr)
|
||||
{
|
||||
model = new FVoxelModel(voxel, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("LoadModel: Unknown model format in '%s'\n", fullname.GetChars());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// The vertex buffer cannot be initialized here because this gets called before OpenGL is initialized
|
||||
model->mFileName = fullname;
|
||||
return Models.Push(model);
|
||||
}
|
||||
|
83
src/common/models/model.h
Normal file
83
src/common/models/model.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "textureid.h"
|
||||
#include "i_modelvertexbuffer.h"
|
||||
|
||||
class FModelRenderer;
|
||||
class FGameTexture;
|
||||
class IModelVertexBuffer;
|
||||
class FModel;
|
||||
struct FSpriteModelFrame;
|
||||
|
||||
FTextureID LoadSkin(const char* path, const char* fn);
|
||||
void FlushModels();
|
||||
extern TDeletingArray<FModel*> Models;
|
||||
extern TArray<FSpriteModelFrame> SpriteModelFrames;
|
||||
|
||||
#define MAX_MODELS_PER_FRAME 4
|
||||
#define MD3_MAX_SURFACES 32
|
||||
|
||||
struct FSpriteModelFrame
|
||||
{
|
||||
int modelIDs[MAX_MODELS_PER_FRAME];
|
||||
FTextureID skinIDs[MAX_MODELS_PER_FRAME];
|
||||
FTextureID surfaceskinIDs[MAX_MODELS_PER_FRAME][MD3_MAX_SURFACES];
|
||||
int modelframes[MAX_MODELS_PER_FRAME];
|
||||
float xscale, yscale, zscale;
|
||||
// [BB] Added zoffset, rotation parameters and flags.
|
||||
// Added xoffset, yoffset
|
||||
float xoffset, yoffset, zoffset;
|
||||
float xrotate, yrotate, zrotate;
|
||||
float rotationCenterX, rotationCenterY, rotationCenterZ;
|
||||
float rotationSpeed;
|
||||
unsigned int flags;
|
||||
const void* type; // used for hashing, must point to something usable as identifier for the model's owner.
|
||||
short sprite;
|
||||
short frame;
|
||||
int hashnext;
|
||||
float angleoffset;
|
||||
// added pithoffset, rolloffset.
|
||||
float pitchoffset, rolloffset; // I don't want to bother with type transformations, so I made this variables float.
|
||||
bool isVoxel;
|
||||
};
|
||||
|
||||
|
||||
enum ModelRendererType
|
||||
{
|
||||
GLModelRendererType,
|
||||
SWModelRendererType,
|
||||
PolyModelRendererType,
|
||||
NumModelRendererTypes
|
||||
};
|
||||
|
||||
class FModel
|
||||
{
|
||||
public:
|
||||
FModel();
|
||||
virtual ~FModel();
|
||||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) = 0;
|
||||
virtual int FindFrame(const char * name) = 0;
|
||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0) = 0;
|
||||
virtual void BuildVertexBuffer(FModelRenderer *renderer) = 0;
|
||||
virtual void AddSkins(uint8_t *hitlist) = 0;
|
||||
virtual float getAspectFactor(float vscale) { return 1.f; }
|
||||
|
||||
void SetVertexBuffer(int type, IModelVertexBuffer *buffer) { mVBuf[type] = buffer; }
|
||||
IModelVertexBuffer *GetVertexBuffer(int type) const { return mVBuf[type]; }
|
||||
void DestroyVertexBuffer();
|
||||
|
||||
const FSpriteModelFrame *curSpriteMDLFrame;
|
||||
int curMDLIndex;
|
||||
void PushSpriteMDLFrame(const FSpriteModelFrame *smf, int index) { curSpriteMDLFrame = smf; curMDLIndex = index; };
|
||||
|
||||
FString mFileName;
|
||||
|
||||
private:
|
||||
IModelVertexBuffer *mVBuf[NumModelRendererTypes];
|
||||
};
|
||||
|
||||
int ModelFrameHash(FSpriteModelFrame* smf);
|
||||
unsigned FindModel(const char* path, const char* modelfile);
|
||||
|
69
src/common/models/model_kvx.h
Normal file
69
src/common/models/model_kvx.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
#pragma once
|
||||
|
||||
#include "model.h"
|
||||
#include "i_modelvertexbuffer.h"
|
||||
#include "tarray.h"
|
||||
#include "xs_Float.h"
|
||||
|
||||
struct FVoxel;
|
||||
struct kvxslab_t;
|
||||
class FModelRenderer;
|
||||
class FGameTexture;
|
||||
|
||||
struct FVoxelVertexHash
|
||||
{
|
||||
// Returns the hash value for a key.
|
||||
hash_t Hash(const FModelVertex &key)
|
||||
{
|
||||
int ix = xs_RoundToInt(key.x);
|
||||
int iy = xs_RoundToInt(key.y);
|
||||
int iz = xs_RoundToInt(key.z);
|
||||
return (hash_t)(ix + (iy<<9) + (iz<<18));
|
||||
}
|
||||
|
||||
// Compares two keys, returning zero if they are the same.
|
||||
int Compare(const FModelVertex &left, const FModelVertex &right)
|
||||
{
|
||||
return left.x != right.x || left.y != right.y || left.z != right.z || left.u != right.u || left.v != right.v;
|
||||
}
|
||||
};
|
||||
|
||||
struct FIndexInit
|
||||
{
|
||||
void Init(unsigned int &value)
|
||||
{
|
||||
value = 0xffffffff;
|
||||
}
|
||||
};
|
||||
|
||||
typedef TMap<FModelVertex, unsigned int, FVoxelVertexHash, FIndexInit> FVoxelMap;
|
||||
|
||||
|
||||
class FVoxelModel : public FModel
|
||||
{
|
||||
protected:
|
||||
FVoxel *mVoxel;
|
||||
bool mOwningVoxel; // if created through MODELDEF deleting this object must also delete the voxel object
|
||||
FTextureID mPalette;
|
||||
unsigned int mNumIndices;
|
||||
TArray<FModelVertex> mVertices;
|
||||
TArray<unsigned int> mIndices;
|
||||
|
||||
void MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &check);
|
||||
void AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, uint8_t color, FVoxelMap &check);
|
||||
unsigned int AddVertex(FModelVertex &vert, FVoxelMap &check);
|
||||
|
||||
public:
|
||||
FVoxelModel(FVoxel *voxel, bool owned);
|
||||
~FVoxelModel();
|
||||
bool Load(const char * fn, int lumpnum, const char * buffer, int length);
|
||||
void Initialize();
|
||||
virtual int FindFrame(const char * name);
|
||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0);
|
||||
virtual void AddSkins(uint8_t *hitlist);
|
||||
FTextureID GetPaletteTexture() const { return mPalette; }
|
||||
void BuildVertexBuffer(FModelRenderer *renderer);
|
||||
float getAspectFactor(float vscale) override;
|
||||
};
|
||||
|
||||
|
137
src/common/models/model_md2.h
Normal file
137
src/common/models/model_md2.h
Normal file
|
@ -0,0 +1,137 @@
|
|||
#pragma once
|
||||
#include "model.h"
|
||||
|
||||
#define MD2_MAGIC 0x32504449
|
||||
#define DMD_MAGIC 0x4D444D44
|
||||
#define MAX_LODS 4
|
||||
|
||||
class FDMDModel : public FModel
|
||||
{
|
||||
protected:
|
||||
|
||||
struct FTriangle
|
||||
{
|
||||
unsigned short vertexIndices[3];
|
||||
unsigned short textureIndices[3];
|
||||
};
|
||||
|
||||
|
||||
struct DMDHeader
|
||||
{
|
||||
int magic;
|
||||
int version;
|
||||
int flags;
|
||||
};
|
||||
|
||||
struct DMDModelVertex
|
||||
{
|
||||
float xyz[3];
|
||||
};
|
||||
|
||||
struct FTexCoord
|
||||
{
|
||||
short s, t;
|
||||
};
|
||||
|
||||
struct FGLCommandVertex
|
||||
{
|
||||
float s, t;
|
||||
int index;
|
||||
};
|
||||
|
||||
struct DMDInfo
|
||||
{
|
||||
int skinWidth;
|
||||
int skinHeight;
|
||||
int frameSize;
|
||||
int numSkins;
|
||||
int numVertices;
|
||||
int numTexCoords;
|
||||
int numFrames;
|
||||
int numLODs;
|
||||
int offsetSkins;
|
||||
int offsetTexCoords;
|
||||
int offsetFrames;
|
||||
int offsetLODs;
|
||||
int offsetEnd;
|
||||
};
|
||||
|
||||
struct ModelFrame
|
||||
{
|
||||
char name[16];
|
||||
unsigned int vindex;
|
||||
};
|
||||
|
||||
struct ModelFrameVertexData
|
||||
{
|
||||
DMDModelVertex *vertices;
|
||||
DMDModelVertex *normals;
|
||||
};
|
||||
|
||||
struct DMDLoDInfo
|
||||
{
|
||||
int numTriangles;
|
||||
int numGlCommands;
|
||||
int offsetTriangles;
|
||||
int offsetGlCommands;
|
||||
};
|
||||
|
||||
struct DMDLoD
|
||||
{
|
||||
FTriangle * triangles;
|
||||
};
|
||||
|
||||
|
||||
int mLumpNum;
|
||||
DMDHeader header;
|
||||
DMDInfo info;
|
||||
FTextureID * skins;
|
||||
ModelFrame * frames;
|
||||
bool allowTexComp; // Allow texture compression with this.
|
||||
|
||||
// Temp data only needed for buffer construction
|
||||
FTexCoord * texCoords;
|
||||
ModelFrameVertexData *framevtx;
|
||||
DMDLoDInfo lodInfo[MAX_LODS];
|
||||
DMDLoD lods[MAX_LODS];
|
||||
|
||||
public:
|
||||
FDMDModel()
|
||||
{
|
||||
mLumpNum = -1;
|
||||
frames = NULL;
|
||||
skins = NULL;
|
||||
for (int i = 0; i < MAX_LODS; i++)
|
||||
{
|
||||
lods[i].triangles = NULL;
|
||||
}
|
||||
info.numLODs = 0;
|
||||
texCoords = NULL;
|
||||
framevtx = NULL;
|
||||
}
|
||||
virtual ~FDMDModel();
|
||||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length);
|
||||
virtual int FindFrame(const char * name);
|
||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0);
|
||||
virtual void LoadGeometry();
|
||||
virtual void AddSkins(uint8_t *hitlist);
|
||||
|
||||
void UnloadGeometry();
|
||||
void BuildVertexBuffer(FModelRenderer *renderer);
|
||||
|
||||
};
|
||||
|
||||
// This uses the same internal representation as DMD
|
||||
class FMD2Model : public FDMDModel
|
||||
{
|
||||
public:
|
||||
FMD2Model() {}
|
||||
virtual ~FMD2Model();
|
||||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length);
|
||||
virtual void LoadGeometry();
|
||||
|
||||
};
|
||||
|
||||
|
75
src/common/models/model_md3.h
Normal file
75
src/common/models/model_md3.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
#pragma once
|
||||
#include "model.h"
|
||||
|
||||
#define MD3_MAGIC 0x33504449
|
||||
|
||||
class FMD3Model : public FModel
|
||||
{
|
||||
struct MD3Tag
|
||||
{
|
||||
// Currently I have no use for this
|
||||
};
|
||||
|
||||
struct MD3TexCoord
|
||||
{
|
||||
float s,t;
|
||||
};
|
||||
|
||||
struct MD3Vertex
|
||||
{
|
||||
float x,y,z;
|
||||
float nx,ny,nz;
|
||||
};
|
||||
|
||||
struct MD3Triangle
|
||||
{
|
||||
int VertIndex[3];
|
||||
};
|
||||
|
||||
struct MD3Surface
|
||||
{
|
||||
unsigned numVertices;
|
||||
unsigned numTriangles;
|
||||
unsigned numSkins;
|
||||
|
||||
TArray<FTextureID> Skins;
|
||||
TArray<MD3Triangle> Tris;
|
||||
TArray<MD3TexCoord> Texcoords;
|
||||
TArray<MD3Vertex> Vertices;
|
||||
|
||||
unsigned int vindex = UINT_MAX; // contains numframes arrays of vertices
|
||||
unsigned int iindex = UINT_MAX;
|
||||
|
||||
void UnloadGeometry()
|
||||
{
|
||||
Tris.Reset();
|
||||
Vertices.Reset();
|
||||
Texcoords.Reset();
|
||||
}
|
||||
};
|
||||
|
||||
struct MD3Frame
|
||||
{
|
||||
// The bounding box information is of no use in the Doom engine
|
||||
// That will still be done with the actor's size information.
|
||||
char Name[16];
|
||||
float origin[3];
|
||||
};
|
||||
|
||||
int numTags;
|
||||
int mLumpNum;
|
||||
|
||||
TArray<MD3Frame> Frames;
|
||||
TArray<MD3Surface> Surfaces;
|
||||
|
||||
public:
|
||||
FMD3Model() = default;
|
||||
|
||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length);
|
||||
virtual int FindFrame(const char * name);
|
||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0);
|
||||
void LoadGeometry();
|
||||
void BuildVertexBuffer(FModelRenderer *renderer);
|
||||
virtual void AddSkins(uint8_t *hitlist);
|
||||
};
|
||||
|
|
@ -23,8 +23,10 @@
|
|||
#ifndef __GL_MODELS_OBJ_H__
|
||||
#define __GL_MODELS_OBJ_H__
|
||||
|
||||
#include "models.h"
|
||||
#include "model.h"
|
||||
#include "sc_man.h"
|
||||
#include "tarray.h"
|
||||
#include "vectors.h"
|
||||
|
||||
class FOBJModel : public FModel
|
||||
{
|
||||
|
@ -96,7 +98,7 @@ public:
|
|||
~FOBJModel();
|
||||
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
||||
int FindFrame(const char* name) override;
|
||||
void RenderFrame(FModelRenderer* renderer, FTexture* skin, int frame, int frame2, double inter, int translation=0) override;
|
||||
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, int translation=0) override;
|
||||
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
||||
void AddSkins(uint8_t* hitlist) override;
|
||||
};
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "models.h"
|
||||
#include <stdint.h>
|
||||
#include "model.h"
|
||||
#include "vectors.h"
|
||||
|
||||
class FUE1Model : public FModel
|
||||
{
|
||||
|
@ -24,7 +26,7 @@ public:
|
|||
|
||||
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||
int FindFrame(const char * name) override;
|
||||
void RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame, int frame2, double inter, int translation=0) override;
|
||||
void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0) override;
|
||||
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
||||
void AddSkins(uint8_t *hitlist) override;
|
||||
void LoadGeometry();
|
29
src/common/models/modelrenderer.h
Normal file
29
src/common/models/modelrenderer.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#include "renderstyle.h"
|
||||
#include "matrix.h"
|
||||
#include "model.h"
|
||||
|
||||
class FModelRenderer
|
||||
{
|
||||
public:
|
||||
virtual ~FModelRenderer() = default;
|
||||
|
||||
virtual ModelRendererType GetType() const = 0;
|
||||
|
||||
virtual void BeginDrawModel(FRenderStyle style, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) = 0;
|
||||
virtual void EndDrawModel(FRenderStyle style, FSpriteModelFrame *smf) = 0;
|
||||
|
||||
virtual IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) = 0;
|
||||
|
||||
virtual VSMatrix GetViewToWorldMatrix() = 0;
|
||||
|
||||
virtual void BeginDrawHUDModel(FRenderStyle style, const VSMatrix &objectToWorldMatrix, bool mirrored) = 0;
|
||||
virtual void EndDrawHUDModel(FRenderStyle style) = 0;
|
||||
|
||||
virtual void SetInterpolation(double interpolation) = 0;
|
||||
virtual void SetMaterial(FGameTexture *skin, bool clampNoFilter, int translation) = 0;
|
||||
virtual void DrawArrays(int start, int count) = 0;
|
||||
virtual void DrawElements(int numIndices, size_t offset) = 0;
|
||||
virtual void SetupFrame(FModel *model, unsigned int frame1, unsigned int frame2, unsigned int size) = 0;
|
||||
};
|
||||
|
|
@ -27,13 +27,18 @@
|
|||
**/
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "r_data/models/models.h"
|
||||
#include "model_md2.h"
|
||||
#include "texturemanager.h"
|
||||
#include "modelrenderer.h"
|
||||
#include "printf.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data
|
||||
#endif
|
||||
|
||||
enum { VX, VZ, VY };
|
||||
#define NUMVERTEXNORMALS 162
|
||||
|
||||
static float avertexnormals[NUMVERTEXNORMALS][3] = {
|
||||
#include "tab_anorms.h"
|
||||
};
|
||||
|
@ -280,7 +285,7 @@ FDMDModel::~FDMDModel()
|
|||
|
||||
void FDMDModel::BuildVertexBuffer(FModelRenderer *renderer)
|
||||
{
|
||||
if (!GetVertexBuffer(renderer))
|
||||
if (!GetVertexBuffer(renderer->GetType()))
|
||||
{
|
||||
LoadGeometry();
|
||||
|
||||
|
@ -288,7 +293,7 @@ void FDMDModel::BuildVertexBuffer(FModelRenderer *renderer)
|
|||
unsigned int vindex = 0;
|
||||
|
||||
auto vbuf = renderer->CreateVertexBuffer(false, info.numFrames == 1);
|
||||
SetVertexBuffer(renderer, vbuf);
|
||||
SetVertexBuffer(renderer->GetType(), vbuf);
|
||||
|
||||
FModelVertex *vertptr = vbuf->LockVertexBuffer(VertexBufferSize);
|
||||
|
||||
|
@ -358,20 +363,20 @@ int FDMDModel::FindFrame(const char * name)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FDMDModel::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
void FDMDModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
{
|
||||
if (frameno >= info.numFrames || frameno2 >= info.numFrames) return;
|
||||
|
||||
if (!skin)
|
||||
{
|
||||
if (info.numSkins == 0 || !skins[0].isValid()) return;
|
||||
skin = TexMan.GetTexture(skins[0], true);
|
||||
skin = TexMan.GetGameTexture(skins[0], true);
|
||||
if (!skin) return;
|
||||
}
|
||||
|
||||
renderer->SetInterpolation(inter);
|
||||
renderer->SetMaterial(skin, false, translation);
|
||||
GetVertexBuffer(renderer)->SetupFrame(renderer, frames[frameno].vindex, frames[frameno2].vindex, lodInfo[0].numTriangles * 3);
|
||||
renderer->SetupFrame(this, frames[frameno].vindex, frames[frameno2].vindex, lodInfo[0].numTriangles * 3);
|
||||
renderer->DrawArrays(0, lodInfo[0].numTriangles * 3);
|
||||
renderer->SetInterpolation(0.f);
|
||||
}
|
|
@ -22,8 +22,9 @@
|
|||
|
||||
#include "filesystem.h"
|
||||
#include "cmdlib.h"
|
||||
#include "r_data/models/models.h"
|
||||
#include "model_md3.h"
|
||||
#include "texturemanager.h"
|
||||
#include "modelrenderer.h"
|
||||
|
||||
#define MAX_QPATH 64
|
||||
|
||||
|
@ -239,7 +240,7 @@ void FMD3Model::LoadGeometry()
|
|||
|
||||
void FMD3Model::BuildVertexBuffer(FModelRenderer *renderer)
|
||||
{
|
||||
if (!GetVertexBuffer(renderer))
|
||||
if (!GetVertexBuffer(renderer->GetType()))
|
||||
{
|
||||
LoadGeometry();
|
||||
|
||||
|
@ -254,7 +255,7 @@ void FMD3Model::BuildVertexBuffer(FModelRenderer *renderer)
|
|||
}
|
||||
|
||||
auto vbuf = renderer->CreateVertexBuffer(true, Frames.Size() == 1);
|
||||
SetVertexBuffer(renderer, vbuf);
|
||||
SetVertexBuffer(renderer->GetType(), vbuf);
|
||||
|
||||
FModelVertex *vertptr = vbuf->LockVertexBuffer(vbufsize);
|
||||
unsigned int *indxptr = vbuf->LockIndexBuffer(ibufsize);
|
||||
|
@ -342,7 +343,7 @@ int FMD3Model::FindFrame(const char * name)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FMD3Model::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
{
|
||||
if ((unsigned)frameno >= Frames.Size() || (unsigned)frameno2 >= Frames.Size()) return;
|
||||
|
||||
|
@ -353,16 +354,16 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame
|
|||
|
||||
// [BB] In case no skin is specified via MODELDEF, check if the MD3 has a skin for the current surface.
|
||||
// Note: Each surface may have a different skin.
|
||||
FTexture *surfaceSkin = skin;
|
||||
FGameTexture *surfaceSkin = skin;
|
||||
if (!surfaceSkin)
|
||||
{
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
surfaceSkin = TexMan.GetTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
surfaceSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
}
|
||||
else if (surf->numSkins > 0 && surf->Skins[0].isValid())
|
||||
{
|
||||
surfaceSkin = TexMan.GetTexture(surf->Skins[0], true);
|
||||
surfaceSkin = TexMan.GetGameTexture(surf->Skins[0], true);
|
||||
}
|
||||
|
||||
if (!surfaceSkin)
|
||||
|
@ -372,7 +373,7 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame
|
|||
}
|
||||
|
||||
renderer->SetMaterial(surfaceSkin, false, translation);
|
||||
GetVertexBuffer(renderer)->SetupFrame(renderer, surf->vindex + frameno * surf->numVertices, surf->vindex + frameno2 * surf->numVertices, surf->numVertices);
|
||||
renderer->SetupFrame(this, surf->vindex + frameno * surf->numVertices, surf->vindex + frameno2 * surf->numVertices, surf->numVertices);
|
||||
renderer->DrawElements(surf->numTriangles * 3, surf->iindex * sizeof(unsigned int));
|
||||
}
|
||||
renderer->SetInterpolation(0.f);
|
|
@ -20,8 +20,11 @@
|
|||
//--------------------------------------------------------------------------
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "r_data/models/models_obj.h"
|
||||
#include "model_obj.h"
|
||||
#include "texturemanager.h"
|
||||
#include "modelrenderer.h"
|
||||
#include "printf.h"
|
||||
#include "textureid.h"
|
||||
|
||||
/**
|
||||
* Load an OBJ model
|
||||
|
@ -355,7 +358,7 @@ int FOBJModel::ResolveIndex(int origIndex, FaceElement el)
|
|||
*/
|
||||
void FOBJModel::BuildVertexBuffer(FModelRenderer *renderer)
|
||||
{
|
||||
if (GetVertexBuffer(renderer))
|
||||
if (GetVertexBuffer(renderer->GetType()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -375,7 +378,7 @@ void FOBJModel::BuildVertexBuffer(FModelRenderer *renderer)
|
|||
}
|
||||
|
||||
auto vbuf = renderer->CreateVertexBuffer(false,true);
|
||||
SetVertexBuffer(renderer, vbuf);
|
||||
SetVertexBuffer(renderer->GetType(), vbuf);
|
||||
|
||||
FModelVertex *vertptr = vbuf->LockVertexBuffer(vbufsize);
|
||||
|
||||
|
@ -626,22 +629,22 @@ int FOBJModel::FindFrame(const char* name)
|
|||
* @param inter Unused
|
||||
* @param translation The translation for the skin
|
||||
*/
|
||||
void FOBJModel::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation)
|
||||
{
|
||||
for (unsigned int i = 0; i < surfaces.Size(); i++)
|
||||
{
|
||||
OBJSurface *surf = &surfaces[i];
|
||||
|
||||
FTexture *userSkin = skin;
|
||||
FGameTexture *userSkin = skin;
|
||||
if (!userSkin)
|
||||
{
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
userSkin = TexMan.GetTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
userSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
}
|
||||
else if (surf->skin.isValid())
|
||||
{
|
||||
userSkin = TexMan.GetTexture(surf->skin, true);
|
||||
userSkin = TexMan.GetGameTexture(surf->skin, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,7 +655,7 @@ void FOBJModel::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame
|
|||
}
|
||||
|
||||
renderer->SetMaterial(userSkin, false, translation);
|
||||
GetVertexBuffer(renderer)->SetupFrame(renderer, surf->vbStart, surf->vbStart, surf->numTris * 3);
|
||||
renderer->SetupFrame(this, surf->vbStart, surf->vbStart, surf->numTris * 3);
|
||||
renderer->DrawArrays(0, surf->numTris * 3);
|
||||
}
|
||||
}
|
|
@ -22,8 +22,9 @@
|
|||
|
||||
#include "filesystem.h"
|
||||
#include "cmdlib.h"
|
||||
#include "r_data/models/models_ue1.h"
|
||||
#include "model_ue1.h"
|
||||
#include "texturemanager.h"
|
||||
#include "modelrenderer.h"
|
||||
|
||||
float unpackuvert( uint32_t n, int c )
|
||||
{
|
||||
|
@ -216,7 +217,7 @@ int FUE1Model::FindFrame( const char *name )
|
|||
return -1;
|
||||
}
|
||||
|
||||
void FUE1Model::RenderFrame( FModelRenderer *renderer, FTexture *skin, int frame, int frame2, double inter, int translation )
|
||||
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, int translation )
|
||||
{
|
||||
// the moment of magic
|
||||
if ( (frame >= numFrames) || (frame2 >= numFrames) ) return;
|
||||
|
@ -232,11 +233,11 @@ void FUE1Model::RenderFrame( FModelRenderer *renderer, FTexture *skin, int frame
|
|||
vofs += vsize;
|
||||
continue;
|
||||
}
|
||||
FTexture *sskin = skin;
|
||||
FGameTexture *sskin = skin;
|
||||
if ( !sskin )
|
||||
{
|
||||
if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
sskin = TexMan.GetTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum], true);
|
||||
sskin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum], true);
|
||||
if ( !sskin )
|
||||
{
|
||||
vofs += vsize;
|
||||
|
@ -246,7 +247,7 @@ void FUE1Model::RenderFrame( FModelRenderer *renderer, FTexture *skin, int frame
|
|||
// TODO: Handle per-group render styles and other flags once functions for it are implemented
|
||||
// Future note: poly renderstyles should always be enforced unless the actor itself has a style other than Normal
|
||||
renderer->SetMaterial(sskin,false,translation);
|
||||
GetVertexBuffer(renderer)->SetupFrame(renderer,vofs+frame*fsize,vofs+frame2*fsize,vsize);
|
||||
renderer->SetupFrame(this, vofs+frame*fsize,vofs+frame2*fsize,vsize);
|
||||
renderer->DrawArrays(0,vsize);
|
||||
vofs += vsize;
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ void FUE1Model::RenderFrame( FModelRenderer *renderer, FTexture *skin, int frame
|
|||
|
||||
void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer )
|
||||
{
|
||||
if (GetVertexBuffer(renderer))
|
||||
if (GetVertexBuffer(renderer->GetType()))
|
||||
return;
|
||||
if ( !mDataLoaded )
|
||||
LoadGeometry();
|
||||
|
@ -264,7 +265,7 @@ void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer )
|
|||
vsize += groups[i].numPolys*3;
|
||||
vsize *= numFrames;
|
||||
auto vbuf = renderer->CreateVertexBuffer(false,numFrames==1);
|
||||
SetVertexBuffer(renderer, vbuf);
|
||||
SetVertexBuffer(renderer->GetType(), vbuf);
|
||||
FModelVertex *vptr = vbuf->LockVertexBuffer(vsize);
|
||||
int vidx = 0;
|
||||
for ( int i=0; i<numFrames; i++ )
|
|
@ -27,13 +27,16 @@
|
|||
**/
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "g_level.h"
|
||||
#include "colormatcher.h"
|
||||
#include "bitmap.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "models.h"
|
||||
#include "model_kvx.h"
|
||||
#include "image.h"
|
||||
#include "texturemanager.h"
|
||||
#include "modelrenderer.h"
|
||||
#include "voxels.h"
|
||||
#include "texturemanager.h"
|
||||
#include "palettecontainer.h"
|
||||
#include "textures.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data
|
||||
|
@ -157,7 +160,7 @@ FVoxelModel::FVoxelModel(FVoxel *voxel, bool owned)
|
|||
{
|
||||
mVoxel = voxel;
|
||||
mOwningVoxel = owned;
|
||||
mPalette = TexMan.AddTexture(new FImageTexture(new FVoxelTexture(voxel)));
|
||||
mPalette = TexMan.AddGameTexture(MakeGameTexture(new FImageTexture(new FVoxelTexture(voxel)), nullptr, ETextureType::Override));
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -319,12 +322,12 @@ void FVoxelModel::Initialize()
|
|||
|
||||
void FVoxelModel::BuildVertexBuffer(FModelRenderer *renderer)
|
||||
{
|
||||
if (!GetVertexBuffer(renderer))
|
||||
if (!GetVertexBuffer(renderer->GetType()))
|
||||
{
|
||||
Initialize();
|
||||
|
||||
auto vbuf = renderer->CreateVertexBuffer(true, true);
|
||||
SetVertexBuffer(renderer, vbuf);
|
||||
SetVertexBuffer(renderer->GetType(), vbuf);
|
||||
|
||||
FModelVertex *vertptr = vbuf->LockVertexBuffer(mVertices.Size());
|
||||
unsigned int *indxptr = vbuf->LockIndexBuffer(mIndices.Size());
|
||||
|
@ -384,9 +387,9 @@ int FVoxelModel::FindFrame(const char * name)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
float FVoxelModel::getAspectFactor(FLevelLocals *Level)
|
||||
float FVoxelModel::getAspectFactor(float stretch)
|
||||
{
|
||||
return Level->info->pixelstretch;
|
||||
return stretch;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -395,10 +398,10 @@ float FVoxelModel::getAspectFactor(FLevelLocals *Level)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FVoxelModel::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame, int frame2, double inter, int translation)
|
||||
void FVoxelModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation)
|
||||
{
|
||||
renderer->SetMaterial(skin, true, translation);
|
||||
GetVertexBuffer(renderer)->SetupFrame(renderer, 0, 0, 0);
|
||||
renderer->SetupFrame(this, 0, 0, 0);
|
||||
renderer->DrawElements(mNumIndices, 0);
|
||||
}
|
||||
|
|
@ -42,31 +42,14 @@
|
|||
#include "filesystem.h"
|
||||
#include "v_video.h"
|
||||
#include "sc_man.h"
|
||||
#include "s_sound.h"
|
||||
#include "sbar.h"
|
||||
#include "g_level.h"
|
||||
#include "r_data/sprites.h"
|
||||
#include "voxels.h"
|
||||
#include "info.h"
|
||||
#include "printf.h"
|
||||
|
||||
void VOX_AddVoxel(int sprnum, int frame, FVoxelDef *def);
|
||||
|
||||
TDeletingArray<FVoxel *> Voxels; // used only to auto-delete voxels on exit.
|
||||
TDeletingArray<FVoxelDef *> VoxelDefs;
|
||||
|
||||
struct VoxelOptions
|
||||
{
|
||||
VoxelOptions()
|
||||
: DroppedSpin(0), PlacedSpin(0), Scale(1.), AngleOffset(90.), OverridePalette(false)
|
||||
{}
|
||||
|
||||
int DroppedSpin;
|
||||
int PlacedSpin;
|
||||
double Scale;
|
||||
DAngle AngleOffset;
|
||||
bool OverridePalette;
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetVoxelRemap
|
||||
|
@ -476,134 +459,6 @@ void FVoxel::RemovePalette()
|
|||
}
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// VOX_ReadSpriteNames
|
||||
//
|
||||
// Reads a list of sprite names from a VOXELDEF lump.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool VOX_ReadSpriteNames(FScanner &sc, TArray<uint32_t> &vsprites)
|
||||
{
|
||||
vsprites.Clear();
|
||||
while (sc.GetString())
|
||||
{
|
||||
// A sprite name list is terminated by an '=' character.
|
||||
if (sc.String[0] == '=')
|
||||
{
|
||||
if (vsprites.Size() == 0)
|
||||
{
|
||||
sc.ScriptMessage("No sprites specified for voxel.\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (sc.StringLen != 4 && sc.StringLen != 5)
|
||||
{
|
||||
sc.ScriptMessage("Sprite name \"%s\" is wrong size.\n", sc.String);
|
||||
}
|
||||
else if (sc.StringLen == 5 && (sc.String[4] = toupper(sc.String[4]), sc.String[4] < 'A' || sc.String[4] >= 'A' + MAX_SPRITE_FRAMES))
|
||||
{
|
||||
sc.ScriptMessage("Sprite frame %c is invalid.\n", sc.String[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int frame = (sc.StringLen == 4) ? 255 : sc.String[4] - 'A';
|
||||
int i = GetSpriteIndex(sc.String, false);
|
||||
if (i != -1)
|
||||
{
|
||||
vsprites.Push((frame << 24) | i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vsprites.Size() != 0)
|
||||
{
|
||||
sc.ScriptMessage("Unexpected end of file\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// VOX_ReadOptions
|
||||
//
|
||||
// Reads a list of options from a VOXELDEF lump, terminated with a '}'
|
||||
// character. The leading '{' must already be consumed
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts)
|
||||
{
|
||||
while (sc.GetToken())
|
||||
{
|
||||
if (sc.TokenType == '}')
|
||||
{
|
||||
return;
|
||||
}
|
||||
sc.TokenMustBe(TK_Identifier);
|
||||
if (sc.Compare("scale"))
|
||||
{
|
||||
sc.MustGetToken('=');
|
||||
sc.MustGetToken(TK_FloatConst);
|
||||
opts.Scale = sc.Float;
|
||||
}
|
||||
else if (sc.Compare("spin"))
|
||||
{
|
||||
int mul = 1;
|
||||
sc.MustGetToken('=');
|
||||
if (sc.CheckToken('-')) mul = -1;
|
||||
sc.MustGetToken(TK_IntConst);
|
||||
opts.DroppedSpin = opts.PlacedSpin = sc.Number*mul;
|
||||
}
|
||||
else if (sc.Compare("placedspin"))
|
||||
{
|
||||
int mul = 1;
|
||||
sc.MustGetToken('=');
|
||||
if (sc.CheckToken('-')) mul = -1;
|
||||
sc.MustGetToken(TK_IntConst);
|
||||
opts.PlacedSpin = sc.Number*mul;
|
||||
}
|
||||
else if (sc.Compare("droppedspin"))
|
||||
{
|
||||
int mul = 1;
|
||||
sc.MustGetToken('=');
|
||||
if (sc.CheckToken('-')) mul = -1;
|
||||
sc.MustGetToken(TK_IntConst);
|
||||
opts.DroppedSpin = sc.Number*mul;
|
||||
}
|
||||
else if (sc.Compare("angleoffset"))
|
||||
{
|
||||
int mul = 1;
|
||||
sc.MustGetToken('=');
|
||||
if (sc.CheckToken('-')) mul = -1;
|
||||
sc.MustGetAnyToken();
|
||||
if (sc.TokenType == TK_IntConst)
|
||||
{
|
||||
sc.Float = sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.TokenMustBe(TK_FloatConst);
|
||||
}
|
||||
opts.AngleOffset = mul * sc.Float + 90.;
|
||||
}
|
||||
else if (sc.Compare("overridepalette"))
|
||||
{
|
||||
opts.OverridePalette = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptMessage("Unknown voxel option '%s'\n", sc.String);
|
||||
if (sc.CheckToken('='))
|
||||
{
|
||||
sc.MustGetAnyToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.ScriptMessage("Unterminated voxel option block\n");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// VOX_GetVoxel
|
||||
|
@ -613,7 +468,7 @@ static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static FVoxel *VOX_GetVoxel(int lumpnum)
|
||||
FVoxel* VOX_GetVoxel(int lumpnum)
|
||||
{
|
||||
// Is this voxel already loaded? If so, return it.
|
||||
for (unsigned i = 0; i < Voxels.Size(); ++i)
|
||||
|
@ -623,7 +478,7 @@ static FVoxel *VOX_GetVoxel(int lumpnum)
|
|||
return Voxels[i];
|
||||
}
|
||||
}
|
||||
FVoxel *vox = R_LoadKVX(lumpnum);
|
||||
FVoxel* vox = R_LoadKVX(lumpnum);
|
||||
if (vox != NULL)
|
||||
{
|
||||
Voxels.Push(vox);
|
||||
|
@ -631,83 +486,4 @@ static FVoxel *VOX_GetVoxel(int lumpnum)
|
|||
return vox;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_InitVoxels
|
||||
//
|
||||
// Process VOXELDEF lumps for defining voxel options that cannot be
|
||||
// condensed neatly into a sprite name format.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_InitVoxels()
|
||||
{
|
||||
int lump, lastlump = 0;
|
||||
|
||||
while ((lump = fileSystem.FindLump("VOXELDEF", &lastlump)) != -1)
|
||||
{
|
||||
FScanner sc(lump);
|
||||
TArray<uint32_t> vsprites;
|
||||
|
||||
while (VOX_ReadSpriteNames(sc, vsprites))
|
||||
{
|
||||
FVoxel *voxeldata = NULL;
|
||||
int voxelfile;
|
||||
VoxelOptions opts;
|
||||
|
||||
sc.SetCMode(true);
|
||||
sc.MustGetToken(TK_StringConst);
|
||||
voxelfile = fileSystem.CheckNumForFullName(sc.String, true, ns_voxels);
|
||||
if (voxelfile < 0)
|
||||
{
|
||||
sc.ScriptMessage("Voxel \"%s\" not found.\n", sc.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
voxeldata = VOX_GetVoxel(voxelfile);
|
||||
if (voxeldata == NULL)
|
||||
{
|
||||
sc.ScriptMessage("\"%s\" is not a valid voxel file.\n", sc.String);
|
||||
}
|
||||
}
|
||||
if (sc.CheckToken('{'))
|
||||
{
|
||||
VOX_ReadOptions(sc, opts);
|
||||
}
|
||||
sc.SetCMode(false);
|
||||
if (voxeldata != NULL && vsprites.Size() != 0)
|
||||
{
|
||||
if (opts.OverridePalette)
|
||||
{
|
||||
voxeldata->RemovePalette();
|
||||
}
|
||||
FVoxelDef *def = new FVoxelDef;
|
||||
|
||||
def->Voxel = voxeldata;
|
||||
def->Scale = opts.Scale;
|
||||
def->DroppedSpin = opts.DroppedSpin;
|
||||
def->PlacedSpin = opts.PlacedSpin;
|
||||
def->AngleOffset = opts.AngleOffset;
|
||||
VoxelDefs.Push(def);
|
||||
|
||||
for (unsigned i = 0; i < vsprites.Size(); ++i)
|
||||
{
|
||||
int sprnum = int(vsprites[i] & 0xFFFFFF);
|
||||
int frame = int(vsprites[i] >> 24);
|
||||
if (frame == 255)
|
||||
{ // Apply voxel to all frames.
|
||||
for (int j = MAX_SPRITE_FRAMES - 1; j >= 0; --j)
|
||||
{
|
||||
VOX_AddVoxel(sprnum, j, def);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Apply voxel to only one frame.
|
||||
VOX_AddVoxel(sprnum, frame, def);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef __RES_VOXEL_H
|
||||
#define __RES_VOXEL_H
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#include <stdint.h>
|
||||
// [RH] Voxels from Build
|
||||
|
||||
#define MAXVOXMIPS 5
|
||||
|
@ -76,8 +75,9 @@ struct FVoxelDef
|
|||
extern TDeletingArray<FVoxel *> Voxels; // used only to auto-delete voxels on exit.
|
||||
extern TDeletingArray<FVoxelDef *> VoxelDefs;
|
||||
|
||||
FVoxel* VOX_GetVoxel(int lumpnum);
|
||||
|
||||
FVoxel *R_LoadKVX(int lumpnum);
|
||||
FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin);
|
||||
void R_InitVoxels();
|
||||
|
||||
#endif
|
|
@ -110,7 +110,7 @@ enum EInPlace { EC_InPlace };
|
|||
|
||||
#define DECLARE_ABSTRACT_CLASS(cls,parent) \
|
||||
public: \
|
||||
virtual PClass *StaticType() const; \
|
||||
PClass *StaticType() const override; \
|
||||
static ClassReg RegistrationInfo, * const RegistrationInfoPtr; \
|
||||
typedef parent Super; \
|
||||
private: \
|
||||
|
|
|
@ -35,20 +35,18 @@
|
|||
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
#include "c_buttons.h"
|
||||
#include "c_console.h"
|
||||
#include "c_cvars.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "d_event.h"
|
||||
#include "c_buttons.h"
|
||||
#include "d_gui.h"
|
||||
#include "dikeys.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "v_video.h"
|
||||
#include "events.h"
|
||||
#include "g_game.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "i_interface.h"
|
||||
#include "menustate.h"
|
||||
#include "engineerrors.h"
|
||||
#include "keydef.h"
|
||||
|
||||
|
||||
EXTERN_CVAR(Int, m_use_mouse)
|
||||
|
@ -61,7 +59,7 @@ CVAR(Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
extern int paused, chatmodeon;
|
||||
extern constate_e ConsoleState;
|
||||
|
||||
extern bool ToggleFullscreen;
|
||||
bool GUICapture;
|
||||
|
||||
|
||||
|
@ -77,22 +75,17 @@ size_t s_skipMouseMoves;
|
|||
|
||||
void CheckGUICapture()
|
||||
{
|
||||
bool wantCapture = (MENU_Off == menuactive)
|
||||
? (c_down == ConsoleState || c_falling == ConsoleState || chatmodeon)
|
||||
: (MENU_On == menuactive || MENU_OnNoPause == menuactive);
|
||||
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
|
||||
|
||||
// [ZZ] check active event handlers that want the UI processing
|
||||
if (!wantCapture && primaryLevel->localEventManager->CheckUiProcessors())
|
||||
if (wantCapt != GUICapture)
|
||||
{
|
||||
wantCapture = true;
|
||||
GUICapture = wantCapt;
|
||||
if (wantCapt)
|
||||
{
|
||||
buttonMap.ResetButtonStates();
|
||||
}
|
||||
}
|
||||
|
||||
if (wantCapture != GUICapture)
|
||||
{
|
||||
GUICapture = wantCapture;
|
||||
|
||||
buttonMap.ResetButtonStates();
|
||||
}
|
||||
}
|
||||
|
||||
void SetCursorPosition(const NSPoint position)
|
||||
|
@ -160,7 +153,7 @@ void CheckNativeMouse()
|
|||
{
|
||||
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
|
||||
wantNative = (!m_use_mouse || MENU_WaitKey != menuactive)
|
||||
&& (!captureModeInGame || GUICapture || paused || demoplayback);
|
||||
&& (!captureModeInGame || GUICapture);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -170,7 +163,7 @@ void CheckNativeMouse()
|
|||
&& (MENU_On == menuactive || MENU_OnNoPause == menuactive);
|
||||
}
|
||||
|
||||
if (!wantNative && primaryLevel->localEventManager->CheckRequireMouse())
|
||||
if (!wantNative && sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse())
|
||||
wantNative = true;
|
||||
|
||||
I_SetNativeMouse(wantNative);
|
|
@ -36,12 +36,13 @@
|
|||
#include <IOKit/hid/IOHIDLib.h>
|
||||
|
||||
#include "d_event.h"
|
||||
#include "doomdef.h"
|
||||
#include "i_system.h"
|
||||
#include "m_argv.h"
|
||||
#include "m_joy.h"
|
||||
#include "templates.h"
|
||||
#include "v_text.h"
|
||||
#include "printf.h"
|
||||
#include "keydef.h"
|
||||
|
||||
|
||||
EXTERN_CVAR(Bool, joy_axespolling)
|
|
@ -32,20 +32,20 @@
|
|||
*/
|
||||
|
||||
#include "i_common.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_soundinternal.h"
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "c_console.h"
|
||||
#include "c_cvars.h"
|
||||
#include "cmdlib.h"
|
||||
#include "d_main.h"
|
||||
#include "i_system.h"
|
||||
#include "m_argv.h"
|
||||
#include "st_console.h"
|
||||
#include "version.h"
|
||||
#include "engineerrors.h"
|
||||
#include "printf.h"
|
||||
#include "s_music.h"
|
||||
#include "engineerrors.h"
|
||||
|
||||
|
||||
#define ZD_UNUSED(VARIABLE) ((void)(VARIABLE))
|
||||
|
@ -59,7 +59,7 @@ EXTERN_CVAR(Int, vid_defwidth )
|
|||
EXTERN_CVAR(Int, vid_defheight)
|
||||
EXTERN_CVAR(Bool, vid_vsync )
|
||||
|
||||
|
||||
int GameMain();
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -169,7 +169,7 @@ int DoMain(int argc, char** argv)
|
|||
progdir = [[exePath stringByDeletingLastPathComponent] UTF8String];
|
||||
progdir += "/";
|
||||
|
||||
auto ret = D_DoomMain();
|
||||
auto ret = GameMain();
|
||||
FConsoleWindow::DeleteInstance();
|
||||
return ret;
|
||||
}
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "i_common.h"
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "i_system.h"
|
|
@ -44,21 +44,24 @@
|
|||
#include "v_video.h"
|
||||
#include "bitmap.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "doomstat.h"
|
||||
#include "hardware.h"
|
||||
#include "i_system.h"
|
||||
#include "m_argv.h"
|
||||
#include "m_png.h"
|
||||
#include "swrenderer/r_swrenderer.h"
|
||||
#include "st_console.h"
|
||||
#include "v_text.h"
|
||||
#include "version.h"
|
||||
#include "engineerrors.h"
|
||||
#include "printf.h"
|
||||
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl_framebuffer.h"
|
||||
#ifdef HAVE_VULKAN
|
||||
#include "vulkan/system/vk_framebuffer.h"
|
||||
#include "rendering/polyrenderer/backend/poly_framebuffer.h"
|
||||
#endif
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
#include "poly_framebuffer.h"
|
||||
#endif
|
||||
|
||||
extern bool ToggleFullscreen;
|
||||
|
||||
@implementation NSWindow(ExitAppOnClose)
|
||||
|
||||
|
@ -441,6 +444,8 @@ public:
|
|||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (vid_preferbackend == 2)
|
||||
{
|
||||
SetupOpenGLView(ms_window, OpenGLProfile::Legacy);
|
||||
|
@ -448,6 +453,7 @@ public:
|
|||
fb = new PolyFrameBuffer(nullptr, vid_fullscreen);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SetupOpenGLView(ms_window, OpenGLProfile::Core);
|
||||
}
|
||||
|
@ -461,6 +467,7 @@ public:
|
|||
fb->SetMode(vid_fullscreen, vid_hidpi);
|
||||
fb->SetSize(fb->GetClientWidth(), fb->GetClientHeight());
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
// This lame hack is a temporary workaround for strange performance issues
|
||||
// with fullscreen window and Core Animation's Metal layer
|
||||
// It is somehow related to initial window level and flags
|
||||
|
@ -470,6 +477,7 @@ public:
|
|||
fb->SetMode(false, vid_hidpi);
|
||||
fb->SetMode(true, vid_hidpi);
|
||||
}
|
||||
#endif
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
@ -480,8 +488,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
#ifdef HAVE_VULKAN
|
||||
VulkanDevice *m_vulkanDevice = nullptr;
|
||||
|
||||
#endif
|
||||
static CocoaWindow* ms_window;
|
||||
|
||||
static bool ms_isVulkanEnabled;
|
||||
|
@ -798,7 +807,7 @@ CUSTOM_CVAR(Bool, vid_hidpi, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool I_SetCursor(FTexture *cursorpic)
|
||||
bool I_SetCursor(FGameTexture *cursorpic)
|
||||
{
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSCursor* cursor = nil;
|
||||
|
@ -807,7 +816,7 @@ bool I_SetCursor(FTexture *cursorpic)
|
|||
{
|
||||
// Create bitmap image representation
|
||||
|
||||
auto sbuffer = cursorpic->CreateTexBuffer(0);
|
||||
auto sbuffer = cursorpic->GetTexture()->CreateTexBuffer(0);
|
||||
|
||||
const NSInteger imageWidth = sbuffer.mWidth;
|
||||
const NSInteger imageHeight = sbuffer.mHeight;
|
|
@ -32,12 +32,13 @@
|
|||
*/
|
||||
|
||||
#include "i_common.h"
|
||||
|
||||
#include "d_main.h"
|
||||
#include "startupinfo.h"
|
||||
#include "st_console.h"
|
||||
#include "v_text.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "palentry.h"
|
||||
#include "v_video.h"
|
||||
#include "v_font.h"
|
||||
|
||||
static NSColor* RGB(const uint8_t red, const uint8_t green, const uint8_t blue)
|
||||
{
|
||||
|
@ -339,17 +340,17 @@ void FConsoleWindow::SetTitleText()
|
|||
// It's used in graphical startup screen, with Hexen style in particular
|
||||
// Native OS X backend doesn't implement this yet
|
||||
|
||||
if (DoomStartupInfo.FgColor == DoomStartupInfo.BkColor)
|
||||
if (GameStartupInfo.FgColor == GameStartupInfo.BkColor)
|
||||
{
|
||||
DoomStartupInfo.FgColor = ~DoomStartupInfo.FgColor;
|
||||
GameStartupInfo.FgColor = ~GameStartupInfo.FgColor;
|
||||
}
|
||||
|
||||
NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect];
|
||||
[titleText setStringValue:[NSString stringWithCString:DoomStartupInfo.Name
|
||||
[titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name.GetChars()
|
||||
encoding:NSISOLatin1StringEncoding]];
|
||||
[titleText setAlignment:NSCenterTextAlignment];
|
||||
[titleText setTextColor:RGB(DoomStartupInfo.FgColor)];
|
||||
[titleText setBackgroundColor:RGB(DoomStartupInfo.BkColor)];
|
||||
[titleText setTextColor:RGB(GameStartupInfo.FgColor)];
|
||||
[titleText setBackgroundColor:RGB(GameStartupInfo.BkColor)];
|
||||
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
|
||||
[titleText setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
|
||||
[titleText setSelectable:NO];
|
|
@ -36,9 +36,9 @@
|
|||
#import <Foundation/NSRunLoop.h>
|
||||
|
||||
#include "c_cvars.h"
|
||||
#include "doomtype.h"
|
||||
#include "st_console.h"
|
||||
#include "st_start.h"
|
||||
#include "printf.h"
|
||||
#include "engineerrors.h"
|
||||
|
||||
|
70
src/common/platform/posix/i_system.h
Normal file
70
src/common/platform/posix/i_system.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
#ifndef __I_SYSTEM__
|
||||
#define __I_SYSTEM__
|
||||
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(__sun) || defined(__sun__) || defined(__SRV4) || defined(__srv4__)
|
||||
#define __solaris__ 1
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
#include <algorithm>
|
||||
#include "tarray.h"
|
||||
#include "zstring.h"
|
||||
|
||||
struct ticcmd_t;
|
||||
struct WadStuff;
|
||||
|
||||
#ifndef SHARE_DIR
|
||||
#define SHARE_DIR "/usr/local/share/"
|
||||
#endif
|
||||
|
||||
void CalculateCPUSpeed(void);
|
||||
|
||||
// Return a seed value for the RNG.
|
||||
unsigned int I_MakeRNGSeed();
|
||||
|
||||
|
||||
|
||||
void I_StartFrame (void);
|
||||
|
||||
void I_StartTic (void);
|
||||
|
||||
// Print a console string
|
||||
void I_PrintStr (const char *str);
|
||||
|
||||
// Set the title string of the startup window
|
||||
void I_SetIWADInfo ();
|
||||
|
||||
// Pick from multiple IWADs to use
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
|
||||
|
||||
// [RH] Checks the registry for Steam's install path, so we can scan its
|
||||
// directories for IWADs if the user purchased any through Steam.
|
||||
TArray<FString> I_GetSteamPath();
|
||||
|
||||
TArray<FString> I_GetGogPaths();
|
||||
|
||||
// The ini could not be saved at exit
|
||||
bool I_WriteIniFailed ();
|
||||
|
||||
class FGameTexture;
|
||||
bool I_SetCursor(FGameTexture *);
|
||||
|
||||
static inline char *strlwr(char *str)
|
||||
{
|
||||
char *ptr = str;
|
||||
while(*ptr)
|
||||
{
|
||||
*ptr = tolower(*ptr);
|
||||
++ptr;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
inline int I_GetNumaNodeCount() { return 1; }
|
||||
inline int I_GetNumaNodeThreadCount(int numaNode) { return std::max<int>(std::thread::hardware_concurrency(), 1); }
|
||||
inline void I_SetThreadNumaNode(std::thread &thread, int numaNode) { }
|
||||
|
||||
#endif
|
53
src/common/platform/posix/i_system_posix.cpp
Normal file
53
src/common/platform/posix/i_system_posix.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2016 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. 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.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
#include <fnmatch.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif // __APPLE__
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "i_system.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "x86.h"
|
||||
|
||||
|
||||
bool I_WriteIniFailed()
|
||||
{
|
||||
printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno));
|
||||
return false; // return true to retry
|
||||
}
|
||||
|
||||
TArray<FString> I_GetGogPaths()
|
||||
{
|
||||
// GOG's Doom games are Windows only at the moment
|
||||
return TArray<FString>();
|
||||
}
|
|
@ -36,9 +36,10 @@
|
|||
#import <Foundation/NSFileManager.h>
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "m_misc.h"
|
||||
#include "version.h" // for GAMENAME
|
||||
#include "i_specialpaths.h"
|
||||
|
||||
FString M_GetMacAppSupportPath(const bool create);
|
||||
|
||||
static FString GetSpecialPath(const NSSearchPathDirectory kind, const BOOL create = YES, const NSSearchPathDomainMask domain = NSUserDomainMask)
|
||||
{
|
||||
|
@ -199,7 +200,7 @@ FString M_GetScreenshotsPath()
|
|||
{
|
||||
path += "/" GAME_DIR "/Screenshots/";
|
||||
}
|
||||
|
||||
CreatePath(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -240,5 +241,45 @@ FString M_GetDocumentsPath()
|
|||
path += "/" GAME_DIR "/";
|
||||
}
|
||||
|
||||
CreatePath(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetDemoPath macOS
|
||||
//
|
||||
// Returns the path to the default demo directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetDemoPath()
|
||||
{
|
||||
FString path = GetSpecialPath(NSDocumentDirectory);
|
||||
|
||||
if (path.IsNotEmpty())
|
||||
{
|
||||
path += "/" GAME_DIR "/Demos/";
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_NormalizedPath
|
||||
//
|
||||
// Normalizes the given path and returns the result.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetNormalizedPath(const char* path)
|
||||
{
|
||||
NSString *str = [NSString stringWithUTF8String:path];
|
||||
NSString *out;
|
||||
if ([str completePathIntoString:&out caseSensitive:NO matchesIntoArray:nil filterTypes:nil])
|
||||
{
|
||||
return out.UTF8String;
|
||||
}
|
||||
return path;
|
||||
}
|
|
@ -34,13 +34,12 @@
|
|||
*/
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "d_main.h"
|
||||
#include "version.h"
|
||||
#include "c_cvars.h"
|
||||
#include "m_argv.h"
|
||||
#include "m_misc.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "engineerrors.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <wordexp.h>
|
||||
|
@ -385,8 +384,10 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
|
|||
|
||||
defaultiwad = wad.Name;
|
||||
|
||||
GameConfig->DoGameSetup("Doom");
|
||||
M_SaveDefaults(NULL);
|
||||
GameConfig->ArchiveGlobalData();
|
||||
GameConfig->WriteConfigFile();
|
||||
delete GameConfig;
|
||||
GameConfig = nullptr;
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef PR_SET_PTRACER
|
||||
#define PR_SET_PTRACER 0x59616d61
|
||||
#endif
|
||||
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__)
|
||||
#elif defined (__APPLE__) || defined (BSD)
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
|
@ -39,10 +39,9 @@
|
|||
#include "hardware.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "v_text.h"
|
||||
#include "doomstat.h"
|
||||
#include "m_argv.h"
|
||||
#include "engineerrors.h"
|
||||
#include "swrenderer/r_swrenderer.h"
|
||||
#include "c_console.h"
|
||||
#include "printf.h"
|
||||
|
||||
IVideo *Video;
|
||||
|
|
@ -36,17 +36,16 @@
|
|||
#include <SDL.h>
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "v_palette.h"
|
||||
#include "textures.h"
|
||||
|
||||
bool I_SetCursor(FTexture *cursorpic)
|
||||
bool I_SetCursor(FGameTexture *cursorpic)
|
||||
{
|
||||
static SDL_Cursor *cursor;
|
||||
static SDL_Surface *cursorSurface;
|
||||
|
||||
if (cursorpic != NULL && cursorpic->isValid())
|
||||
{
|
||||
auto src = cursorpic->GetBgraBitmap(nullptr);
|
||||
auto src = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
|
||||
// Must be no larger than 32x32.
|
||||
if (src.GetWidth() > 32 || src.GetHeight() > 32)
|
||||
{
|
|
@ -31,23 +31,18 @@
|
|||
**
|
||||
*/
|
||||
#include <SDL.h>
|
||||
#include "doomtype.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "m_argv.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#include "d_main.h"
|
||||
#include "d_event.h"
|
||||
#include "d_gui.h"
|
||||
#include "c_buttons.h"
|
||||
#include "c_console.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "dikeys.h"
|
||||
#include "events.h"
|
||||
#include "g_game.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "utf8.h"
|
||||
#include "keydef.h"
|
||||
#include "i_interface.h"
|
||||
#include "engineerrors.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
|
@ -58,8 +53,6 @@ static void I_CheckNativeMouse ();
|
|||
bool GUICapture;
|
||||
static bool NativeMouse = true;
|
||||
|
||||
extern int paused;
|
||||
|
||||
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -174,25 +167,15 @@ static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(InitKeyScanMap());
|
|||
|
||||
static void I_CheckGUICapture ()
|
||||
{
|
||||
bool wantCapt;
|
||||
|
||||
if (menuactive == MENU_Off)
|
||||
{
|
||||
wantCapt = ConsoleState == c_down || ConsoleState == c_falling || chatmodeon;
|
||||
}
|
||||
else
|
||||
{
|
||||
wantCapt = (menuactive == MENU_On || menuactive == MENU_OnNoPause);
|
||||
}
|
||||
|
||||
// [ZZ] check active event handlers that want the UI processing
|
||||
if (!wantCapt && primaryLevel->localEventManager->CheckUiProcessors())
|
||||
wantCapt = true;
|
||||
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
|
||||
|
||||
if (wantCapt != GUICapture)
|
||||
{
|
||||
GUICapture = wantCapt;
|
||||
buttonMap.ResetButtonStates();
|
||||
if (wantCapt)
|
||||
{
|
||||
buttonMap.ResetButtonStates();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,10 +239,12 @@ static void MouseRead ()
|
|||
static void I_CheckNativeMouse ()
|
||||
{
|
||||
bool focus = SDL_GetKeyboardFocus() != NULL;
|
||||
bool fs = screen->IsFullscreen();
|
||||
|
||||
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
|
||||
bool wantNative = !focus || (!use_mouse || GUICapture || paused || demoplayback || !captureModeInGame);
|
||||
bool wantNative = !focus || (!use_mouse || GUICapture || !captureModeInGame);
|
||||
|
||||
if (!wantNative && sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse())
|
||||
wantNative = true;
|
||||
|
||||
if (wantNative != NativeMouse)
|
||||
{
|
|
@ -33,6 +33,7 @@
|
|||
#include <SDL.h>
|
||||
|
||||
#include "basics.h"
|
||||
#include "cmdlib.h"
|
||||
#include "templates.h"
|
||||
#include "m_joy.h"
|
||||
#include "keydef.h"
|
||||
|
@ -299,8 +300,10 @@ static SDLInputJoystickManager *JoystickManager;
|
|||
|
||||
void I_StartupJoysticks()
|
||||
{
|
||||
#ifndef NO_SDL_JOYSTICK
|
||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
||||
JoystickManager = new SDLInputJoystickManager();
|
||||
#endif
|
||||
}
|
||||
void I_ShutdownInput()
|
||||
{
|
||||
|
@ -315,7 +318,8 @@ void I_GetJoysticks(TArray<IJoystickConfig *> &sticks)
|
|||
{
|
||||
sticks.Clear();
|
||||
|
||||
JoystickManager->GetDevices(sticks);
|
||||
if (JoystickManager)
|
||||
JoystickManager->GetDevices(sticks);
|
||||
}
|
||||
|
||||
void I_GetAxes(float axes[NUM_JOYAXIS])
|
||||
|
@ -324,7 +328,7 @@ void I_GetAxes(float axes[NUM_JOYAXIS])
|
|||
{
|
||||
axes[i] = 0;
|
||||
}
|
||||
if (use_joystick)
|
||||
if (use_joystick && JoystickManager)
|
||||
{
|
||||
JoystickManager->AddAxes(axes);
|
||||
}
|
||||
|
@ -332,7 +336,7 @@ void I_GetAxes(float axes[NUM_JOYAXIS])
|
|||
|
||||
void I_ProcessJoysticks()
|
||||
{
|
||||
if (use_joystick)
|
||||
if (use_joystick && JoystickManager)
|
||||
JoystickManager->ProcessInput();
|
||||
}
|
||||
|
|
@ -43,19 +43,12 @@
|
|||
|
||||
#include "engineerrors.h"
|
||||
#include "m_argv.h"
|
||||
#include "d_main.h"
|
||||
#include "c_console.h"
|
||||
#include "version.h"
|
||||
#include "filesystem.h"
|
||||
#include "g_level.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "cmdlib.h"
|
||||
#include "r_utility.h"
|
||||
#include "doomstat.h"
|
||||
#include "vm.h"
|
||||
#include "engineerrors.h"
|
||||
#include "i_system.h"
|
||||
#include "g_game.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -74,6 +67,7 @@ void Linux_I_FatalError(const char* errortext);
|
|||
#endif
|
||||
|
||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||
int GameMain();
|
||||
|
||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
|
@ -91,62 +85,10 @@ FArgs *Args;
|
|||
|
||||
|
||||
|
||||
static int DoomSpecificInfo (char *buffer, char *end)
|
||||
static int GetCrashInfo (char *buffer, char *end)
|
||||
{
|
||||
const char *arg;
|
||||
int size = end-buffer-2;
|
||||
int i, p;
|
||||
|
||||
p = 0;
|
||||
p += snprintf (buffer+p, size-p, GAMENAME" version %s (%s)\n", GetVersionString(), GetGitHash());
|
||||
#ifdef __VERSION__
|
||||
p += snprintf (buffer+p, size-p, "Compiler version: %s\n", __VERSION__);
|
||||
#endif
|
||||
|
||||
// If Args is nullptr, then execution is at either
|
||||
// * early stage of initialization, additional info contains only default values
|
||||
// * late stage of shutdown, most likely main() was done, and accessing global variables is no longer safe
|
||||
if (Args)
|
||||
{
|
||||
p += snprintf(buffer + p, size - p, "\nCommand line:");
|
||||
for (i = 0; i < Args->NumArgs(); ++i)
|
||||
{
|
||||
p += snprintf(buffer + p, size - p, " %s", Args->GetArg(i));
|
||||
}
|
||||
p += snprintf(buffer + p, size - p, "\n");
|
||||
|
||||
for (i = 0; (arg = fileSystem.GetResourceFileName(i)) != NULL; ++i)
|
||||
{
|
||||
p += snprintf(buffer + p, size - p, "\nWad %d: %s", i, arg);
|
||||
}
|
||||
|
||||
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
|
||||
{
|
||||
p += snprintf(buffer + p, size - p, "\n\nNot in a level.");
|
||||
}
|
||||
else
|
||||
{
|
||||
p += snprintf(buffer + p, size - p, "\n\nCurrent map: %s", primaryLevel->MapName.GetChars());
|
||||
|
||||
if (!viewactive)
|
||||
{
|
||||
p += snprintf(buffer + p, size - p, "\n\nView not active.");
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& vp = r_viewpoint;
|
||||
p += snprintf(buffer + p, size - p, "\n\nviewx = %f", vp.Pos.X);
|
||||
p += snprintf(buffer + p, size - p, "\nviewy = %f", vp.Pos.Y);
|
||||
p += snprintf(buffer + p, size - p, "\nviewz = %f", vp.Pos.Z);
|
||||
p += snprintf(buffer + p, size - p, "\nviewangle = %f", vp.Angles.Yaw.Degrees);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer[p++] = '\n';
|
||||
buffer[p++] = '\0';
|
||||
|
||||
return p;
|
||||
if (sysCallbacks && sysCallbacks->CrashInfo) sysCallbacks->CrashInfo(buffer, end - buffer, "\n");
|
||||
return strlen(buffer);
|
||||
}
|
||||
|
||||
void I_DetectOS()
|
||||
|
@ -161,7 +103,7 @@ int main (int argc, char **argv)
|
|||
#if !defined (__APPLE__)
|
||||
{
|
||||
int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS };
|
||||
cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", DoomSpecificInfo);
|
||||
cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", GetCrashInfo);
|
||||
}
|
||||
#endif // !__APPLE__
|
||||
|
||||
|
@ -203,7 +145,7 @@ int main (int argc, char **argv)
|
|||
|
||||
I_StartupJoysticks();
|
||||
|
||||
const int result = D_DoomMain();
|
||||
const int result = GameMain();
|
||||
|
||||
SDL_Quit();
|
||||
|
|
@ -1,35 +1,60 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright 1993-1996 id Software
|
||||
// Copyright 1999-2016 Randy Heit
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** i_system.cpp
|
||||
** Main startup code
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1999-2016 Randy Heit
|
||||
** Copyright 2019-2020 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. 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.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#include <dirent.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fnmatch.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "d_main.h"
|
||||
#include "i_system.h"
|
||||
#include "version.h"
|
||||
#include "x86.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "cmdlib.h"
|
||||
#include "m_argv.h"
|
||||
#include "i_sound.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
#ifndef NO_GTK
|
||||
bool I_GtkAvailable ();
|
||||
int I_PickIWad_Gtk (WadStuff *wads, int numwads, bool showwin, int defaultiwad);
|
||||
|
@ -52,8 +77,8 @@ void I_SetIWADInfo()
|
|||
void Mac_I_FatalError(const char* errortext);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
void Linux_I_FatalError(const char* errortext)
|
||||
#ifdef __unix__
|
||||
void Unix_I_FatalError(const char* errortext)
|
||||
{
|
||||
// Close window or exit fullscreen and release mouse capture
|
||||
SDL_Quit();
|
||||
|
@ -90,8 +115,8 @@ void I_ShowFatalError(const char *message)
|
|||
{
|
||||
#ifdef __APPLE__
|
||||
Mac_I_FatalError(message);
|
||||
#elif defined __linux__
|
||||
Linux_I_FatalError(message);
|
||||
#elif defined __unix__
|
||||
Unix_I_FatalError(message);
|
||||
#else
|
||||
// ???
|
||||
#endif
|
|
@ -33,9 +33,8 @@
|
|||
|
||||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#include "i_module.h"
|
||||
#include "i_soundinternal.h"
|
||||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
#include "m_argv.h"
|
||||
|
@ -43,22 +42,22 @@
|
|||
#include "version.h"
|
||||
#include "c_console.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "s_sound.h"
|
||||
#include "printf.h"
|
||||
|
||||
#include "hardware.h"
|
||||
#include "gl_sysfb.h"
|
||||
#include "gl_system.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_framebuffer.h"
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
#include "rendering/vulkan/system/vk_framebuffer.h"
|
||||
#include "vulkan/system/vk_framebuffer.h"
|
||||
#endif
|
||||
|
||||
#include "rendering/polyrenderer/backend/poly_framebuffer.h"
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
#include "poly_framebuffer.h"
|
||||
#endif
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -76,7 +75,7 @@
|
|||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||
|
||||
extern double refreshfreq;
|
||||
extern IVideo *Video;
|
||||
|
||||
EXTERN_CVAR (Int, vid_adapter)
|
||||
|
@ -261,6 +260,7 @@ bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
namespace
|
||||
{
|
||||
SDL_Renderer* polyrendertarget = nullptr;
|
||||
|
@ -409,7 +409,7 @@ void I_PolyPresentDeinit()
|
|||
polyrendertarget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
SDLVideo::SDLVideo ()
|
||||
|
@ -428,7 +428,9 @@ SDLVideo::SDLVideo ()
|
|||
}
|
||||
#endif // !SDL2_STATIC_LIBRARY
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
Priv::softpolyEnabled = vid_preferbackend == 2;
|
||||
#endif
|
||||
#ifdef HAVE_VULKAN
|
||||
Priv::vulkanEnabled = vid_preferbackend == 1
|
||||
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
|
||||
|
@ -443,10 +445,25 @@ SDLVideo::SDLVideo ()
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (Priv::softpolyEnabled)
|
||||
{
|
||||
Priv::CreateWindow(SDL_WINDOW_HIDDEN);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get refresh rate for current display.
|
||||
SDL_DisplayMode display;
|
||||
|
||||
if(SDL_GetCurrentDisplayMode(vid_adapter, &display) == 0)
|
||||
{
|
||||
refreshfreq = display.refresh_rate;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Failed to get refresh rate: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SDLVideo::~SDLVideo ()
|
||||
|
@ -482,11 +499,12 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (Priv::softpolyEnabled)
|
||||
{
|
||||
fb = new PolyFrameBuffer(nullptr, vid_fullscreen);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (fb == nullptr)
|
||||
{
|
||||
fb = new OpenGLRenderer::OpenGLFrameBuffer(0, vid_fullscreen);
|
||||
|
@ -518,6 +536,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
|
|||
{
|
||||
int width = 0;
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (Priv::softpolyEnabled)
|
||||
{
|
||||
if (polyrendertarget)
|
||||
|
@ -526,6 +545,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
|
|||
SDL_GetWindowSize(Priv::window, &width, nullptr);
|
||||
return width;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
assert(Priv::vulkanEnabled);
|
||||
|
@ -538,7 +558,8 @@ int SystemBaseFrameBuffer::GetClientWidth()
|
|||
int SystemBaseFrameBuffer::GetClientHeight()
|
||||
{
|
||||
int height = 0;
|
||||
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (Priv::softpolyEnabled)
|
||||
{
|
||||
if (polyrendertarget)
|
||||
|
@ -547,6 +568,7 @@ int SystemBaseFrameBuffer::GetClientHeight()
|
|||
SDL_GetWindowSize(Priv::window, nullptr, &height);
|
||||
return height;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
assert(Priv::vulkanEnabled);
|
||||
|
@ -588,7 +610,7 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h)
|
|||
}
|
||||
win_w = w;
|
||||
win_h = h;
|
||||
if (vid_fullscreen )
|
||||
if (vid_fullscreen)
|
||||
{
|
||||
vid_fullscreen = false;
|
||||
}
|
|
@ -40,7 +40,6 @@
|
|||
#include <functional>
|
||||
|
||||
#include "st_start.h"
|
||||
#include "doomdef.h"
|
||||
#include "i_system.h"
|
||||
#include "c_cvars.h"
|
||||
#include "engineerrors.h"
|
|
@ -55,10 +55,13 @@ typedef enum
|
|||
#endif
|
||||
|
||||
#include "c_cvars.h"
|
||||
#include "d_main.h"
|
||||
#include "i_module.h"
|
||||
#include "i_system.h"
|
||||
#include "version.h"
|
||||
#include "startupinfo.h"
|
||||
#include "cmdlib.h"
|
||||
#include "i_interface.h"
|
||||
#include "printf.h"
|
||||
|
||||
EXTERN_CVAR (Bool, queryiwad);
|
||||
|
|
@ -44,7 +44,9 @@
|
|||
#include "version.h"
|
||||
#include "printf.h"
|
||||
#include "win32glvideo.h"
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
#include "win32polyvideo.h"
|
||||
#endif
|
||||
#ifdef HAVE_VULKAN
|
||||
#include "win32vulkanvideo.h"
|
||||
#endif
|
||||
|
@ -129,12 +131,15 @@ void I_InitGraphics ()
|
|||
// are the active app. Huh?
|
||||
}
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (vid_preferbackend == 2)
|
||||
{
|
||||
Video = new Win32PolyVideo();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_VULKAN
|
||||
else if (vid_preferbackend == 1)
|
||||
if (vid_preferbackend == 1)
|
||||
{
|
||||
// first try Vulkan, if that fails OpenGL
|
||||
try
|
||||
|
@ -147,15 +152,16 @@ void I_InitGraphics ()
|
|||
Video = new Win32GLVideo();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Video = new Win32GLVideo();
|
||||
}
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
if (Video == NULL)
|
||||
Video = new Win32PolyVideo();
|
||||
|
||||
#endif
|
||||
// we somehow STILL don't have a display!!
|
||||
if (Video == NULL)
|
||||
I_FatalError ("Failed to initialize display");
|
|
@ -74,7 +74,7 @@
|
|||
#include "i_sound.h"
|
||||
#include "d_gui.h"
|
||||
#include "c_console.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_soundinternal.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "hardware.h"
|
||||
#include "d_event.h"
|
||||
|
@ -87,8 +87,6 @@
|
|||
#include "c_buttons.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
int32_t refreshfreq = -1;
|
||||
|
||||
// Compensate for w32api's lack
|
||||
#ifndef GET_XBUTTON_WPARAM
|
||||
#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam))
|
||||
|
@ -138,6 +136,7 @@ extern bool AppActive;
|
|||
|
||||
int SessionState = 0;
|
||||
int BlockMouseMove;
|
||||
extern double refreshfreq;
|
||||
|
||||
static bool EventHandlerResultForNativeMouse;
|
||||
|
|
@ -59,17 +59,13 @@
|
|||
#include "hardware.h"
|
||||
|
||||
#include "m_argv.h"
|
||||
#include "d_main.h"
|
||||
#include "i_module.h"
|
||||
#include "c_console.h"
|
||||
#include "version.h"
|
||||
#include "i_input.h"
|
||||
#include "filesystem.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_game.h"
|
||||
#include "r_utility.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_soundinternal.h"
|
||||
#include "vm.h"
|
||||
#include "i_system.h"
|
||||
#include "gstrings.h"
|
||||
|
@ -77,6 +73,9 @@
|
|||
|
||||
#include "stats.h"
|
||||
#include "st_start.h"
|
||||
#include "i_interface.h"
|
||||
#include "startupinfo.h"
|
||||
#include "printf.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -96,6 +95,7 @@ void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
|
|||
void DisplayCrashLog ();
|
||||
void I_FlushBufferedConsoleStuff();
|
||||
void DestroyCustomCursor();
|
||||
int GameMain();
|
||||
|
||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||
|
||||
|
@ -268,7 +268,7 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
|
|||
w = rect.right;
|
||||
h = rect.bottom;
|
||||
|
||||
if (DoomStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
|
||||
if (GameStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
|
||||
{
|
||||
bannerheight = GameTitleFontHeight + 5;
|
||||
MoveWindow (GameTitleWindow, 0, 0, w, bannerheight, TRUE);
|
||||
|
@ -426,7 +426,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
case WM_DRAWITEM:
|
||||
// Draw title banner.
|
||||
if (wParam == IDC_STATIC_TITLE && DoomStartupInfo.Name.IsNotEmpty())
|
||||
if (wParam == IDC_STATIC_TITLE && GameStartupInfo.Name.IsNotEmpty())
|
||||
{
|
||||
const PalEntry *c;
|
||||
|
||||
|
@ -436,7 +436,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
// Draw the background.
|
||||
rect = drawitem->rcItem;
|
||||
rect.bottom -= 1;
|
||||
c = (const PalEntry *)&DoomStartupInfo.BkColor;
|
||||
c = (const PalEntry *)&GameStartupInfo.BkColor;
|
||||
hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
|
||||
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
|
||||
DeleteObject (hbr);
|
||||
|
@ -444,11 +444,11 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
// Calculate width of the title string.
|
||||
SetTextAlign (drawitem->hDC, TA_TOP);
|
||||
oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT));
|
||||
auto widename = DoomStartupInfo.Name.WideString();
|
||||
auto widename = GameStartupInfo.Name.WideString();
|
||||
GetTextExtentPoint32W (drawitem->hDC, widename.c_str(), (int)widename.length(), &size);
|
||||
|
||||
// Draw the title.
|
||||
c = (const PalEntry *)&DoomStartupInfo.FgColor;
|
||||
c = (const PalEntry *)&GameStartupInfo.FgColor;
|
||||
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
|
||||
SetBkMode (drawitem->hDC, TRANSPARENT);
|
||||
TextOutW (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, widename.c_str(), (int)widename.length());
|
||||
|
@ -950,7 +950,7 @@ int DoMain (HINSTANCE hInstance)
|
|||
CoInitialize (NULL);
|
||||
atexit (UnCOM);
|
||||
|
||||
int ret = D_DoomMain ();
|
||||
int ret = GameMain ();
|
||||
DestroyCustomCursor();
|
||||
if (ret == 1337) // special exit code for 'norun'.
|
||||
{
|
||||
|
@ -998,55 +998,6 @@ void I_ShowFatalError(const char *msg)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DoomSpecificInfo
|
||||
//
|
||||
// Called by the crash logger to get application-specific information.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DoomSpecificInfo (char *buffer, size_t bufflen)
|
||||
{
|
||||
const char *arg;
|
||||
char *const buffend = buffer + bufflen - 2; // -2 for CRLF at end
|
||||
int i;
|
||||
|
||||
buffer += mysnprintf (buffer, buffend - buffer, GAMENAME " version %s (%s)", GetVersionString(), GetGitHash());
|
||||
FString cmdline(GetCommandLineW());
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\nCommand line: %s\r\n", cmdline.GetChars() );
|
||||
|
||||
for (i = 0; (arg = fileSystem.GetResourceFileName (i)) != NULL; ++i)
|
||||
{
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\nWad %d: %s", i, arg);
|
||||
}
|
||||
|
||||
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
|
||||
{
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nNot in a level.");
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nCurrent map: %s", primaryLevel->MapName.GetChars());
|
||||
|
||||
if (!viewactive)
|
||||
{
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nView not active.");
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &vp = r_viewpoint;
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nviewx = %f", vp.Pos.X);
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewy = %f", vp.Pos.Y);
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewz = %f", vp.Pos.Z);
|
||||
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewangle = %f", vp.Angles.Yaw);
|
||||
}
|
||||
}
|
||||
*buffer++ = '\r';
|
||||
*buffer++ = '\n';
|
||||
*buffer++ = '\0';
|
||||
}
|
||||
|
||||
// Here is how the error logging system works.
|
||||
//
|
||||
// To catch exceptions that occur in secondary threads, CatchAllExceptions is
|
||||
|
@ -1139,7 +1090,7 @@ LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
|
|||
char *custominfo = (char *)HeapAlloc (GetProcessHeap(), 0, 16384);
|
||||
|
||||
CrashPointers = *info;
|
||||
DoomSpecificInfo (custominfo, 16384);
|
||||
if (sysCallbacks && sysCallbacks->CrashInfo && custominfo) sysCallbacks->CrashInfo(custominfo, 16384, "\r\n");
|
||||
CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow);
|
||||
|
||||
// If the main thread crashed, then make it clean up after itself.
|
|
@ -268,9 +268,10 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
|
|||
}
|
||||
else
|
||||
{
|
||||
bool pauseState = false;
|
||||
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
|
||||
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
|
||||
(!captureModeInGame || GUICapture ||paused || demoplayback));
|
||||
(!captureModeInGame || GUICapture));
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue