Mounts
Show creature mounts Fix outfit window Fix some 9.6 protocol issues
This commit is contained in:
parent
5419eece66
commit
657640c270
|
@ -18,8 +18,8 @@ Window
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
@onEnter: accept()
|
@onEnter: modules.game_outfit.accept()
|
||||||
@onEscape: destroy()
|
@onEscape: modules.game_outfit.destroy()
|
||||||
|
|
||||||
// Creature Boxes
|
// Creature Boxes
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ Window
|
||||||
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
enabled: true
|
enabled: true
|
||||||
@onClick: nextOutfitType()
|
@onClick: modules.game_outfit.nextOutfitType()
|
||||||
|
|
||||||
PrevOutfitButton
|
PrevOutfitButton
|
||||||
id: outfitPrevButton
|
id: outfitPrevButton
|
||||||
|
@ -54,7 +54,7 @@ Window
|
||||||
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
||||||
margin-right: 3
|
margin-right: 3
|
||||||
enabled: true
|
enabled: true
|
||||||
@onClick: previousOutfitType()
|
@onClick: modules.game_outfit.previousOutfitType()
|
||||||
|
|
||||||
Creature
|
Creature
|
||||||
id: mountCreatureBox
|
id: mountCreatureBox
|
||||||
|
@ -79,7 +79,7 @@ Window
|
||||||
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
enabled: true
|
enabled: true
|
||||||
@onClick: nextMountType()
|
@onClick: modules.game_outfit.nextMountType()
|
||||||
|
|
||||||
PrevMountButton
|
PrevMountButton
|
||||||
id: mountPrevButton
|
id: mountPrevButton
|
||||||
|
@ -87,7 +87,7 @@ Window
|
||||||
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
||||||
margin-right: 3
|
margin-right: 3
|
||||||
enabled: true
|
enabled: true
|
||||||
@onClick: previousMountType()
|
@onClick: modules.game_outfit.previousMountType()
|
||||||
|
|
||||||
// Addon Check Boxes
|
// Addon Check Boxes
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ Window
|
||||||
anchors.left: prev.left
|
anchors.left: prev.left
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
margin-right: 16
|
margin-right: 16
|
||||||
@onClick: randomize()
|
@onClick: modules.game_outfit.randomize()
|
||||||
|
|
||||||
HorizontalSeparator
|
HorizontalSeparator
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -195,7 +195,7 @@ Window
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
margin-bottom: 16
|
margin-bottom: 16
|
||||||
margin-right: 16
|
margin-right: 16
|
||||||
@onClick: accept()
|
@onClick: modules.game_outfit.accept()
|
||||||
|
|
||||||
Button
|
Button
|
||||||
id: outfitCancelButton
|
id: outfitCancelButton
|
||||||
|
@ -205,4 +205,4 @@ Window
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
margin-bottom: 16
|
margin-bottom: 16
|
||||||
margin-right: 16
|
margin-right: 16
|
||||||
@onClick: destroy()
|
@onClick: modules.game_outfit.destroy()
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
function init()
|
function init()
|
||||||
if g_game.getFeature(GamePlayerMount) then
|
|
||||||
g_keyboard.bindKeyDown('Ctrl+R', toggleMount, gameRootPanel)
|
g_keyboard.bindKeyDown('Ctrl+R', toggleMount, gameRootPanel)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function terminate()
|
function terminate()
|
||||||
if g_game.getFeature(GamePlayerMount) then
|
|
||||||
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel)
|
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function toggleMount()
|
function toggleMount()
|
||||||
|
if g_game.getFeature(GamePlayerMounts) then
|
||||||
g_game.mount(not g_game.isMounted())
|
g_game.mount(not g_game.isMounted())
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function dismount()
|
function dismount()
|
||||||
|
if g_game.getFeature(GamePlayerMounts) then
|
||||||
g_game.mount(false)
|
g_game.mount(false)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -77,7 +77,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate)
|
||||||
m_footStepDrawn = true;
|
m_footStepDrawn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::internalDrawOutfit(const Point& dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction)
|
void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction)
|
||||||
{
|
{
|
||||||
// outfit is a real creature
|
// outfit is a real creature
|
||||||
if(m_outfit.getCategory() == ThingCategoryCreature) {
|
if(m_outfit.getCategory() == ThingCategoryCreature) {
|
||||||
|
@ -97,6 +97,15 @@ void Creature::internalDrawOutfit(const Point& dest, float scaleFactor, bool ani
|
||||||
else
|
else
|
||||||
xPattern = direction;
|
xPattern = direction;
|
||||||
|
|
||||||
|
int zPattern = 0;
|
||||||
|
if(m_outfit.getMount() != 0) {
|
||||||
|
auto datType = g_things.rawGetThingType(m_outfit.getMount(), ThingCategoryCreature);
|
||||||
|
dest -= datType->getDisplacement() * scaleFactor;
|
||||||
|
datType->draw(dest, scaleFactor, 0, xPattern, 0, 0, animationPhase);
|
||||||
|
dest += getDisplacement() * scaleFactor;
|
||||||
|
zPattern = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// yPattern => creature addon
|
// yPattern => creature addon
|
||||||
for(int yPattern = 0; yPattern < getNumPatternY(); yPattern++) {
|
for(int yPattern = 0; yPattern < getNumPatternY(); yPattern++) {
|
||||||
|
|
||||||
|
@ -105,20 +114,20 @@ void Creature::internalDrawOutfit(const Point& dest, float scaleFactor, bool ani
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto datType = rawGetThingType();
|
auto datType = rawGetThingType();
|
||||||
datType->draw(dest, scaleFactor, 0, xPattern, yPattern, 0, animationPhase);
|
datType->draw(dest, scaleFactor, 0, xPattern, yPattern, zPattern, animationPhase);
|
||||||
|
|
||||||
if(getLayers() > 1) {
|
if(getLayers() > 1) {
|
||||||
Color oldColor = g_painter->getColor();
|
Color oldColor = g_painter->getColor();
|
||||||
Painter::CompositionMode oldComposition = g_painter->getCompositionMode();
|
Painter::CompositionMode oldComposition = g_painter->getCompositionMode();
|
||||||
g_painter->setCompositionMode(Painter::CompositionMode_Multiply);
|
g_painter->setCompositionMode(Painter::CompositionMode_Multiply);
|
||||||
g_painter->setColor(m_outfit.getHeadColor());
|
g_painter->setColor(m_outfit.getHeadColor());
|
||||||
datType->draw(dest, scaleFactor, SpriteMaskYellow, xPattern, yPattern, 0, animationPhase);
|
datType->draw(dest, scaleFactor, SpriteMaskYellow, xPattern, yPattern, zPattern, animationPhase);
|
||||||
g_painter->setColor(m_outfit.getBodyColor());
|
g_painter->setColor(m_outfit.getBodyColor());
|
||||||
datType->draw(dest, scaleFactor, SpriteMaskRed, xPattern, yPattern, 0, animationPhase);
|
datType->draw(dest, scaleFactor, SpriteMaskRed, xPattern, yPattern, zPattern, animationPhase);
|
||||||
g_painter->setColor(m_outfit.getLegsColor());
|
g_painter->setColor(m_outfit.getLegsColor());
|
||||||
datType->draw(dest, scaleFactor, SpriteMaskGreen, xPattern, yPattern, 0, animationPhase);
|
datType->draw(dest, scaleFactor, SpriteMaskGreen, xPattern, yPattern, zPattern, animationPhase);
|
||||||
g_painter->setColor(m_outfit.getFeetColor());
|
g_painter->setColor(m_outfit.getFeetColor());
|
||||||
datType->draw(dest, scaleFactor, SpriteMaskBlue, xPattern, yPattern, 0, animationPhase);
|
datType->draw(dest, scaleFactor, SpriteMaskBlue, xPattern, yPattern, zPattern, animationPhase);
|
||||||
g_painter->setColor(oldColor);
|
g_painter->setColor(oldColor);
|
||||||
g_painter->setCompositionMode(oldComposition);
|
g_painter->setCompositionMode(oldComposition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
virtual void draw(const Point& dest, float scaleFactor, bool animate);
|
virtual void draw(const Point& dest, float scaleFactor, bool animate);
|
||||||
|
|
||||||
void internalDrawOutfit(const Point& dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction);
|
void internalDrawOutfit(Point dest, float scaleFactor, bool animateWalk, bool animateIdle, Otc::Direction direction);
|
||||||
void drawOutfit(const Rect& destRect, bool resize);
|
void drawOutfit(const Rect& destRect, bool resize);
|
||||||
void drawInformation(const Point& point, bool useGray, const Rect& parentRect);
|
void drawInformation(const Point& point, bool useGray, const Rect& parentRect);
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,10 @@ void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector
|
||||||
// create virtual creature outfit
|
// create virtual creature outfit
|
||||||
CreaturePtr virtualOutfitCreature = CreaturePtr(new Creature);
|
CreaturePtr virtualOutfitCreature = CreaturePtr(new Creature);
|
||||||
virtualOutfitCreature->setDirection(Otc::South);
|
virtualOutfitCreature->setDirection(Otc::South);
|
||||||
virtualOutfitCreature->setOutfit(currentOufit);
|
|
||||||
|
Outfit outfit = currentOufit;
|
||||||
|
outfit.setMount(0);
|
||||||
|
virtualOutfitCreature->setOutfit(outfit);
|
||||||
|
|
||||||
// creature virtual mount outfit
|
// creature virtual mount outfit
|
||||||
CreaturePtr virtualMountCreature = nullptr;
|
CreaturePtr virtualMountCreature = nullptr;
|
||||||
|
@ -336,8 +339,7 @@ void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector
|
||||||
{
|
{
|
||||||
virtualMountCreature = CreaturePtr(new Creature);
|
virtualMountCreature = CreaturePtr(new Creature);
|
||||||
virtualMountCreature->setDirection(Otc::South);
|
virtualMountCreature->setDirection(Otc::South);
|
||||||
if(currentOufit.getMount() > 0)
|
if(currentOufit.getMount() > 0) {
|
||||||
{
|
|
||||||
Outfit mountOutfit;
|
Outfit mountOutfit;
|
||||||
mountOutfit.setId(currentOufit.getMount());
|
mountOutfit.setId(currentOufit.getMount());
|
||||||
virtualMountCreature->setOutfit(mountOutfit);
|
virtualMountCreature->setOutfit(mountOutfit);
|
||||||
|
|
|
@ -126,4 +126,5 @@ void Outfit::resetClothes()
|
||||||
setBody(0);
|
setBody(0);
|
||||||
setLegs(0);
|
setLegs(0);
|
||||||
setFeet(0);
|
setFeet(0);
|
||||||
|
setMount(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -832,7 +832,7 @@ void ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg)
|
||||||
int vocation = msg->getU8(); // vocation
|
int vocation = msg->getU8(); // vocation
|
||||||
int spellCount = msg->getU16();
|
int spellCount = msg->getU16();
|
||||||
for(int i=0;i<spellCount;++i) {
|
for(int i=0;i<spellCount;++i) {
|
||||||
int spellId = msg->getU16(); // spell id - TODO: add to local player
|
int spellId = msg->getU8(); // spell id - TODO: add to local player
|
||||||
}
|
}
|
||||||
|
|
||||||
m_localPlayer->setPremium(premium);
|
m_localPlayer->setPremium(premium);
|
||||||
|
@ -1034,7 +1034,6 @@ void ProtocolGame::parseCloseChannel(const InputMessagePtr& msg)
|
||||||
g_game.processCloseChannel(channelId);
|
g_game.processCloseChannel(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProtocolGame::parseRuleViolationChannel(const InputMessagePtr& msg)
|
void ProtocolGame::parseRuleViolationChannel(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
int channelId = msg->getU16();
|
int channelId = msg->getU16();
|
||||||
|
@ -1096,8 +1095,6 @@ void ProtocolGame::parseTextMessage(const InputMessagePtr& msg)
|
||||||
Position pos = getPosition(msg);
|
Position pos = getPosition(msg);
|
||||||
uint value = msg->getU32();
|
uint value = msg->getU32();
|
||||||
int color = msg->getU8();
|
int color = msg->getU8();
|
||||||
msg->getU32(); // ??
|
|
||||||
msg->getU8(); // ??
|
|
||||||
text = msg->getString();
|
text = msg->getString();
|
||||||
|
|
||||||
AnimatedTextPtr animatedText = AnimatedTextPtr(new AnimatedText);
|
AnimatedTextPtr animatedText = AnimatedTextPtr(new AnimatedText);
|
||||||
|
|
Loading…
Reference in New Issue