Skip to content

Commit cdc0e3f

Browse files
committed
Merge branch 'dev' into dev_openAL
2 parents 46bf742 + f3affdb commit cdc0e3f

File tree

5 files changed

+57
-51
lines changed

5 files changed

+57
-51
lines changed

.refresh win32.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
cls
3+
title Generating Build Files
4+
cmake -A Win32 -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5
5+
echo Look above in case anything went wrong. Otherwise,
6+
pause

cl_dll/discord_integration.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
using namespace std::literals::string_literals;
1616

17+
static char s_largeImageKey[64];
18+
1719
namespace discord_integration
1820
{
1921
namespace
@@ -36,15 +38,10 @@ namespace discord_integration
3638
// BlueNightHawk : Convert Uppercase Map Names to Lowercase. 2021.
3739
void LowerCase(const char* in, char* out, int size)
3840
{
39-
for (int i = 0; i < size; i++)
40-
{
41-
if (!out[i] || out[i] == '\0')
42-
{
43-
out[i] = in[i];
44-
continue;
45-
}
46-
out[i] = (char)tolower(in[i]);
47-
}
41+
int i = 0;
42+
for (; i < size - 1 && in[i] != '\0'; i++)
43+
out[i] = (char)tolower((unsigned char)in[i]);
44+
out[i] = '\0';
4845
}
4946

5047

@@ -323,16 +320,16 @@ namespace discord_integration
323320

324321
// Get the map name and icon.
325322
get_map_name(map_name, ARRAYSIZE(map_name));
326-
if (map_name[0])
323+
if (cur_state != game_state::NOT_PLAYING && map_name[0])
327324
{
328-
char newmapname[64];
325+
// lowercased version into static buffer
326+
for (int i = 0; i < (int)sizeof(s_largeImageKey) - 1 && map_name[i]; ++i)
327+
s_largeImageKey[i] = (char)tolower((unsigned char)map_name[i]);
328+
s_largeImageKey[strlen(map_name)] = '\0';
329329

330-
LowerCase((const char*)map_name, newmapname, ARRAYSIZE(map_name));
330+
// verify the map is in the set
331331
if (maps_with_thumbnails.find(map_name) != maps_with_thumbnails.cend())
332-
presence.largeImageKey = newmapname;
333-
334-
if (custom_maps_with_thumbnails.find(map_name) != custom_maps_with_thumbnails.cend())
335-
presence.largeImageKey = newmapname;
332+
presence.largeImageKey = s_largeImageKey;
336333

337334
presence.largeImageText = map_name;
338335
}
@@ -355,6 +352,9 @@ namespace discord_integration
355352

356353
presence.state = state.c_str();
357354

355+
gEngfuncs.Con_Printf("[DiscordRPC] largeImageKey = '%s'\n", presence.largeImageKey);
356+
gEngfuncs.Con_Printf("[DiscordRPC] map_name = '%s'\n", map_name);
357+
358358
Discord_UpdatePresence(&presence);
359359
}
360360

cl_dll/ev_hldm.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,18 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
308308
if (iBulletType == BULLET_PLAYER_CROWBAR)
309309
return 0.0; // crowbar already makes this sound
310310
fvol = 1.0; fvolbar = 0.2;
311-
//rgsz[0] = "weapons/bullet_hit1.wav";
312-
//rgsz[1] = "weapons/bullet_hit2.wav";
311+
#ifndef _HALO
312+
rgsz[0] = "player/hitsound01.wav";
313+
rgsz[1] = "player/hitsound02.wav";
314+
rgsz[2] = "player/hitsound03.wav";
315+
rgsz[3] = "player/hitsound04.wav";
316+
fattn = 1.0;
317+
cnt = 4;
318+
#else
313319
rgsz[0] = "player/hitsound.wav";
314320
fattn = 1.0;
315321
cnt = 1;
322+
#endif
316323
break;
317324
}
318325

cl_dll/gameui/composer/CustomGameComposer.cpp

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,6 @@ CMapListPanel::CMapListPanel(Panel* pParent) : Panel(pParent, "MapListPanel")
261261
m_pList->SetMultiselectEnabled(false);
262262
m_pList->SetSelectIndividualCells(true); // not sure about keeping this
263263
m_pList->AddActionSignalTarget(this);
264-
265-
m_pThumbnail = new ImagePanel(this, "MapThumbnail");
266-
m_pThumbnail->SetBounds(0, 410, 250, 150);
267-
m_pThumbnail->SetImage("ui/gfx/vgui/nomap.tga"); // fallback
268-
m_pThumbnail->SetShouldScaleImage(true);
269-
m_pThumbnail->SetShouldCenterImage(true);
270-
m_pThumbnail->SetScaleAmount(1.0f);
271-
m_pThumbnail->SetPos(4, 4);
272264
}
273265

274266
void CMapListPanel::SetMapThumbnail(const char* mapName)
@@ -488,31 +480,6 @@ CComposerOptionsPanel::CComposerOptionsPanel(Panel* pParent) : Panel(pParent, "C
488480
m_pMaxplayers->SetText("12");
489481
y += 30;
490482

491-
// CHECK BUTTONS
492-
m_pLAN = new CheckButton(this, "LAN", "Local server");
493-
m_pLAN->SetBounds(5, y, 200, 20); y += 25;
494-
495-
m_pRealisticFall = new CheckButton(this, "Fall", "Realistic fall damage");
496-
m_pRealisticFall->SetBounds(5, y, 200, 20); y += 25;
497-
498-
m_pAutoGamemode = new CheckButton(this, "AutoGM", "Auto gamemode switch for CTF maps");
499-
m_pAutoGamemode->SetBounds(5, y, 250, 20); y += 25;
500-
501-
m_pFlashlight = new CheckButton(this, "Flash", "Enable Flashlight");
502-
m_pFlashlight->SetBounds(5, y, 250, 20); y += 25;
503-
504-
m_pFriendlyFire = new CheckButton(this, "FF", "Friendly Fire");
505-
m_pFriendlyFire->SetBounds(5, y, 200, 20); y += 25;
506-
507-
m_pWeaponsStay = new CheckButton(this, "WS", "Weapons Stay");
508-
m_pWeaponsStay->SetBounds(5, y, 200, 20); y += 25;
509-
510-
m_pForceRespawn = new CheckButton(this, "FR", "Force Respawn");
511-
m_pForceRespawn->SetBounds(5, y, 200, 20); y += 25;
512-
513-
m_pAllowCheats = new CheckButton(this, "Cheats", "Allow Cheats");
514-
m_pAllowCheats->SetBounds(5, y, 200, 20); y += 25;
515-
516483
// SPAWN SYSTEM
517484
m_lSpawnSystem = new Label(this, "SpawnLabel", "Spawn System");
518485
m_lSpawnSystem->R_BOUNDARY;
@@ -563,6 +530,32 @@ CComposerOptionsPanel::CComposerOptionsPanel(Panel* pParent) : Panel(pParent, "C
563530
m_pTimeLimit = new TextEntry(this, "TimeLimit");
564531
m_pTimeLimit->SetBounds(10, y, 200, 20);
565532
m_pTimeLimit->SetText("15"); y += 30;
533+
534+
// CHECK BUTTONS
535+
m_pLAN = new CheckButton(this, "LAN", "Local server");
536+
m_pLAN->SetBounds(5, y, 200, 20); y += 25;
537+
538+
m_pRealisticFall = new CheckButton(this, "Fall", "Realistic fall damage");
539+
m_pRealisticFall->SetBounds(5, y, 200, 20); y += 25;
540+
541+
m_pAutoGamemode = new CheckButton(this, "AutoGM", "Auto gamemode switch for CTF maps");
542+
m_pAutoGamemode->SetBounds(5, y, 250, 20); y += 25;
543+
544+
m_pFlashlight = new CheckButton(this, "Flash", "Enable Flashlight");
545+
m_pFlashlight->SetBounds(5, y, 250, 20); y += 25;
546+
547+
m_pFriendlyFire = new CheckButton(this, "FF", "Friendly Fire");
548+
m_pFriendlyFire->SetBounds(5, y, 200, 20); y += 25;
549+
550+
m_pWeaponsStay = new CheckButton(this, "WS", "Weapons Stay");
551+
m_pWeaponsStay->SetBounds(5, y, 200, 20); y += 25;
552+
553+
m_pForceRespawn = new CheckButton(this, "FR", "Force Respawn");
554+
m_pForceRespawn->SetBounds(5, y, 200, 20); y += 25;
555+
556+
m_pAllowCheats = new CheckButton(this, "Cheats", "Allow Cheats");
557+
m_pAllowCheats->SetBounds(5, y, 200, 20); y += 25;
558+
566559
}
567560

568561
void CComposerOptionsPanel::LoadMapcycles()

0 commit comments

Comments
 (0)