From 1c4a0b90a6ffaba3f664f3859ce9e493bfba300c Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 30 Jul 2018 15:59:02 +0300 Subject: [PATCH] not working --- src/visual/drawing.cpp | 3 ++- src/visual/menu/GuiInterface.cpp | 34 +++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/visual/drawing.cpp b/src/visual/drawing.cpp index b4192252..8446ec11 100644 --- a/src/visual/drawing.cpp +++ b/src/visual/drawing.cpp @@ -178,7 +178,6 @@ void draw::InitGL() void draw::BeginGL() { glColor3f(1, 1, 1); - glDisable(GL_FRAMEBUFFER_SRGB); #if EXTERNAL_DRAWING xoverlay_draw_begin(); { @@ -190,6 +189,7 @@ void draw::BeginGL() glActiveTexture(GL_TEXTURE0); PROF_SECTION(draw_begin__glez_begin); glez::begin(); + glDisable(GL_FRAMEBUFFER_SRGB); PROF_SECTION(DRAWEX_draw_begin); } } @@ -199,6 +199,7 @@ void draw::EndGL() PROF_SECTION(DRAWEX_draw_end); { PROF_SECTION(draw_end__glez_end); + glEnable(GL_FRAMEBUFFER_SRGB); glez::end(); } #if EXTERNAL_DRAWING diff --git a/src/visual/menu/GuiInterface.cpp b/src/visual/menu/GuiInterface.cpp index 9fadfd91..d5be79c0 100644 --- a/src/visual/menu/GuiInterface.cpp +++ b/src/visual/menu/GuiInterface.cpp @@ -7,6 +7,7 @@ #include #include #include +#include static settings::Button open_gui_button{ "visual.open-gui-button", "Insert" }; @@ -21,10 +22,11 @@ static zerokernel::special::PlayerListData createPlayerListData(int userid) player_info_s info{}; g_IEngine->GetPlayerInfo(idx, &info); data.classId = g_pPlayerResource->getClass(idx); - data.teamId = g_pPlayerResource->getTeam(idx); + data.teamId = g_pPlayerResource->getTeam(idx) - 1; data.dead = !g_pPlayerResource->isAlive(idx); data.steam = info.friendsID; - strncpy(data.name, info.name, 31); + logging::Info("Player name: %s", info.name); + snprintf(data.name, 31, "%s", info.name); return data; } @@ -43,31 +45,38 @@ public: std::string name = event->GetName(); if (name == "player_connect_client") { + logging::Info("addPlayer %d", userid); controller->addPlayer(userid, createPlayerListData(userid)); } else if (name == "player_disconnect") { + logging::Info("removePlayer %d", userid); controller->removePlayer(userid); } else if (name == "player_team") { - controller->updatePlayerTeam(userid, event->GetInt("team")); + logging::Info("updatePlayerTeam %d", userid); + controller->updatePlayerTeam(userid, event->GetInt("team") - 1); } else if (name == "player_changeclass") { + logging::Info("updatePlayerClass %d", userid); controller->updatePlayerClass(userid, event->GetInt("class")); } else if (name == "player_changename") { + logging::Info("updatePlayerName %d", userid); controller->updatePlayerName(userid, event->GetString("newname")); } else if (name == "player_death") { - controller->updatePlayerLifeState(userid, false); + logging::Info("updatePlayerLifeState %d", userid); + controller->updatePlayerLifeState(userid, true); } else if (name == "player_spawn") { - controller->updatePlayerLifeState(userid, true); + logging::Info("updatePlayerLifeState %d", userid); + controller->updatePlayerLifeState(userid, false); } } }; @@ -81,7 +90,7 @@ static void initPlayerlist() { controller = std::make_unique(*pl); controller->setKickButtonCallback([](int uid) { - // TODO + hack::command_stack().push("callvote kick " + uid); }); controller->setOpenSteamCallback([](unsigned steam) { CSteamID id{}; @@ -89,6 +98,10 @@ static void initPlayerlist() g_ISteamFriends->ActivateGameOverlayToUser("steamid", id); }); } + else + { + logging::Info("PlayerList element not found\n"); + } } static void load() @@ -137,7 +150,6 @@ bool gui::handleSdlEvent(SDL_Event *event) { if (event->type == SDL_KEYDOWN) { - logging::Info("%d %d\n", event->key.keysym.scancode, (*open_gui_button).scan); if (event->key.keysym.scancode == (*open_gui_button).scan) { logging::Info("GUI open button pressed"); @@ -154,6 +166,14 @@ void gui::onLevelLoad() if (controller) { controller->removeAll(); + for (auto i = 1; i < 32; ++i) + { + player_info_s info{}; + if (g_IEngine->GetPlayerInfo(i, &info)) + { + controller->addPlayer(info.userID, createPlayerListData(info.userID)); + } + } } }