mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-10 05:54:16 +00:00
Merge branch 'master' into sohl1.2
This commit is contained in:
commit
abf8c33a89
10
.gitignore
vendored
10
.gitignore
vendored
@ -6,4 +6,14 @@
|
|||||||
*.a
|
*.a
|
||||||
*.framework
|
*.framework
|
||||||
*.exe
|
*.exe
|
||||||
|
*.dll
|
||||||
|
*.pdb
|
||||||
build/
|
build/
|
||||||
|
CMakeLists.txt.user
|
||||||
|
cmake_install.cmake
|
||||||
|
*.orig
|
||||||
|
*.cbp
|
||||||
|
*.dsw
|
||||||
|
*.vsxproj
|
||||||
|
*.vsproj
|
||||||
|
*.sln
|
||||||
|
@ -32,6 +32,10 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
|
|||||||
option(BUILD_CLIENT "Build client dll" ON)
|
option(BUILD_CLIENT "Build client dll" ON)
|
||||||
option(BUILD_SERVER "Build server dll" ON)
|
option(BUILD_SERVER "Build server dll" ON)
|
||||||
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
|
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
|
||||||
|
set(GAMEDIR "valve" CACHE STRING "Gamedir path")
|
||||||
|
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
|
||||||
|
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
|
||||||
|
set(SERVER_LIBRARY_NAME "hl" CACHE STRING "Library name for Linux/MacOS/Windows")
|
||||||
|
|
||||||
#-----------------
|
#-----------------
|
||||||
# MAIN BUILD CODE \
|
# MAIN BUILD CODE \
|
||||||
@ -50,6 +54,16 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# add_compile_options for older cmake versions
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.0.2")
|
||||||
|
macro(add_compile_options)
|
||||||
|
set(list_var "${ARGV}")
|
||||||
|
foreach(arg IN LISTS list_var)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${arg}")
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_CLIENT)
|
if(BUILD_CLIENT)
|
||||||
add_subdirectory(cl_dll)
|
add_subdirectory(cl_dll)
|
||||||
endif()
|
endif()
|
||||||
|
31
backup.bat
31
backup.bat
@ -1,31 +0,0 @@
|
|||||||
@echo off
|
|
||||||
color 4F
|
|
||||||
echo XashXT Group 2006 (C)
|
|
||||||
echo Prepare source for backup
|
|
||||||
echo.
|
|
||||||
|
|
||||||
if exist backup.log del /f /q backup.log
|
|
||||||
if not exist D:\!backup/ mkdir D:\!backup\
|
|
||||||
echo Prepare OK!
|
|
||||||
echo Please wait: backup in progress
|
|
||||||
C:\Progra~1\WinRar\rar a -agMMMYYYY-DD D:\!backup\.rar -dh -m5 @backup.lst >>backup.log
|
|
||||||
if errorlevel 1 goto error
|
|
||||||
if errorlevel 0 goto ok
|
|
||||||
:ok
|
|
||||||
cls
|
|
||||||
echo Source was sucessfully backuped
|
|
||||||
echo and stored in folder "backup"
|
|
||||||
echo Press any key for exit. :-)
|
|
||||||
if exist backup.log del /f /q backup.log
|
|
||||||
exit
|
|
||||||
:error
|
|
||||||
echo ******************************
|
|
||||||
echo ***********Error!*************
|
|
||||||
echo ******************************
|
|
||||||
echo **See backup.log for details**
|
|
||||||
echo ******************************
|
|
||||||
echo ******************************
|
|
||||||
echo.
|
|
||||||
echo press any key for exit :-(
|
|
||||||
pause>nul
|
|
||||||
exit
|
|
36
backup.lst
36
backup.lst
@ -1,36 +0,0 @@
|
|||||||
//=======================================================================
|
|
||||||
// Copyright XashXT Group 2007 ©
|
|
||||||
// list with backup directories
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
// global stuff
|
|
||||||
xash.dsw
|
|
||||||
debug.bat
|
|
||||||
backup.lst
|
|
||||||
backup.bat
|
|
||||||
release.bat
|
|
||||||
change.log
|
|
||||||
make_sdk.bat
|
|
||||||
xash_sdk.lst
|
|
||||||
|
|
||||||
cl_dll\
|
|
||||||
cl_dll\hl\
|
|
||||||
common\
|
|
||||||
dlls\
|
|
||||||
game_shared\
|
|
||||||
game_launch\
|
|
||||||
engine\
|
|
||||||
engine\client\
|
|
||||||
engine\client\vgui\
|
|
||||||
engine\server\
|
|
||||||
engine\common\
|
|
||||||
engine\common\imagelib\
|
|
||||||
engine\common\soundlib\
|
|
||||||
pm_shared\
|
|
||||||
mainui\
|
|
||||||
mainui\legacy
|
|
||||||
utils\
|
|
||||||
utils\makefont\
|
|
||||||
utils\vgui\
|
|
||||||
utils\vgui\include\
|
|
||||||
utils\vgui\lib\win32_vc6\
|
|
@ -25,14 +25,22 @@ project (CLDLL)
|
|||||||
|
|
||||||
set (CLDLL_LIBRARY client)
|
set (CLDLL_LIBRARY client)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w")
|
|
||||||
if (GOLDSOURCE_SUPPORT)
|
add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT")
|
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
if(NOT MSVC)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ldl")
|
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
||||||
endif()
|
add_compile_options(-Wno-write-strings) # GCC/Clang flag
|
||||||
|
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
|
||||||
|
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf )
|
||||||
|
else()
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
|
|
||||||
|
if (GOLDSOURCE_SUPPORT)
|
||||||
|
add_definitions(-DGOLDSOURCE_SUPPORT)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set (CLDLL_SOURCES
|
set (CLDLL_SOURCES
|
||||||
../dlls/crossbow.cpp
|
../dlls/crossbow.cpp
|
||||||
@ -112,7 +120,21 @@ if(USE_VOICEMGR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library (${CLDLL_LIBRARY} SHARED ${CLDLL_SOURCES})
|
add_library (${CLDLL_LIBRARY} SHARED ${CLDLL_SOURCES})
|
||||||
|
if (GOLDSOURCE_SUPPORT)
|
||||||
|
target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} )
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties (${CLDLL_SHARED} PROPERTIES
|
set_target_properties (${CLDLL_LIBRARY} PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE 1)
|
POSITION_INDEPENDENT_CODE 1)
|
||||||
|
|
||||||
|
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
set_target_properties(${CLDLL_LIBRARY} PROPERTIES
|
||||||
|
OUTPUT_NAME "client"
|
||||||
|
PREFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install( TARGETS ${CLDLL_LIBRARY}
|
||||||
|
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE )
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -92,17 +92,17 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
|
|||||||
|
|
||||||
// X positions
|
// X positions
|
||||||
// relative to the side of the scoreboard
|
// relative to the side of the scoreboard
|
||||||
#define NAME_RANGE_MIN -100
|
#define NAME_RANGE_MIN -65
|
||||||
#define NAME_RANGE_MAX 145
|
#define NAME_RANGE_MAX 180
|
||||||
#define KILLS_RANGE_MIN 130
|
#define KILLS_RANGE_MIN 165
|
||||||
#define KILLS_RANGE_MAX 170
|
#define KILLS_RANGE_MAX 205
|
||||||
#define DIVIDER_POS 180
|
#define DIVIDER_POS 215
|
||||||
#define DEATHS_RANGE_MIN 185
|
#define DEATHS_RANGE_MIN 220
|
||||||
#define DEATHS_RANGE_MAX 210
|
#define DEATHS_RANGE_MAX 245
|
||||||
#define PING_RANGE_MIN 245
|
#define PING_RANGE_MIN 280
|
||||||
#define PING_RANGE_MAX 295
|
#define PING_RANGE_MAX 330
|
||||||
#define PL_RANGE_MIN 315
|
#define PL_RANGE_MIN 350
|
||||||
#define PL_RANGE_MAX 375
|
#define PL_RANGE_MAX 410
|
||||||
|
|
||||||
int SCOREBOARD_WIDTH = 320;
|
int SCOREBOARD_WIDTH = 320;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
42
debug.bat
42
debug.bat
@ -1,42 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
set MSDEV=BuildConsole
|
|
||||||
set CONFIG=/ShowTime /ShowAgent /nologo /cfg=
|
|
||||||
set MSDEV=msdev
|
|
||||||
set CONFIG=/make
|
|
||||||
set build_type=debug
|
|
||||||
set BUILD_ERROR=
|
|
||||||
call vcvars32
|
|
||||||
|
|
||||||
%MSDEV% engine/engine.dsp %CONFIG%"engine - Win32 Debug" %build_target%
|
|
||||||
if errorlevel 1 set BUILD_ERROR=1
|
|
||||||
|
|
||||||
%MSDEV% mainui/mainui.dsp %CONFIG%"mainui - Win32 Debug" %build_target%
|
|
||||||
if errorlevel 1 set BUILD_ERROR=1
|
|
||||||
|
|
||||||
if "%BUILD_ERROR%"=="" goto build_ok
|
|
||||||
|
|
||||||
echo *********************
|
|
||||||
echo *********************
|
|
||||||
echo *** Build Errors! ***
|
|
||||||
echo *********************
|
|
||||||
echo *********************
|
|
||||||
echo press any key to exit
|
|
||||||
echo *********************
|
|
||||||
pause>nul
|
|
||||||
goto done
|
|
||||||
|
|
||||||
|
|
||||||
@rem
|
|
||||||
@rem Successful build
|
|
||||||
@rem
|
|
||||||
:build_ok
|
|
||||||
|
|
||||||
rem //delete log files
|
|
||||||
if exist engine\engine.plg del /f /q engine\engine.plg
|
|
||||||
if exist mainui\mainui.plg del /f /q mainui\mainui.plg
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo Build succeeded!
|
|
||||||
echo
|
|
||||||
:done
|
|
@ -25,8 +25,16 @@ project (SVDLL)
|
|||||||
|
|
||||||
set (SVDLL_LIBRARY server)
|
set (SVDLL_LIBRARY server)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -fno-exceptions -w")
|
add_definitions(-DCLIENT_WEAPONS)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
||||||
|
add_compile_options(-Wno-invalid-offsetof) # GCC/Clang flag
|
||||||
|
add_definitions(-D_LINUX) # It seems enough for all non-Win32 systems
|
||||||
|
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf )
|
||||||
|
else()
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
|
endif()
|
||||||
|
|
||||||
set (SVDLL_SOURCES
|
set (SVDLL_SOURCES
|
||||||
agrunt.cpp
|
agrunt.cpp
|
||||||
@ -148,6 +156,17 @@ endif()
|
|||||||
|
|
||||||
add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES})
|
add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES})
|
||||||
|
|
||||||
set_target_properties (${SVDLL_SHARED} PROPERTIES
|
set_target_properties (${SVDLL_LIBRARY} PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE 1)
|
POSITION_INDEPENDENT_CODE 1)
|
||||||
|
|
||||||
|
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
set_target_properties(${SVDLL_LIBRARY} PROPERTIES
|
||||||
|
OUTPUT_NAME ${SERVER_LIBRARY_NAME}
|
||||||
|
PREFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install( TARGETS ${SVDLL_LIBRARY}
|
||||||
|
DESTINATION "${GAMEDIR}/${SERVER_INSTALL_DIR}/"
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE)
|
||||||
|
@ -3553,6 +3553,10 @@ void CBasePlayer::ForceClientDllUpdate( void )
|
|||||||
m_fWeapon = FALSE; // Force weapon send
|
m_fWeapon = FALSE; // Force weapon send
|
||||||
m_fKnownItem = FALSE; // Force weaponinit messages.
|
m_fKnownItem = FALSE; // Force weaponinit messages.
|
||||||
m_fInitHUD = TRUE; // Force HUD gmsgResetHUD message
|
m_fInitHUD = TRUE; // Force HUD gmsgResetHUD message
|
||||||
|
m_bSentBhopcap = true; // a1ba: Update bhopcap state
|
||||||
|
memset( m_rgAmmoLast, 0, sizeof( m_rgAmmoLast )); // a1ba: Force update AmmoX
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Now force all the necessary messages
|
// Now force all the necessary messages
|
||||||
// to be sent.
|
// to be sent.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose: New version of the slider bar
|
// Purpose: New version of the slider bar
|
||||||
//
|
//
|
||||||
@ -82,7 +82,7 @@ void CPlayerMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||||||
//=========================================================
|
//=========================================================
|
||||||
int CPlayerMonster::ISoundMask( void )
|
int CPlayerMonster::ISoundMask( void )
|
||||||
{
|
{
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose: New version of the slider bar
|
// Purpose: New version of the slider bar
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose: New version of the slider bar
|
// Purpose: New version of the slider bar
|
||||||
//
|
//
|
||||||
|
@ -1281,7 +1281,7 @@ float UTIL_Approach( float target, float value, float speed )
|
|||||||
float UTIL_ApproachAngle( float target, float value, float speed )
|
float UTIL_ApproachAngle( float target, float value, float speed )
|
||||||
{
|
{
|
||||||
target = UTIL_AngleMod( target );
|
target = UTIL_AngleMod( target );
|
||||||
value = UTIL_AngleMod( target );
|
value = UTIL_AngleMod( value );
|
||||||
|
|
||||||
float delta = target - value;
|
float delta = target - value;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ extern globalvars_t *gpGlobals;
|
|||||||
#define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset)
|
#define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset)
|
||||||
|
|
||||||
#if !defined XASH_64BIT || defined(CLIENT_DLL)
|
#if !defined XASH_64BIT || defined(CLIENT_DLL)
|
||||||
#define MAKE_STRING(str) ((int)str - (int)STRING(0))
|
#define MAKE_STRING(str) ((int)(long int)str - (int)(long int)STRING(0))
|
||||||
#else
|
#else
|
||||||
static inline int MAKE_STRING(const char *szValue)
|
static inline int MAKE_STRING(const char *szValue)
|
||||||
{
|
{
|
||||||
|
62
make_sdk.bat
62
make_sdk.bat
@ -1,62 +0,0 @@
|
|||||||
@echo off
|
|
||||||
color 5A
|
|
||||||
echo XashXT Group 2010 (C)
|
|
||||||
echo Create Xash3D SDK
|
|
||||||
echo.
|
|
||||||
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk/ mkdir D:\Xash3D\src_main\xash_sdk\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\engine/ mkdir D:\Xash3D\src_main\xash_sdk\engine\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\common/ mkdir D:\Xash3D\src_main\xash_sdk\common\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\mainui/ mkdir D:\Xash3D\src_main\xash_sdk\mainui\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\mainui\legacy/ mkdir D:\Xash3D\src_main\xash_sdk\mainui\legacy
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\utils/ mkdir D:\Xash3D\src_main\xash_sdk\utils\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\makefont/ mkdir D:\Xash3D\src_main\xash_sdk\utils\makefont
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui\include/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui\include
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui\lib/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui\lib
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\utils\vgui\lib\win32_vc6/ mkdir D:\Xash3D\src_main\xash_sdk\utils\vgui\lib\win32_vc6
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\game_launch/ mkdir D:\Xash3D\src_main\xash_sdk\game_launch\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\cl_dll/ mkdir D:\Xash3D\src_main\xash_sdk\cl_dll\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdkcl_dll\hl/ mkdir D:\Xash3D\src_main\xash_sdk\cl_dll\hl\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\dlls/ mkdir D:\Xash3D\src_main\xash_sdk\dlls\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\dlls\wpn_shared/ mkdir D:\Xash3D\src_main\xash_sdk\dlls\wpn_shared\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\game_shared/ mkdir D:\Xash3D\src_main\xash_sdk\game_shared\
|
|
||||||
if not exist D:\Xash3D\src_main\xash_sdk\pm_shared/ mkdir D:\Xash3D\src_main\xash_sdk\pm_shared\
|
|
||||||
@copy /Y engine\*.h xash_sdk\engine\*.h
|
|
||||||
@copy /Y game_launch\*.* xash_sdk\game_launch\*.*
|
|
||||||
@copy /Y mainui\*.* xash_sdk\mainui\*.*
|
|
||||||
@copy /Y mainui\legacy\*.* xash_sdk\mainui\legacy\*.*
|
|
||||||
@copy /Y common\*.* xash_sdk\common\*.*
|
|
||||||
@copy /Y cl_dll\*.* xash_sdk\cl_dll\*.*
|
|
||||||
@copy /Y cl_dll\hl\*.* xash_sdk\cl_dll\hl\*.*
|
|
||||||
@copy /Y dlls\*.* xash_sdk\dlls\*.*
|
|
||||||
@copy /Y dlls\wpn_shared\*.* xash_sdk\dlls\wpn_shared\*.*
|
|
||||||
@copy /Y utils\makefont\*.* xash_sdk\utils\makefont\*.*
|
|
||||||
@copy /Y utils\vgui\include\*.* xash_sdk\utils\vgui\include\*.*
|
|
||||||
@copy /Y utils\vgui\lib\win32_vc6\*.* xash_sdk\utils\vgui\lib\win32_vc6\*.*
|
|
||||||
@copy /Y game_shared\*.* xash_sdk\game_shared\*.*
|
|
||||||
@copy /Y pm_shared\*.* xash_sdk\pm_shared\*.*
|
|
||||||
@copy /Y xash_sdk.dsw xash_sdk\xash_sdk.dsw
|
|
||||||
echo Prepare OK!
|
|
||||||
echo Please wait: creating SDK in progress
|
|
||||||
C:\Progra~1\WinRar\rar a xash_sdk -dh -k -r -s -df -m5 @xash_sdk.lst >>makesdk.log
|
|
||||||
if errorlevel 1 goto error
|
|
||||||
if errorlevel 0 goto ok
|
|
||||||
:ok
|
|
||||||
cls
|
|
||||||
echo SDK was sucessfully created
|
|
||||||
echo and stored in RAR-chive "xash_sdk"
|
|
||||||
echo Press any key for exit. :-)
|
|
||||||
if exist makesdk.log del /f /q makesdk.log
|
|
||||||
exit
|
|
||||||
:error
|
|
||||||
echo ******************************
|
|
||||||
echo ***********Error!*************
|
|
||||||
echo ******************************
|
|
||||||
echo *See makesdk.log for details**
|
|
||||||
echo ******************************
|
|
||||||
echo ******************************
|
|
||||||
echo.
|
|
||||||
echo press any key for exit :-(
|
|
||||||
pause>nul
|
|
||||||
exit
|
|
@ -1,4 +1,4 @@
|
|||||||
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
|
42
release.bat
42
release.bat
@ -1,42 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
set MSDEV=BuildConsole
|
|
||||||
set CONFIG=/ShowTime /ShowAgent /nologo /cfg=
|
|
||||||
set MSDEV=msdev
|
|
||||||
set CONFIG=/make
|
|
||||||
set build_type=release
|
|
||||||
set BUILD_ERROR=
|
|
||||||
call vcvars32
|
|
||||||
|
|
||||||
%MSDEV% engine/engine.dsp %CONFIG%"engine - Win32 Release" %build_target%
|
|
||||||
if errorlevel 1 set BUILD_ERROR=1
|
|
||||||
|
|
||||||
%MSDEV% mainui/mainui.dsp %CONFIG%"mainui - Win32 Release" %build_target%
|
|
||||||
if errorlevel 1 set BUILD_ERROR=1
|
|
||||||
|
|
||||||
if "%BUILD_ERROR%"=="" goto build_ok
|
|
||||||
|
|
||||||
echo *********************
|
|
||||||
echo *********************
|
|
||||||
echo *** Build Errors! ***
|
|
||||||
echo *********************
|
|
||||||
echo *********************
|
|
||||||
echo press any key to exit
|
|
||||||
echo *********************
|
|
||||||
pause>nul
|
|
||||||
goto done
|
|
||||||
|
|
||||||
|
|
||||||
@rem
|
|
||||||
@rem Successful build
|
|
||||||
@rem
|
|
||||||
:build_ok
|
|
||||||
|
|
||||||
rem //delete log files
|
|
||||||
if exist engine\engine.plg del /f /q engine\engine.plg
|
|
||||||
if exist mainui\mainui.plg del /f /q mainui\mainui.plg
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo Build succeeded!
|
|
||||||
echo
|
|
||||||
:done
|
|
@ -219,7 +219,6 @@ private:
|
|||||||
bool _paintBorderEnabled;
|
bool _paintBorderEnabled;
|
||||||
bool _paintBackgroundEnabled;
|
bool _paintBackgroundEnabled;
|
||||||
bool _paintEnabled;
|
bool _paintEnabled;
|
||||||
friend class Panel;
|
|
||||||
friend class App;
|
friend class App;
|
||||||
friend class SurfaceBase;
|
friend class SurfaceBase;
|
||||||
friend class Image;
|
friend class Image;
|
||||||
|
845
utils/makefont/makefont.cpp
Normal file
845
utils/makefont/makefont.cpp
Normal file
@ -0,0 +1,845 @@
|
|||||||
|
/***
|
||||||
|
*
|
||||||
|
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||||
|
*
|
||||||
|
* This product contains software technology licensed from Id
|
||||||
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use, distribution, and modification of this source code and/or resulting
|
||||||
|
* object code is restricted to non-commercial enhancements to products from
|
||||||
|
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||||
|
* without written permission from Valve LLC.
|
||||||
|
*
|
||||||
|
****/
|
||||||
|
|
||||||
|
#define _NOENUMQBOOL
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "cmdlib.h"
|
||||||
|
#include "wadlib.h"
|
||||||
|
}
|
||||||
|
#include "qfont.h"
|
||||||
|
|
||||||
|
#define DEFAULT_FONT "Arial"
|
||||||
|
|
||||||
|
#define FONT_TAG 6 // Font's are the 6th tag after the TYP_LUMPY base ( 64 )...i.e., type == 70
|
||||||
|
|
||||||
|
BOOL bItalic = FALSE;
|
||||||
|
BOOL bBold = FALSE;
|
||||||
|
BOOL bUnderline = FALSE;
|
||||||
|
|
||||||
|
char fontname[ 256 ];
|
||||||
|
int pointsize[3] = { 9, 11, 15 };
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
zeromalloc
|
||||||
|
|
||||||
|
Allocates and zeroes memory
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void *zeromalloc( size_t size )
|
||||||
|
{
|
||||||
|
unsigned char *pbuffer;
|
||||||
|
pbuffer = ( unsigned char * )malloc( size );
|
||||||
|
if ( !pbuffer )
|
||||||
|
{
|
||||||
|
printf( "Failed on allocation of %i bytes", size );
|
||||||
|
exit( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
memset( pbuffer, 0, size );
|
||||||
|
return ( void * )pbuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Draw_SetupConsolePalette
|
||||||
|
|
||||||
|
Set's the palette to full brightness ( 192 ) and
|
||||||
|
set's up palette entry 0 -- black
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void Draw_SetupConsolePalette( unsigned char *pal )
|
||||||
|
{
|
||||||
|
unsigned char *pPalette;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
pPalette = pal;
|
||||||
|
|
||||||
|
*(short *)pPalette = 3 * 256;
|
||||||
|
pPalette += sizeof( short );
|
||||||
|
|
||||||
|
for ( i = 0; i < 256; i++ )
|
||||||
|
{
|
||||||
|
pPalette[3 * i + 0 ] = i;
|
||||||
|
pPalette[3 * i + 1 ] = i;
|
||||||
|
pPalette[3 * i + 2 ] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set palette zero correctly
|
||||||
|
pPalette[ 0 ] = 0;
|
||||||
|
pPalette[ 1 ] = 0;
|
||||||
|
pPalette[ 2 ] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DJXX added for debugging
|
||||||
|
BOOL WriteDIB(LPTSTR szFile, HANDLE hDIB)
|
||||||
|
{
|
||||||
|
BITMAPFILEHEADER hdr;
|
||||||
|
LPBITMAPINFOHEADER lpbi;
|
||||||
|
|
||||||
|
if (!hDIB)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
FILE *file;
|
||||||
|
file = SafeOpenWrite(szFile);
|
||||||
|
|
||||||
|
|
||||||
|
lpbi = (LPBITMAPINFOHEADER)hDIB;
|
||||||
|
|
||||||
|
int nColors = 1 << lpbi->biBitCount;
|
||||||
|
|
||||||
|
// Fill in the fields of the file header
|
||||||
|
hdr.bfType = ((WORD)('M' << 8) | 'B'); // is always "BM"
|
||||||
|
hdr.bfSize = GlobalSize(hDIB) + sizeof(hdr);
|
||||||
|
printf("WriteDIB. Error code = %i\n",GetLastError());
|
||||||
|
hdr.bfReserved1 = 0;
|
||||||
|
hdr.bfReserved2 = 0;
|
||||||
|
hdr.bfOffBits = (DWORD)(sizeof(hdr)+lpbi->biSize +
|
||||||
|
nColors * sizeof(RGBQUAD));
|
||||||
|
|
||||||
|
// Write the file header
|
||||||
|
SafeWrite(file, &hdr, sizeof(hdr));
|
||||||
|
|
||||||
|
// Write the DIB header and the bits
|
||||||
|
SafeWrite(file, lpbi, GlobalSize(hDIB));
|
||||||
|
fclose(file);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
CreateProportionalConsoleFont
|
||||||
|
|
||||||
|
Renders TT font into memory dc and creates appropriate qfont_t structure
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
//DJXX: New version, draws chararacters closely to each other without spaces
|
||||||
|
|
||||||
|
// YWB: Sigh, VC 6.0's global optimizer causes weird stack fixups in release builds. Disable the globabl optimizer for this function.
|
||||||
|
#pragma optimize( "g", off )
|
||||||
|
qfont_t *CreateProportionalConsoleFont(char *pszFont, int nPointSize, BOOL bItalic, BOOL bUnderline, BOOL bBold, int *outsize)
|
||||||
|
{
|
||||||
|
HDC hdc;
|
||||||
|
HDC hmemDC;
|
||||||
|
HBITMAP hbm, oldbm;
|
||||||
|
RECT rc;
|
||||||
|
HFONT fnt, oldfnt;
|
||||||
|
TEXTMETRIC tm;
|
||||||
|
int startchar = 32;
|
||||||
|
int c;
|
||||||
|
int i, j;
|
||||||
|
int x, y;
|
||||||
|
int nScans;
|
||||||
|
unsigned char *bits;
|
||||||
|
BITMAPINFO tempbmi;
|
||||||
|
BITMAPINFO *pbmi;
|
||||||
|
BITMAPINFOHEADER *pbmheader;
|
||||||
|
unsigned char *pqdata;
|
||||||
|
unsigned char *pCur;
|
||||||
|
int x1, y1;
|
||||||
|
unsigned char *pPalette;
|
||||||
|
qfont_t *pqf = NULL;
|
||||||
|
int fullsize;
|
||||||
|
int w = 16;
|
||||||
|
//int h = (128 - 32) / 16;
|
||||||
|
int h = (256 - 32) / 16;
|
||||||
|
int charheight = nPointSize + 5;
|
||||||
|
int charwidth = 16;//now used only for calculating width of wad texture
|
||||||
|
int fontcharwidth;
|
||||||
|
int edge = 1;
|
||||||
|
RECT rcChar;
|
||||||
|
boolean lShadow = true;//draw shadow instead of outline
|
||||||
|
|
||||||
|
// Create the font
|
||||||
|
fnt = CreateFont(-nPointSize, 0, 0, 0, bBold ? FW_HEAVY : FW_MEDIUM, bItalic, bUnderline, 0, /*ANSI_CHARSET*/DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | FF_DONTCARE, pszFont);
|
||||||
|
|
||||||
|
bits = NULL;
|
||||||
|
|
||||||
|
fullsize = sizeof(qfont_t)-4 + (/*128*/256 * w * charwidth) + sizeof(short)+768 + 64;
|
||||||
|
|
||||||
|
// Store off final size
|
||||||
|
*outsize = fullsize;
|
||||||
|
|
||||||
|
pqf = (qfont_t *)zeromalloc(fullsize);
|
||||||
|
pqdata = (unsigned char *)pqf + sizeof(qfont_t)-4;
|
||||||
|
|
||||||
|
pPalette = pqdata + (/*128*/256 * w * charwidth);
|
||||||
|
|
||||||
|
// Configure palette
|
||||||
|
Draw_SetupConsolePalette(pPalette);
|
||||||
|
|
||||||
|
hdc = GetDC(NULL);
|
||||||
|
hmemDC = CreateCompatibleDC(hdc);
|
||||||
|
|
||||||
|
oldfnt = (HFONT)SelectObject(hmemDC, fnt);
|
||||||
|
|
||||||
|
if (GetTextMetrics(hmemDC, &tm))
|
||||||
|
{
|
||||||
|
fontcharwidth = tm.tmMaxCharWidth;
|
||||||
|
if (fontcharwidth % 2)//hack: on odd values of fontcharwidth, bitmaps pixel check gives false triggering
|
||||||
|
fontcharwidth++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fontcharwidth = charwidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lShadow)
|
||||||
|
charheight += edge;//adding 1 pixel to bottom for shadowing
|
||||||
|
|
||||||
|
rc.top = 0;
|
||||||
|
rc.left = 0;
|
||||||
|
rc.right = fontcharwidth * w;
|
||||||
|
rc.bottom = charheight * h;
|
||||||
|
|
||||||
|
hbm = CreateBitmap(fontcharwidth * w, charheight * h, 1, 1, NULL);
|
||||||
|
oldbm = (HBITMAP)SelectObject(hmemDC, hbm);
|
||||||
|
|
||||||
|
SetTextColor(hmemDC, 0x00ffffff);
|
||||||
|
SetBkMode(hmemDC, TRANSPARENT);
|
||||||
|
|
||||||
|
// Paint black background
|
||||||
|
FillRect(hmemDC, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
|
||||||
|
|
||||||
|
// Draw character set into memory DC
|
||||||
|
for (j = 0; j < h; j++)
|
||||||
|
{
|
||||||
|
for (i = 0; i < w; i++)
|
||||||
|
{
|
||||||
|
x = i * fontcharwidth;
|
||||||
|
y = j * charheight;
|
||||||
|
|
||||||
|
c = (unsigned char)(startchar + j * w + i);
|
||||||
|
|
||||||
|
// Only draw printable characters, of course
|
||||||
|
//if ( isprint( c ) && c <= 127 )
|
||||||
|
{
|
||||||
|
// Draw it.
|
||||||
|
rcChar.left = x + 1;
|
||||||
|
rcChar.top = y + 1;
|
||||||
|
rcChar.right = x + fontcharwidth - 1;
|
||||||
|
rcChar.bottom = y + charheight - 1;
|
||||||
|
|
||||||
|
DrawText(hmemDC, (char *)&c, 1, &rcChar, DT_NOPREFIX | DT_LEFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now turn the qfont into raw format
|
||||||
|
memset(&tempbmi, 0, sizeof(BITMAPINFO));
|
||||||
|
|
||||||
|
pbmheader = (BITMAPINFOHEADER *)&tempbmi;
|
||||||
|
|
||||||
|
pbmheader->biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
pbmheader->biWidth = w * fontcharwidth;
|
||||||
|
pbmheader->biHeight = -h * charheight;
|
||||||
|
pbmheader->biPlanes = 1;
|
||||||
|
pbmheader->biBitCount = 1;
|
||||||
|
pbmheader->biCompression = BI_RGB;
|
||||||
|
|
||||||
|
// Find out how big the bitmap is
|
||||||
|
nScans = GetDIBits(hmemDC, hbm, 0, h * charheight, NULL, &tempbmi, DIB_RGB_COLORS);
|
||||||
|
|
||||||
|
// Allocate space for all bits
|
||||||
|
pbmi = (BITMAPINFO *)zeromalloc(sizeof (BITMAPINFOHEADER)+2 * sizeof(RGBQUAD)+pbmheader->biSizeImage);
|
||||||
|
|
||||||
|
memcpy(pbmi, &tempbmi, sizeof(BITMAPINFO));
|
||||||
|
|
||||||
|
bits = (unsigned char *)pbmi + sizeof(BITMAPINFOHEADER)+2 * sizeof(RGBQUAD);
|
||||||
|
|
||||||
|
// Now read in bits
|
||||||
|
nScans = GetDIBits(hmemDC, hbm, 0, h * charheight, bits, pbmi, DIB_RGB_COLORS);
|
||||||
|
|
||||||
|
if (nScans > 0)
|
||||||
|
{
|
||||||
|
#if 0 //for debugging
|
||||||
|
char sz[128];//DJXX write dib to file
|
||||||
|
sprintf(sz, "font_%s_%i.bmp", pszFont, nPointSize);
|
||||||
|
WriteDIB(sz, pbmi);
|
||||||
|
#endif
|
||||||
|
// Now convert to proper raw format
|
||||||
|
//
|
||||||
|
// Now get results from dib
|
||||||
|
pqf->height = /*128*/256; // Always set to 128
|
||||||
|
pqf->width = charwidth;
|
||||||
|
pqf->rowheight = charheight;
|
||||||
|
pqf->rowcount = h;
|
||||||
|
pCur = pqdata;
|
||||||
|
|
||||||
|
// Set everything to index 255 ( 0xff ) == transparent
|
||||||
|
memset(pCur, 0xFF, w * charwidth * pqf->height);
|
||||||
|
|
||||||
|
int k = 0, dest_x = 0, dest_y = 0;
|
||||||
|
|
||||||
|
for (j = 0; j < h; j++)
|
||||||
|
for (i = 0; i < w; i++)
|
||||||
|
{
|
||||||
|
int rightmost, leftmost, realcharwidth;
|
||||||
|
|
||||||
|
x = i * fontcharwidth;
|
||||||
|
y = j * charheight;
|
||||||
|
|
||||||
|
//c = (char)( startchar + j * w + i ); here was memory bug
|
||||||
|
c = (unsigned char)(startchar + j * w + i);
|
||||||
|
|
||||||
|
rightmost = 0;
|
||||||
|
leftmost = fontcharwidth;
|
||||||
|
|
||||||
|
//Calculate real width of the character
|
||||||
|
for (y1 = 0; y1 < charheight; y1++)
|
||||||
|
for (x1 = 0; x1 < fontcharwidth; x1++)
|
||||||
|
{
|
||||||
|
int src_offset;
|
||||||
|
|
||||||
|
src_offset = (y + y1) * w * fontcharwidth + x + x1;
|
||||||
|
|
||||||
|
if (bits[src_offset >> 3] & (1 << (7 - src_offset & 7)))//on odd values of fontcharwidth this check gives false triggering
|
||||||
|
{
|
||||||
|
if (x1 > rightmost)
|
||||||
|
rightmost = x1;
|
||||||
|
|
||||||
|
if (x1 < leftmost)
|
||||||
|
leftmost = x1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (leftmost > rightmost)//empty characters
|
||||||
|
{
|
||||||
|
leftmost = 0;
|
||||||
|
rightmost = 7;
|
||||||
|
} else {
|
||||||
|
rightmost += edge;
|
||||||
|
if (!lShadow)
|
||||||
|
leftmost -= edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
realcharwidth = rightmost - leftmost + 1;
|
||||||
|
pqf->fontinfo[c].charwidth = realcharwidth;
|
||||||
|
|
||||||
|
if (dest_x + realcharwidth >= w * charwidth)//if it not fits on current line then carry it to the next line
|
||||||
|
{
|
||||||
|
dest_x = 0;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
dest_y = k * charheight;
|
||||||
|
pqf->fontinfo[c].startoffset = dest_y * w * charwidth + dest_x;
|
||||||
|
|
||||||
|
if (lShadow)
|
||||||
|
{
|
||||||
|
int shift = edge;
|
||||||
|
//Draw shadow by shifting character to 1 pixel right and down
|
||||||
|
for (y1 = 0; y1 < charheight; y1++)
|
||||||
|
for (x1 = 0; x1 < realcharwidth; x1++)
|
||||||
|
{
|
||||||
|
int src_offset, dest_offset;
|
||||||
|
|
||||||
|
src_offset = (y + y1) * w * fontcharwidth + x + x1 + leftmost;
|
||||||
|
dest_offset = (dest_y + shift + y1) * w * charwidth + (dest_x + shift + x1);
|
||||||
|
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + dest_offset;
|
||||||
|
|
||||||
|
if (bits[src_offset >> 3] & (1 << (7 - src_offset & 7)))
|
||||||
|
{
|
||||||
|
// Near Black
|
||||||
|
//pCur[0] = 32;
|
||||||
|
pCur[0] = 0;//full black so shadow remains black even it's coloured text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Put black pixels below and to the right of each pixel(outline)
|
||||||
|
for (y1 = edge; y1 < charheight - edge; y1++)
|
||||||
|
for (x1 = 0; x1 < realcharwidth; x1++)
|
||||||
|
{
|
||||||
|
int src_offset, dest_offset;
|
||||||
|
|
||||||
|
int xx0, yy0;
|
||||||
|
|
||||||
|
dest_offset = (dest_y + y1) * w * charwidth + (dest_x + x1);
|
||||||
|
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + dest_offset;
|
||||||
|
|
||||||
|
for (xx0 = -edge; xx0 <= edge; xx0++)
|
||||||
|
for (yy0 = -edge; yy0 <= edge; yy0++)
|
||||||
|
{
|
||||||
|
src_offset = (y + y1 + yy0) * w * fontcharwidth + x + x1 + xx0 + leftmost;//adding shift
|
||||||
|
|
||||||
|
if (bits[src_offset >> 3] & (1 << (7 - src_offset & 7)))
|
||||||
|
{
|
||||||
|
// Near Black
|
||||||
|
pCur[0] = 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now copy in the actual font pixels
|
||||||
|
for (y1 = 0; y1 < charheight; y1++)
|
||||||
|
for (x1 = 0; x1 < realcharwidth; x1++)
|
||||||
|
{
|
||||||
|
int src_offset, dest_offset;
|
||||||
|
|
||||||
|
src_offset = (y + y1) * w * fontcharwidth + x + x1 + leftmost;
|
||||||
|
dest_offset = (dest_y + y1) * w * charwidth + (dest_x + x1);
|
||||||
|
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + dest_offset;
|
||||||
|
|
||||||
|
if (bits[src_offset >> 3] & (1 << (7 - src_offset & 7)))
|
||||||
|
{
|
||||||
|
pCur[0] = 192;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dest_x += realcharwidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Free memory bits
|
||||||
|
free(pbmi);
|
||||||
|
SelectObject(hmemDC, oldfnt);
|
||||||
|
DeleteObject(fnt);
|
||||||
|
|
||||||
|
SelectObject(hmemDC, oldbm);
|
||||||
|
|
||||||
|
DeleteObject(hbm);
|
||||||
|
|
||||||
|
DeleteDC(hmemDC);
|
||||||
|
ReleaseDC(NULL, hdc);
|
||||||
|
|
||||||
|
return pqf;
|
||||||
|
}
|
||||||
|
#pragma optimize( "g", on )
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
CreateConsoleFont
|
||||||
|
|
||||||
|
Renders TT font into memory dc and creates appropriate qfont_t structure
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
//DJXX: original version, just added drawing of locale characters and fixed memory bug.
|
||||||
|
// YWB: Sigh, VC 6.0's global optimizer causes weird stack fixups in release builds. Disable the globabl optimizer for this function.
|
||||||
|
#pragma optimize( "g", off )
|
||||||
|
qfont_t *CreateConsoleFont( char *pszFont, int nPointSize, BOOL bItalic, BOOL bUnderline, BOOL bBold, int *outsize )
|
||||||
|
{
|
||||||
|
HDC hdc;
|
||||||
|
HDC hmemDC;
|
||||||
|
HBITMAP hbm, oldbm;
|
||||||
|
RECT rc;
|
||||||
|
HFONT fnt, oldfnt;
|
||||||
|
int startchar = 32;
|
||||||
|
int c;
|
||||||
|
int i, j;
|
||||||
|
int x, y;
|
||||||
|
int nScans;
|
||||||
|
unsigned char *bits;
|
||||||
|
BITMAPINFO tempbmi;
|
||||||
|
BITMAPINFO *pbmi;
|
||||||
|
BITMAPINFOHEADER *pbmheader;
|
||||||
|
unsigned char *pqdata;
|
||||||
|
unsigned char *pCur;
|
||||||
|
int x1, y1;
|
||||||
|
unsigned char *pPalette;
|
||||||
|
qfont_t *pqf = NULL;
|
||||||
|
int fullsize;
|
||||||
|
int w = 16;
|
||||||
|
//int h = (128-32)/16;
|
||||||
|
int h = (256 - 32) / 16;
|
||||||
|
int charheight = nPointSize + 5;
|
||||||
|
int charwidth = 16;
|
||||||
|
RECT rcChar;
|
||||||
|
|
||||||
|
// Create the font
|
||||||
|
fnt = CreateFont( -nPointSize, 0, 0, 0, bBold ? FW_HEAVY : FW_MEDIUM, bItalic, bUnderline, 0, /*ANSI_CHARSET*/DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | FF_DONTCARE, pszFont );
|
||||||
|
|
||||||
|
bits = NULL;
|
||||||
|
|
||||||
|
fullsize = sizeof( qfont_t ) - 4 + ( /*128*/256 * w * charwidth ) + sizeof(short) + 768 + 64;
|
||||||
|
|
||||||
|
// Store off final size
|
||||||
|
*outsize = fullsize;
|
||||||
|
|
||||||
|
pqf = ( qfont_t * )zeromalloc( fullsize );
|
||||||
|
pqdata = (unsigned char *)pqf + sizeof( qfont_t ) - 4;
|
||||||
|
|
||||||
|
pPalette = pqdata + ( /*128*/256 * w * charwidth);
|
||||||
|
|
||||||
|
// Configure palette
|
||||||
|
Draw_SetupConsolePalette( pPalette );
|
||||||
|
|
||||||
|
hdc = GetDC( NULL );
|
||||||
|
hmemDC = CreateCompatibleDC( hdc );
|
||||||
|
|
||||||
|
rc.top = 0;
|
||||||
|
rc.left = 0;
|
||||||
|
rc.right = charwidth * w;
|
||||||
|
rc.bottom = charheight * h;
|
||||||
|
|
||||||
|
hbm = CreateBitmap( charwidth * w, charheight * h, 1, 1, NULL );
|
||||||
|
oldbm = (HBITMAP)SelectObject( hmemDC, hbm );
|
||||||
|
oldfnt = (HFONT)SelectObject( hmemDC, fnt );
|
||||||
|
|
||||||
|
SetTextColor( hmemDC, 0x00ffffff );
|
||||||
|
SetBkMode( hmemDC, TRANSPARENT );
|
||||||
|
|
||||||
|
// Paint black background
|
||||||
|
FillRect( hmemDC, &rc, (HBRUSH)GetStockObject( BLACK_BRUSH ) );
|
||||||
|
|
||||||
|
// Draw character set into memory DC
|
||||||
|
for ( j = 0; j < h; j++ )
|
||||||
|
{
|
||||||
|
for ( i = 0; i < w; i++ )
|
||||||
|
{
|
||||||
|
x = i * charwidth;
|
||||||
|
y = j * charheight;
|
||||||
|
|
||||||
|
c = (unsigned char)( startchar + j * w + i );
|
||||||
|
|
||||||
|
// Only draw printable characters, of course
|
||||||
|
//if ( isprint( c ) && c <= 127 )
|
||||||
|
{
|
||||||
|
// Draw it.
|
||||||
|
rcChar.left = x + 1;
|
||||||
|
rcChar.top = y + 1;
|
||||||
|
rcChar.right = x + charwidth - 1;
|
||||||
|
rcChar.bottom = y + charheight - 1;
|
||||||
|
|
||||||
|
DrawText( hmemDC, (char *)&c, 1, &rcChar, DT_NOPREFIX | DT_LEFT );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now turn the qfont into raw format
|
||||||
|
memset( &tempbmi, 0, sizeof( BITMAPINFO ) );
|
||||||
|
pbmheader = ( BITMAPINFOHEADER * )&tempbmi;
|
||||||
|
|
||||||
|
pbmheader->biSize = sizeof( BITMAPINFOHEADER );
|
||||||
|
pbmheader->biWidth = w * charwidth;
|
||||||
|
pbmheader->biHeight = -h * charheight;
|
||||||
|
pbmheader->biPlanes = 1;
|
||||||
|
pbmheader->biBitCount = 1;
|
||||||
|
pbmheader->biCompression = BI_RGB;
|
||||||
|
|
||||||
|
// Find out how big the bitmap is
|
||||||
|
nScans = GetDIBits( hmemDC, hbm, 0, h * charheight, NULL, &tempbmi, DIB_RGB_COLORS );
|
||||||
|
|
||||||
|
// Allocate space for all bits
|
||||||
|
pbmi = ( BITMAPINFO * )zeromalloc( sizeof ( BITMAPINFOHEADER ) + 2 * sizeof( RGBQUAD ) + pbmheader->biSizeImage );
|
||||||
|
|
||||||
|
memcpy( pbmi, &tempbmi, sizeof( BITMAPINFO ) );
|
||||||
|
|
||||||
|
bits = ( unsigned char * )pbmi + sizeof( BITMAPINFOHEADER ) + 2 * sizeof( RGBQUAD );
|
||||||
|
|
||||||
|
// Now read in bits
|
||||||
|
nScans = GetDIBits( hmemDC, hbm, 0, h * charheight, bits, pbmi, DIB_RGB_COLORS );
|
||||||
|
|
||||||
|
if ( nScans > 0 )
|
||||||
|
{
|
||||||
|
#if 0 //for debugging
|
||||||
|
char sz[128];//DJXX write dib to file
|
||||||
|
sprintf(sz, "font_%s_%i.bmp", pszFont, nPointSize);
|
||||||
|
WriteDIB(sz, pbmi);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Now convert to proper raw format
|
||||||
|
//
|
||||||
|
// Now get results from dib
|
||||||
|
pqf->height = /*128*/256; // Always set to 128
|
||||||
|
pqf->width = charwidth;
|
||||||
|
pqf->rowheight = charheight;
|
||||||
|
pqf->rowcount = h;
|
||||||
|
pCur = pqdata;
|
||||||
|
|
||||||
|
// Set everything to index 255 ( 0xff ) == transparent
|
||||||
|
memset( pCur, 0xFF, w * charwidth * pqf->height );
|
||||||
|
|
||||||
|
for ( j = 0; j < h; j++ )
|
||||||
|
{
|
||||||
|
for ( i = 0; i < w; i++ )
|
||||||
|
{
|
||||||
|
int edge = 1;
|
||||||
|
int bestwidth;
|
||||||
|
x = i * charwidth;
|
||||||
|
y = j * charheight;
|
||||||
|
|
||||||
|
|
||||||
|
//c = (char)( startchar + j * w + i ); here was memory bug
|
||||||
|
c = (unsigned char)(startchar + j * w + i);
|
||||||
|
|
||||||
|
pqf->fontinfo[ c ].charwidth = charwidth;
|
||||||
|
pqf->fontinfo[ c ].startoffset = y * w * charwidth + x;
|
||||||
|
|
||||||
|
bestwidth = 0;
|
||||||
|
|
||||||
|
// In this first pass, place the black drop shadow so characters draw ok in the engine against
|
||||||
|
// most backgrounds.
|
||||||
|
// YWB: FIXME, apply a box filter and enable blending?
|
||||||
|
#if 0//DJXX: we already did that for a whole image by memset
|
||||||
|
// Make it all transparent for starters
|
||||||
|
for ( y1 = 0; y1 < charheight; y1++ )
|
||||||
|
{
|
||||||
|
for ( x1 = 0; x1 < charwidth; x1++ )
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
offset = ( y + y1 ) * w * charwidth + x + x1 ;
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + offset;
|
||||||
|
// Assume transparent
|
||||||
|
pCur[0] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// Put black pixels below and to the right of each pixel
|
||||||
|
for ( y1 = edge; y1 < charheight - edge; y1++ )
|
||||||
|
{
|
||||||
|
for ( x1 = 0; x1 < charwidth; x1++ )
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
int srcoffset;
|
||||||
|
|
||||||
|
int xx0, yy0;
|
||||||
|
|
||||||
|
offset = ( y + y1 ) * w * charwidth + x + x1 ;
|
||||||
|
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + offset;
|
||||||
|
|
||||||
|
for ( xx0 = -edge; xx0 <= edge; xx0++ )
|
||||||
|
{
|
||||||
|
for ( yy0 = -edge; yy0 <= edge; yy0++ )
|
||||||
|
{
|
||||||
|
srcoffset = ( y + y1 + yy0 ) * w * charwidth + x + x1 + xx0;
|
||||||
|
|
||||||
|
if ( bits[ srcoffset >> 3 ] & ( 1 << ( 7 - srcoffset & 7 ) ) )
|
||||||
|
{
|
||||||
|
// Near Black
|
||||||
|
pCur[0] = 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now copy in the actual font pixels
|
||||||
|
for ( y1 = 0; y1 < charheight; y1++ )
|
||||||
|
{
|
||||||
|
for ( x1 = 0; x1 < charwidth; x1++ )
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
offset = ( y + y1 ) * w * charwidth + x + x1;
|
||||||
|
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + offset;
|
||||||
|
|
||||||
|
if ( bits[ offset >> 3 ] & ( 1 << ( 7 - offset & 7 ) ) )
|
||||||
|
{
|
||||||
|
if ( x1 > bestwidth )
|
||||||
|
{
|
||||||
|
bestwidth = x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Full color
|
||||||
|
// FIXME: Enable true palette support in engine?
|
||||||
|
pCur[0] = 192;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bestwidth += 1;
|
||||||
|
/*
|
||||||
|
// Now blend it
|
||||||
|
for ( y1 = 0; y1 < charheight; y1++ )
|
||||||
|
{
|
||||||
|
for ( x1 = 0; x1 < charwidth; x1++ )
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
offset = ( y + y1 ) * w * charwidth + x + x1;
|
||||||
|
|
||||||
|
// Dest
|
||||||
|
pCur = pqdata + offset;
|
||||||
|
|
||||||
|
if ( bits[ offset >> 3 ] & ( 1 << ( 7 - offset & 7 ) ) )
|
||||||
|
{
|
||||||
|
if ( x1 > bestwidth )
|
||||||
|
{
|
||||||
|
bestwidth = x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Full color
|
||||||
|
// FIXME: Enable true palette support in engine?
|
||||||
|
pCur[0] = 192;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Space character width
|
||||||
|
if ( c == 32 )
|
||||||
|
{
|
||||||
|
bestwidth = 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Small characters needs can be padded a bit so they don't run into each other
|
||||||
|
if ( bestwidth <= 14 )
|
||||||
|
{
|
||||||
|
bestwidth += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store off width
|
||||||
|
pqf->fontinfo[ c ].charwidth = bestwidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free memory bits
|
||||||
|
free ( pbmi );
|
||||||
|
|
||||||
|
SelectObject( hmemDC, oldfnt );
|
||||||
|
DeleteObject( fnt );
|
||||||
|
|
||||||
|
SelectObject( hmemDC, oldbm );
|
||||||
|
|
||||||
|
DeleteObject( hbm );
|
||||||
|
|
||||||
|
DeleteDC( hmemDC );
|
||||||
|
ReleaseDC( NULL, hdc );
|
||||||
|
|
||||||
|
return pqf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma optimize( "g", on )
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
main
|
||||||
|
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
DWORD start, end;
|
||||||
|
char destfile[1024];
|
||||||
|
char sz[ 32 ];
|
||||||
|
int outsize[ 3 ];
|
||||||
|
|
||||||
|
qfont_t *fonts[ 3 ];
|
||||||
|
|
||||||
|
strcpy( fontname, DEFAULT_FONT );
|
||||||
|
|
||||||
|
printf("makefont.exe Version 2.0 by valve and DJXX (%s)\n", __DATE__ );
|
||||||
|
|
||||||
|
printf ("----- Creating Console Font ----\n");
|
||||||
|
|
||||||
|
for (i=1 ; i<argc ; i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(argv[i],"-font"))
|
||||||
|
{
|
||||||
|
strcpy( fontname, argv[i+1] );
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[i],"-pointsizes"))
|
||||||
|
{
|
||||||
|
if ( i + 3 >= argc )
|
||||||
|
{
|
||||||
|
Error( "Makefont: Insufficient point sizes specified\n" );
|
||||||
|
}
|
||||||
|
pointsize[0] = atoi( argv[i+1] );
|
||||||
|
pointsize[1] = atoi( argv[i+2] );
|
||||||
|
pointsize[2] = atoi( argv[i+3] );
|
||||||
|
i += 3;
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[i],"-italic"))
|
||||||
|
{
|
||||||
|
bItalic = TRUE;
|
||||||
|
printf ( "italic set\n");
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[i],"-bold"))
|
||||||
|
{
|
||||||
|
bBold = TRUE;
|
||||||
|
printf ( "bold set\n");
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[i],"-underline"))
|
||||||
|
{
|
||||||
|
bUnderline = TRUE;
|
||||||
|
printf ( "underline set\n");
|
||||||
|
}
|
||||||
|
else if ( argv[i][0] == '-' )
|
||||||
|
{
|
||||||
|
Error ("Unknown option \"%s\"", argv[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( i != argc - 1 )
|
||||||
|
{
|
||||||
|
Error ("usage: makefont [-font \"fontname\"] [-italic] [-underline] [-bold] [-pointsizes sm med lg] outfile");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "Creating %i, %i, and %i point %s fonts\n", pointsize[0], pointsize[1], pointsize[2], fontname );
|
||||||
|
|
||||||
|
start = timeGetTime();
|
||||||
|
|
||||||
|
// Create the fonts
|
||||||
|
for ( i = 0 ; i < 3; i++ )
|
||||||
|
{
|
||||||
|
fonts[ i ] = CreateProportionalConsoleFont( fontname, pointsize[i], bItalic, bUnderline, bBold, &outsize[ i ] );
|
||||||
|
//fonts[i] = CreateConsoleFont(fontname, pointsize[i], bItalic, bUnderline, bBold, &outsize[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create wad file
|
||||||
|
strcpy (destfile, argv[argc - 1]);
|
||||||
|
StripExtension (destfile);
|
||||||
|
DefaultExtension (destfile, ".wad");
|
||||||
|
|
||||||
|
NewWad( destfile, false );
|
||||||
|
|
||||||
|
// Add fonts as lumps
|
||||||
|
for ( i = 0; i < 3; i++ )
|
||||||
|
{
|
||||||
|
sprintf( sz, "font%i", i );
|
||||||
|
AddLump( sz, fonts[ i ], outsize[ i ], TYP_LUMPY + FONT_TAG, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store results as a WAD3
|
||||||
|
// NOTE: ( should be named fonts.wad in the valve\ subdirectory )
|
||||||
|
WriteWad( 3 );
|
||||||
|
|
||||||
|
// Clean up memory
|
||||||
|
for ( i = 0 ; i < 3; i++ )
|
||||||
|
{
|
||||||
|
free( fonts[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
end = timeGetTime ();
|
||||||
|
|
||||||
|
printf ( "%5.5f seconds elapsed\n", (float)( end - start )/1000.0 );
|
||||||
|
|
||||||
|
// Display for a second since it might not be running from command prompt
|
||||||
|
Sleep( 1000 );
|
||||||
|
return 0;
|
||||||
|
}
|
138
utils/makefont/makefont.dsp
Normal file
138
utils/makefont/makefont.dsp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="makefont" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=makefont - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "makefont.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "makefont.mak" CFG="makefont - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "makefont - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "makefont - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "makefont - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /Zi /O2 /I "../../common" /I "../common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX"qfont.h" /FD /c
|
||||||
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386
|
||||||
|
# Begin Special Build Tool
|
||||||
|
TargetPath=.\Release\makefont.exe
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
|
PostBuild_Desc=Copyint to valve\
|
||||||
|
PostBuild_Cmds=xcopy $(TargetPath) ..\..\..\valve /r /i
|
||||||
|
# End Special Build Tool
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "makefont - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../common" /I "../common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX"qfont.h" /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# Begin Special Build Tool
|
||||||
|
TargetPath=.\Debug\makefont.exe
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
|
PostBuild_Desc=Copyint to valve\
|
||||||
|
PostBuild_Cmds=xcopy $(TargetPath) ..\..\..\valve /r /i
|
||||||
|
# End Special Build Tool
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "makefont - Win32 Release"
|
||||||
|
# Name "makefont - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\common\cmdlib.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\makefont.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\common\wadlib.c
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\common\cmdlib.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\StdAfx.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\common\wadlib.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ReadMe.txt
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
3
utils/makefont/winebuild.sh
Executable file
3
utils/makefont/winebuild.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
winegcc -g -m32 makefont.cpp ../common/wadlib.c ../common/cmdlib.c -I../common/ -I../../common/ -mwindows -mno-cygwin -lwinmm -fno-stack-protector
|
65
xash.dsw
65
xash.dsw
@ -1,65 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "hl"=".\dlls\hl.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "client"=".\cl_dll\cl_dll.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "mainui"=".\mainui\mainui.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "engine"=".\engine\engine.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
65
xash_sdk.dsw
65
xash_sdk.dsw
@ -1,65 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "hl"=".\dlls\hl.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "client"=".\cl_dll\cl_dll.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "mainui"=".\mainui\mainui.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "game"=".\game_launch\game.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
22
xash_sdk.lst
22
xash_sdk.lst
@ -1,22 +0,0 @@
|
|||||||
//=======================================================================
|
|
||||||
// Copyright XashXT Group 2011 Š
|
|
||||||
// list with SDK directories
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
// global stuff
|
|
||||||
xash_sdk\xash_sdk.dsw
|
|
||||||
xash_sdk\cl_dll\
|
|
||||||
xash_sdk\cl_dll\hl\
|
|
||||||
xash_sdk\common\
|
|
||||||
xash_sdk\dlls\
|
|
||||||
xash_sdk\game_shared\
|
|
||||||
xash_sdk\game_launch\
|
|
||||||
xash_sdk\engine\
|
|
||||||
xash_sdk\pm_shared\
|
|
||||||
xash_sdk\mainui\
|
|
||||||
xash_dsk\mainui\legacy
|
|
||||||
xash_sdk\utils\
|
|
||||||
xash_sdk\makefont\
|
|
||||||
xash_sdk\utils\vgui\
|
|
||||||
xash_sdk\utils\vgui\include\
|
|
||||||
xash_sdk\utils\vgui\lib\win32_vc6\
|
|
Loading…
x
Reference in New Issue
Block a user