fix release keys on x11, remove ping addon, fix minor issue in outfit render, fix emblem updates
This commit is contained in:
parent
44a20222bb
commit
de0e4a1acf
1
TODO
1
TODO
|
@ -46,7 +46,6 @@ Low priority TODO
|
||||||
|
|
||||||
== Platform
|
== Platform
|
||||||
[bart] port to MacOs and iphone
|
[bart] port to MacOs and iphone
|
||||||
[bart] KeyDown, KeyText events
|
|
||||||
change win32 mouse cursor icon
|
change win32 mouse cursor icon
|
||||||
|
|
||||||
== UI
|
== UI
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
PingBar = {}
|
|
||||||
|
|
||||||
local pingLabel
|
|
||||||
|
|
||||||
-- public functions
|
|
||||||
function PingBar.init()
|
|
||||||
pingLabel = createWidget('UILabel', rootWidget:recursiveGetChildById('leftButtonsPanel'))
|
|
||||||
pingLabel:applyStyle({ ['anchors.left'] = 'prev.right',
|
|
||||||
['anchors.top'] = 'parent.top',
|
|
||||||
['margin-top'] = 12,
|
|
||||||
['margin-left'] = 20,
|
|
||||||
font = 'verdana-11px-rounded',
|
|
||||||
color = '#FE6500',
|
|
||||||
width = 120,
|
|
||||||
height = 16})
|
|
||||||
end
|
|
||||||
|
|
||||||
function PingBar.terminate()
|
|
||||||
pingLabel:destroy()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- hooked events
|
|
||||||
local function onGamePingUpdate(ping)
|
|
||||||
pingLabel:setText('Ping: ' .. ping .. ' ms')
|
|
||||||
end
|
|
||||||
|
|
||||||
connect(Game, { onWalkPingUpdate = onGamePingUpdate })
|
|
|
@ -1,15 +0,0 @@
|
||||||
Module
|
|
||||||
name: pingbar
|
|
||||||
description: Show ping in game
|
|
||||||
author: OTClient team
|
|
||||||
website: https://github.com/edubart/otclient
|
|
||||||
|
|
||||||
autoLoad: true
|
|
||||||
autoLoadAntecedence: 1000
|
|
||||||
|
|
||||||
onLoad: |
|
|
||||||
require 'pingbar'
|
|
||||||
PingBar.init()
|
|
||||||
|
|
||||||
onUnload: |
|
|
||||||
PingBar.terminate()
|
|
|
@ -91,6 +91,19 @@ void PlatformWindow::processKeyRelease(Fw::Key keyCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlatformWindow::releaseAllKeys()
|
||||||
|
{
|
||||||
|
for(auto it : m_keysState) {
|
||||||
|
Fw::Key keyCode = it.first;
|
||||||
|
bool pressed = it.second;
|
||||||
|
|
||||||
|
if(!pressed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
processKeyRelease(keyCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlatformWindow::fireKeysPress()
|
void PlatformWindow::fireKeysPress()
|
||||||
{
|
{
|
||||||
// avoid massive checks
|
// avoid massive checks
|
||||||
|
@ -119,4 +132,3 @@ void PlatformWindow::fireKeysPress()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ protected:
|
||||||
|
|
||||||
void processKeyDown(Fw::Key keyCode);
|
void processKeyDown(Fw::Key keyCode);
|
||||||
void processKeyRelease(Fw::Key keyCode);
|
void processKeyRelease(Fw::Key keyCode);
|
||||||
|
void releaseAllKeys();
|
||||||
void fireKeysPress();
|
void fireKeysPress();
|
||||||
|
|
||||||
std::map<int, Fw::Key> m_keyMap;
|
std::map<int, Fw::Key> m_keyMap;
|
||||||
|
|
|
@ -710,6 +710,7 @@ void X11Window::poll()
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
m_focused = false;
|
m_focused = false;
|
||||||
|
releaseAllKeys();
|
||||||
break;
|
break;
|
||||||
case Expose:
|
case Expose:
|
||||||
// window needs redraw
|
// window needs redraw
|
||||||
|
|
|
@ -117,8 +117,6 @@ void Creature::draw(const Point& p, const Rect&)
|
||||||
|
|
||||||
if(m_type->dimensions[ThingType::Layers] > 1) {
|
if(m_type->dimensions[ThingType::Layers] > 1) {
|
||||||
int maskId = m_type->getSpriteId(w, h, 1, m_xPattern, m_yPattern, m_zPattern, m_animation);
|
int maskId = m_type->getSpriteId(w, h, 1, m_xPattern, m_yPattern, m_zPattern, m_animation);
|
||||||
if(!maskId)
|
|
||||||
continue;
|
|
||||||
TexturePtr maskTex = g_sprites.getSpriteTexture(maskId);
|
TexturePtr maskTex = g_sprites.getSpriteTexture(maskId);
|
||||||
outfitProgram->setUniformTexture(MASK_TEXTURE_UNIFORM, maskTex, 1);
|
outfitProgram->setUniformTexture(MASK_TEXTURE_UNIFORM, maskTex, 1);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +290,6 @@ void Creature::cancelWalk(Otc::Direction direction, bool force)
|
||||||
if(direction != Otc::InvalidDirection)
|
if(direction != Otc::InvalidDirection)
|
||||||
setDirection(direction);
|
setDirection(direction);
|
||||||
|
|
||||||
if(m_outfit.getCategory() == ThingsType::Creature)
|
|
||||||
m_animation = 0;
|
m_animation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,7 @@ void Game::loginWorld(const std::string& account, const std::string& password, c
|
||||||
{
|
{
|
||||||
m_online = false;
|
m_online = false;
|
||||||
m_dead = false;
|
m_dead = false;
|
||||||
m_walkFeedback = true;
|
|
||||||
m_selectedThing = nullptr;
|
m_selectedThing = nullptr;
|
||||||
m_walkPing = 0;
|
|
||||||
m_protocolGame = ProtocolGamePtr(new ProtocolGame);
|
m_protocolGame = ProtocolGamePtr(new ProtocolGame);
|
||||||
m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName);
|
m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName);
|
||||||
}
|
}
|
||||||
|
@ -146,16 +144,9 @@ void Game::processCreatureMove(const CreaturePtr& creature, const Position& oldP
|
||||||
// teleport
|
// teleport
|
||||||
} else {
|
} else {
|
||||||
// stop walking on teleport
|
// stop walking on teleport
|
||||||
if(creature->isWalking())
|
if(creature->isWalking() || creature->isPreWalking())
|
||||||
creature->cancelWalk();
|
creature->cancelWalk();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(creature == m_localPlayer) {
|
|
||||||
if(!m_walkFeedback) {
|
|
||||||
updateWalkPing();
|
|
||||||
m_walkFeedback = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processAttackCancel()
|
void Game::processAttackCancel()
|
||||||
|
@ -166,10 +157,6 @@ void Game::processAttackCancel()
|
||||||
|
|
||||||
void Game::processWalkCancel(Otc::Direction direction)
|
void Game::processWalkCancel(Otc::Direction direction)
|
||||||
{
|
{
|
||||||
if(!m_walkFeedback) {
|
|
||||||
updateWalkPing();
|
|
||||||
m_walkFeedback = true;
|
|
||||||
}
|
|
||||||
m_localPlayer->cancelWalk(direction, true);
|
m_localPlayer->cancelWalk(direction, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,9 +177,6 @@ void Game::walk(Otc::Direction direction)
|
||||||
|
|
||||||
void Game::forceWalk(Otc::Direction direction)
|
void Game::forceWalk(Otc::Direction direction)
|
||||||
{
|
{
|
||||||
m_walkPingTimer.restart();
|
|
||||||
m_walkFeedback = false;
|
|
||||||
|
|
||||||
switch(direction) {
|
switch(direction) {
|
||||||
case Otc::North:
|
case Otc::North:
|
||||||
m_protocolGame->sendWalkNorth();
|
m_protocolGame->sendWalkNorth();
|
||||||
|
@ -478,9 +462,3 @@ bool Game::checkBotProtection()
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::updateWalkPing()
|
|
||||||
{
|
|
||||||
m_walkPing = m_walkPingTimer.ticksElapsed();
|
|
||||||
g_lua.callGlobalField("Game", "onWalkPingUpdate", m_walkPing);
|
|
||||||
}
|
|
||||||
|
|
|
@ -114,18 +114,12 @@ public:
|
||||||
LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
|
LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
|
||||||
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
|
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
|
||||||
int getProtocolVersion() { return PROTOCOL; }
|
int getProtocolVersion() { return PROTOCOL; }
|
||||||
int getWalkPing() { return m_walkPing; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateWalkPing();
|
|
||||||
|
|
||||||
LocalPlayerPtr m_localPlayer;
|
LocalPlayerPtr m_localPlayer;
|
||||||
ProtocolGamePtr m_protocolGame;
|
ProtocolGamePtr m_protocolGame;
|
||||||
bool m_online;
|
bool m_online;
|
||||||
bool m_dead;
|
bool m_dead;
|
||||||
bool m_walkFeedback;
|
|
||||||
Timer m_walkPingTimer;
|
|
||||||
int m_walkPing;
|
|
||||||
int m_serverBeat;
|
int m_serverBeat;
|
||||||
ThingPtr m_selectedThing;
|
ThingPtr m_selectedThing;
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,6 +65,7 @@ void Tile::draw(const Point& p, const Rect& visibleRect)
|
||||||
|
|
||||||
// we can render creatures in 3x3 range
|
// we can render creatures in 3x3 range
|
||||||
//TODO: this algorithm is slowing down render too much, but it could be cached to improve framerate
|
//TODO: this algorithm is slowing down render too much, but it could be cached to improve framerate
|
||||||
|
//NOTE: looping for 9 tiles is a dirty way to render walking creatures, must change this later
|
||||||
for(int xi = -1; xi <= 1; ++xi) {
|
for(int xi = -1; xi <= 1; ++xi) {
|
||||||
for(int yi = -1; yi <= 1; ++yi) {
|
for(int yi = -1; yi <= 1; ++yi) {
|
||||||
for(CreaturePtr creature : g_map.getTile(m_pos + Position(xi, yi, 0))->getCreatures()) {
|
for(CreaturePtr creature : g_map.getTile(m_pos + Position(xi, yi, 0))->getCreatures()) {
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||||
int skull = msg.getU8();
|
int skull = msg.getU8();
|
||||||
int shield = msg.getU8();
|
int shield = msg.getU8();
|
||||||
|
|
||||||
int emblem = 0;
|
int emblem = -1;
|
||||||
if(thingId == 0x0061) // emblem is sent only in packet type 0x61
|
if(thingId == 0x0061) // emblem is sent only in packet type 0x61
|
||||||
emblem = msg.getU8();
|
emblem = msg.getU8();
|
||||||
|
|
||||||
|
@ -1138,6 +1138,7 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||||
creature->setSpeed(speed);
|
creature->setSpeed(speed);
|
||||||
creature->setSkull(skull);
|
creature->setSkull(skull);
|
||||||
creature->setShield(shield);
|
creature->setShield(shield);
|
||||||
|
if(emblem != -1)
|
||||||
creature->setEmblem(emblem);
|
creature->setEmblem(emblem);
|
||||||
creature->setPassable(passable);
|
creature->setPassable(passable);
|
||||||
creature->cancelWalk(direction);
|
creature->cancelWalk(direction);
|
||||||
|
|
Loading…
Reference in New Issue