not working

This commit is contained in:
nullifiedcat 2018-07-30 15:59:02 +03:00
parent 86c23c0f9e
commit 1c4a0b90a6
2 changed files with 29 additions and 8 deletions

View File

@ -178,7 +178,6 @@ void draw::InitGL()
void draw::BeginGL() void draw::BeginGL()
{ {
glColor3f(1, 1, 1); glColor3f(1, 1, 1);
glDisable(GL_FRAMEBUFFER_SRGB);
#if EXTERNAL_DRAWING #if EXTERNAL_DRAWING
xoverlay_draw_begin(); xoverlay_draw_begin();
{ {
@ -190,6 +189,7 @@ void draw::BeginGL()
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
PROF_SECTION(draw_begin__glez_begin); PROF_SECTION(draw_begin__glez_begin);
glez::begin(); glez::begin();
glDisable(GL_FRAMEBUFFER_SRGB);
PROF_SECTION(DRAWEX_draw_begin); PROF_SECTION(DRAWEX_draw_begin);
} }
} }
@ -199,6 +199,7 @@ void draw::EndGL()
PROF_SECTION(DRAWEX_draw_end); PROF_SECTION(DRAWEX_draw_end);
{ {
PROF_SECTION(draw_end__glez_end); PROF_SECTION(draw_end__glez_end);
glEnable(GL_FRAMEBUFFER_SRGB);
glez::end(); glez::end();
} }
#if EXTERNAL_DRAWING #if EXTERNAL_DRAWING

View File

@ -7,6 +7,7 @@
#include <drawing.hpp> #include <drawing.hpp>
#include <menu/menu/special/SettingsManagerList.hpp> #include <menu/menu/special/SettingsManagerList.hpp>
#include <menu/menu/special/PlayerListController.hpp> #include <menu/menu/special/PlayerListController.hpp>
#include <hack.hpp>
static settings::Button open_gui_button{ "visual.open-gui-button", "Insert" }; 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{}; player_info_s info{};
g_IEngine->GetPlayerInfo(idx, &info); g_IEngine->GetPlayerInfo(idx, &info);
data.classId = g_pPlayerResource->getClass(idx); 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.dead = !g_pPlayerResource->isAlive(idx);
data.steam = info.friendsID; 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; return data;
} }
@ -43,31 +45,38 @@ public:
std::string name = event->GetName(); std::string name = event->GetName();
if (name == "player_connect_client") if (name == "player_connect_client")
{ {
logging::Info("addPlayer %d", userid);
controller->addPlayer(userid, createPlayerListData(userid)); controller->addPlayer(userid, createPlayerListData(userid));
} }
else if (name == "player_disconnect") else if (name == "player_disconnect")
{ {
logging::Info("removePlayer %d", userid);
controller->removePlayer(userid); controller->removePlayer(userid);
} }
else if (name == "player_team") 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") else if (name == "player_changeclass")
{ {
logging::Info("updatePlayerClass %d", userid);
controller->updatePlayerClass(userid, event->GetInt("class")); controller->updatePlayerClass(userid, event->GetInt("class"));
} }
else if (name == "player_changename") else if (name == "player_changename")
{ {
logging::Info("updatePlayerName %d", userid);
controller->updatePlayerName(userid, event->GetString("newname")); controller->updatePlayerName(userid, event->GetString("newname"));
} }
else if (name == "player_death") else if (name == "player_death")
{ {
controller->updatePlayerLifeState(userid, false); logging::Info("updatePlayerLifeState %d", userid);
controller->updatePlayerLifeState(userid, true);
} }
else if (name == "player_spawn") 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<zerokernel::special::PlayerListController>(*pl); controller = std::make_unique<zerokernel::special::PlayerListController>(*pl);
controller->setKickButtonCallback([](int uid) { controller->setKickButtonCallback([](int uid) {
// TODO hack::command_stack().push("callvote kick " + uid);
}); });
controller->setOpenSteamCallback([](unsigned steam) { controller->setOpenSteamCallback([](unsigned steam) {
CSteamID id{}; CSteamID id{};
@ -89,6 +98,10 @@ static void initPlayerlist()
g_ISteamFriends->ActivateGameOverlayToUser("steamid", id); g_ISteamFriends->ActivateGameOverlayToUser("steamid", id);
}); });
} }
else
{
logging::Info("PlayerList element not found\n");
}
} }
static void load() static void load()
@ -137,7 +150,6 @@ bool gui::handleSdlEvent(SDL_Event *event)
{ {
if (event->type == SDL_KEYDOWN) 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) if (event->key.keysym.scancode == (*open_gui_button).scan)
{ {
logging::Info("GUI open button pressed"); logging::Info("GUI open button pressed");
@ -154,6 +166,14 @@ void gui::onLevelLoad()
if (controller) if (controller)
{ {
controller->removeAll(); 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));
}
}
} }
} }