move color encoding functions to GVMEncoder header
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "ChatCommands.hh"
|
||||
#include "Compression.hh"
|
||||
#include "GVMEncoder.hh"
|
||||
#include "Loggers.hh"
|
||||
#include "PSOProtocol.hh"
|
||||
#include "ReceiveCommands.hh"
|
||||
@@ -36,10 +37,6 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
static constexpr uint16_t encode_xrgb1555(uint32_t xrgb8888) {
|
||||
return ((xrgb8888 >> 9) & 0x7C00) | ((xrgb8888 >> 6) & 0x03E0) | ((xrgb8888 >> 3) & 0x001F);
|
||||
}
|
||||
|
||||
struct HandlerResult {
|
||||
enum class Type {
|
||||
FORWARD = 0,
|
||||
@@ -1053,7 +1050,7 @@ static HandlerResult C_GXB_61(shared_ptr<ProxyServer::LinkedSession> ses, uint16
|
||||
modified = true;
|
||||
}
|
||||
if (!ses->challenge_rank_title_override.empty()) {
|
||||
pd.records.challenge.title_color = encode_xrgb1555(ses->challenge_rank_color_override);
|
||||
pd.records.challenge.title_color = encode_xrgb8888_to_xrgb1555(ses->challenge_rank_color_override);
|
||||
pd.records.challenge.rank_title.encode(ses->challenge_rank_title_override, ses->language());
|
||||
}
|
||||
|
||||
@@ -1090,7 +1087,7 @@ static HandlerResult C_GXB_61(shared_ptr<ProxyServer::LinkedSession> ses, uint16
|
||||
modified = true;
|
||||
}
|
||||
if (!ses->challenge_rank_title_override.empty()) {
|
||||
pd->records.challenge.stats.title_color = encode_xrgb1555(ses->challenge_rank_color_override);
|
||||
pd->records.challenge.stats.title_color = encode_xrgb8888_to_xrgb1555(ses->challenge_rank_color_override);
|
||||
pd->records.challenge.rank_title.encode(ses->challenge_rank_title_override, ses->language());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user