Skip to content

Commit 9b57b11

Browse files
committed
Merge branch 'master' into asheep
2 parents 7a69966 + 343b09b commit 9b57b11

File tree

5 files changed

+126
-30
lines changed

5 files changed

+126
-30
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,36 @@ jobs:
6565
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all
6666
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install
6767
68-
- name: Add msbuild to PATH
68+
- name: Set developer command prompt for Windows x86
6969
if: startsWith(matrix.os, 'windows')
70-
uses: microsoft/setup-msbuild@v2
70+
uses: ilammy/msvc-dev-cmd@v1
71+
with:
72+
arch: x86
73+
7174
- name: Build on Windows
7275
if: startsWith(matrix.os, 'windows')
7376
run: |
74-
cmake -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist"
75-
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
76-
- name: Build on Windows x64
77+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build -S . -DCMAKE_INSTALL_PREFIX="dist"
78+
cmake --build build --target all
79+
cmake --build build --target install
80+
- name: Build on Windows with vgui
7781
if: startsWith(matrix.os, 'windows')
7882
run: |
79-
cmake -A x64 -B build64 -DCMAKE_INSTALL_PREFIX="dist64" -D64BIT=ON
80-
msbuild -verbosity:normal /property:Configuration=Release /property:Platform=x64 build64/INSTALL.vcxproj
81-
- name: Build on Windows with vgui
83+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build -S . -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="dist-vgui"
84+
cmake --build build --target all
85+
cmake --build build --target install
86+
87+
- name: Set developer command prompt for Windows x86_64
88+
if: startsWith(matrix.os, 'windows')
89+
uses: ilammy/msvc-dev-cmd@v1
90+
with:
91+
arch: x64
92+
- name: Build on Windows x64
8293
if: startsWith(matrix.os, 'windows')
8394
run: |
84-
cmake -A Win32 -B build -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="dist-vgui"
85-
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
95+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build64 -S . -DCMAKE_INSTALL_PREFIX="dist64" -D64BIT=ON
96+
cmake --build build64 --target all
97+
cmake --build build64 --target install
8698
8799
- name: Extract branch name
88100
shell: bash

.github/workflows/manual.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@ jobs:
7676
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
7777
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
7878
79-
- name: Add msbuild to PATH
79+
- name: Set developer command prompt for Windows x86
8080
if: startsWith(matrix.os, 'windows')
81-
uses: microsoft/setup-msbuild@v2
81+
uses: ilammy/msvc-dev-cmd@v1
82+
with:
83+
arch: x86
8284
- name: Build on Windows
8385
if: startsWith(matrix.os, 'windows')
8486
run: |
85-
cmake -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }}
86-
msbuild -verbosity:normal /property:Configuration=${{ github.event.inputs.buildtype }} build/INSTALL.vcxproj
87+
cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=${{ github.event.inputs.buildtype }} -DCMAKE_INSTALL_PREFIX="dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }}
88+
cmake --build build --target all\
89+
cmake --build build --target install
8790
8891
- name: Extract branch name
8992
shell: bash

cl_dll/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ install( TARGETS ${CLDLL_LIBRARY}
235235
GROUP_READ GROUP_EXECUTE
236236
WORLD_READ WORLD_EXECUTE )
237237

238-
if(CMAKE_BUILD_TYPE MATCHES "Release")
238+
if(CMAKE_BUILD_TYPE MATCHES "Release" AND NOT WIN32)
239239
add_custom_command(TARGET ${CLDLL_LIBRARY}
240240
POST_BUILD DEPENDS ${CLDLL_LIBRARY}
241241
COMMAND ${CMAKE_STRIP} -s $<TARGET_FILE:${CLDLL_LIBRARY}>)

cl_dll/menu.cpp

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,69 @@ int CHudMenu::VidInit( void )
6666
return 1;
6767
}
6868

69+
/*
70+
=================================
71+
ParseEscapeToken
72+
73+
Interprets the given escape token (backslash followed by a letter). The
74+
first character of the token must be a backslash. The second character
75+
specifies the operation to perform:
76+
77+
\w : White text (this is the default)
78+
\d : Dim (gray) text
79+
\y : Yellow text
80+
\r : Red text
81+
\R : Right-align (just for the remainder of the current line)
82+
=================================
83+
*/
84+
85+
static int menu_r, menu_g, menu_b, menu_x, menu_ralign;
86+
87+
static inline const char* ParseEscapeToken( const char* token )
88+
{
89+
if( *token != '\\' )
90+
return token;
91+
92+
token++;
93+
94+
switch( *token )
95+
{
96+
case '\0':
97+
return token;
98+
99+
case 'w':
100+
menu_r = 255;
101+
menu_g = 255;
102+
menu_b = 255;
103+
break;
104+
105+
case 'd':
106+
menu_r = 100;
107+
menu_g = 100;
108+
menu_b = 100;
109+
break;
110+
111+
case 'y':
112+
menu_r = 255;
113+
menu_g = 210;
114+
menu_b = 64;
115+
break;
116+
117+
case 'r':
118+
menu_r = 210;
119+
menu_g = 24;
120+
menu_b = 0;
121+
break;
122+
123+
case 'R':
124+
menu_x = ScreenWidth / 2;
125+
menu_ralign = TRUE;
126+
break;
127+
}
128+
129+
return ++token;
130+
}
131+
69132
int CHudMenu::Draw( float flTime )
70133
{
71134
int i;
@@ -97,27 +160,45 @@ int CHudMenu::Draw( float flTime )
97160
// count the number of newlines
98161
int nlc = 0;
99162
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
100-
{
101163
if( g_szMenuString[i] == '\n' )
102164
nlc++;
103-
}
104165

105-
int nFontHeight = Q_max(12, screenInfo.iCharHeight);
166+
int nFontHeight = Q_max( 12, screenInfo.iCharHeight );
106167

107168
// center it
108-
int y = ( ScreenHeight / 2 ) - ( ( nlc / 2 ) * nFontHeight ) - (3 * nFontHeight + nFontHeight / 3); // make sure it is above the say text
109-
int x = 20;
169+
int y = ( ScreenHeight / 2 ) - (( nlc / 2 )* nFontHeight ) - ( 3 * nFontHeight + nFontHeight / 3 ); // make sure it is above the say text
110170

111-
i = 0;
112-
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' )
113-
{
114-
gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 );
115-
y += nFontHeight;
171+
menu_r = 255;
172+
menu_g = 255;
173+
menu_b = 255;
174+
menu_x = 20;
175+
menu_ralign = FALSE;
116176

117-
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' )
118-
i++;
119-
if( g_szMenuString[i] == '\n' )
120-
i++;
177+
const char* sptr = g_szMenuString;
178+
179+
while( *sptr != '\0' )
180+
{
181+
if( *sptr == '\\' )
182+
sptr = ParseEscapeToken( sptr );
183+
else if( *sptr == '\n' )
184+
{
185+
menu_ralign = FALSE;
186+
menu_x = 20;
187+
y += nFontHeight;
188+
sptr++;
189+
}
190+
else
191+
{
192+
char menubuf[80] = "";
193+
const char *ptr = sptr;
194+
while( *sptr != '\0' && *sptr != '\n' && *sptr != '\\' )
195+
sptr++;
196+
strlcpy( menubuf, ptr, Q_min(( sptr - ptr + 1 ), (int)sizeof( menubuf )));
197+
if( menu_ralign )
198+
// IMPORTANT: Right-to-left rendered text does not parse escape tokens!
199+
menu_x = gHUD.DrawHudStringReverse( menu_x, y, 0, menubuf, menu_r, menu_g, menu_b );
200+
else menu_x = gHUD.DrawHudString( menu_x, y, 320, menubuf, menu_r, menu_g, menu_b );
201+
}
121202
}
122203

123204
return 1;

dlls/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ install( TARGETS ${SVDLL_LIBRARY}
228228
GROUP_READ GROUP_EXECUTE
229229
WORLD_READ WORLD_EXECUTE)
230230

231-
if(CMAKE_BUILD_TYPE MATCHES "Release")
231+
if(CMAKE_BUILD_TYPE MATCHES "Release" AND NOT WIN32)
232232
add_custom_command(TARGET ${SVDLL_LIBRARY}
233233
POST_BUILD DEPENDS ${SVDLL_LIBRARY}
234234
COMMAND ${CMAKE_STRIP} -s $<TARGET_FILE:${SVDLL_LIBRARY}>)

0 commit comments

Comments
 (0)