mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Split HUD code off to hud.cpp, make into a class, extensive Lua HUD modification
This commit is contained in:
parent
49f6e347f0
commit
666aae3593
12 changed files with 793 additions and 816 deletions
|
@ -2042,35 +2042,35 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||
}
|
||||
else if(command == TOCLIENT_HUDADD)
|
||||
{
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
std::string datastring((char *)&data[2], datasize - 2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
u32 id = readU32(is);
|
||||
u8 type = readU8(is);
|
||||
core::vector2df pos = readV2F1000(is);
|
||||
std::string name = deSerializeString(is);
|
||||
core::vector2df scale = readV2F1000(is);
|
||||
std::string text = deSerializeString(is);
|
||||
u32 number = readU32(is);
|
||||
u32 item = readU32(is);
|
||||
u32 dir = readU32(is);
|
||||
u32 id = readU32(is);
|
||||
u8 type = readU8(is);
|
||||
v2f pos = readV2F1000(is);
|
||||
std::string name = deSerializeString(is);
|
||||
v2f scale = readV2F1000(is);
|
||||
std::string text = deSerializeString(is);
|
||||
u32 number = readU32(is);
|
||||
u32 item = readU32(is);
|
||||
u32 dir = readU32(is);
|
||||
|
||||
ClientEvent event;
|
||||
event.type = CE_HUDADD;
|
||||
event.hudadd.id = id;
|
||||
event.hudadd.type = type;
|
||||
event.hudadd.pos = new v2f(pos);
|
||||
event.hudadd.name = new std::string(name);
|
||||
event.hudadd.scale = new v2f(scale);
|
||||
event.hudadd.text = new std::string(text);
|
||||
event.hudadd.id = id;
|
||||
event.hudadd.type = type;
|
||||
event.hudadd.pos = new v2f(pos);
|
||||
event.hudadd.name = new std::string(name);
|
||||
event.hudadd.scale = new v2f(scale);
|
||||
event.hudadd.text = new std::string(text);
|
||||
event.hudadd.number = number;
|
||||
event.hudadd.item = item;
|
||||
event.hudadd.dir = dir;
|
||||
event.hudadd.item = item;
|
||||
event.hudadd.dir = dir;
|
||||
m_client_event_queue.push_back(event);
|
||||
}
|
||||
else if(command == TOCLIENT_HUDRM)
|
||||
{
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
std::string datastring((char *)&data[2], datasize - 2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
u32 id = readU32(is);
|
||||
|
@ -2081,30 +2081,31 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||
m_client_event_queue.push_back(event);
|
||||
}
|
||||
else if(command == TOCLIENT_HUDCHANGE)
|
||||
{
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
{
|
||||
std::string sdata;
|
||||
v2f v2fdata;
|
||||
u32 intdata = 0;
|
||||
|
||||
std::string datastring((char *)&data[2], datasize - 2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
u32 id = readU32(is);
|
||||
u8 stat = readU8(is);
|
||||
core::vector2df v2fdata;
|
||||
std::string sdata;
|
||||
u32 data = 0;
|
||||
if(stat == 0 || stat == 2) {
|
||||
u32 id = readU32(is);
|
||||
u8 stat = (HudElementStat)readU8(is);
|
||||
|
||||
if (stat == HUD_STAT_POS || stat == HUD_STAT_SCALE)
|
||||
v2fdata = readV2F1000(is);
|
||||
} else if(stat == 1 || stat == 3) {
|
||||
else if (stat == HUD_STAT_NAME || stat == HUD_STAT_TEXT)
|
||||
sdata = deSerializeString(is);
|
||||
} else {
|
||||
data = readU32(is);
|
||||
}
|
||||
|
||||
else
|
||||
intdata = readU32(is);
|
||||
|
||||
ClientEvent event;
|
||||
event.type = CE_HUDCHANGE;
|
||||
event.hudchange.id = id;
|
||||
event.hudchange.stat = stat;
|
||||
event.hudchange.id = id;
|
||||
event.hudchange.stat = (HudElementStat)stat;
|
||||
event.hudchange.v2fdata = new v2f(v2fdata);
|
||||
event.hudchange.sdata = new std::string(sdata);
|
||||
event.hudchange.data = data;
|
||||
event.hudchange.sdata = new std::string(sdata);
|
||||
event.hudchange.data = intdata;
|
||||
m_client_event_queue.push_back(event);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue