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.verticalCenter: parent.verticalCenter
|
||||
|
||||
@onEnter: accept()
|
||||
@onEscape: destroy()
|
||||
@onEnter: modules.game_outfit.accept()
|
||||
@onEscape: modules.game_outfit.destroy()
|
||||
|
||||
// Creature Boxes
|
||||
|
||||
|
@ -46,7 +46,7 @@ Window
|
|||
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
||||
margin-left: 3
|
||||
enabled: true
|
||||
@onClick: nextOutfitType()
|
||||
@onClick: modules.game_outfit.nextOutfitType()
|
||||
|
||||
PrevOutfitButton
|
||||
id: outfitPrevButton
|
||||
|
@ -54,7 +54,7 @@ Window
|
|||
anchors.verticalCenter: outfitCreatureBox.verticalCenter
|
||||
margin-right: 3
|
||||
enabled: true
|
||||
@onClick: previousOutfitType()
|
||||
@onClick: modules.game_outfit.previousOutfitType()
|
||||
|
||||
Creature
|
||||
id: mountCreatureBox
|
||||
|
@ -79,7 +79,7 @@ Window
|
|||
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
||||
margin-left: 3
|
||||
enabled: true
|
||||
@onClick: nextMountType()
|
||||
@onClick: modules.game_outfit.nextMountType()
|
||||
|
||||
PrevMountButton
|
||||
id: mountPrevButton
|
||||
|
@ -87,7 +87,7 @@ Window
|
|||
anchors.verticalCenter: mountCreatureBox.verticalCenter
|
||||
margin-right: 3
|
||||
enabled: true
|
||||
@onClick: previousMountType()
|
||||
@onClick: modules.game_outfit.previousMountType()
|
||||
|
||||
// Addon Check Boxes
|
||||
|
||||
|
@ -176,7 +176,7 @@ Window
|
|||
anchors.left: prev.left
|
||||
anchors.top: prev.bottom
|
||||
margin-right: 16
|
||||
@onClick: randomize()
|
||||
@onClick: modules.game_outfit.randomize()
|
||||
|
||||
HorizontalSeparator
|
||||
anchors.left: parent.left
|
||||
|
@ -195,7 +195,7 @@ Window
|
|||
anchors.bottom: parent.bottom
|
||||
margin-bottom: 16
|
||||
margin-right: 16
|
||||
@onClick: accept()
|
||||
@onClick: modules.game_outfit.accept()
|
||||
|
||||
Button
|
||||
id: outfitCancelButton
|
||||
|
@ -205,4 +205,4 @@ Window
|
|||
anchors.bottom: parent.bottom
|
||||
margin-bottom: 16
|
||||
margin-right: 16
|
||||
@onClick: destroy()
|
||||
@onClick: modules.game_outfit.destroy()
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
function init()
|
||||
if g_game.getFeature(GamePlayerMount) then
|
||||
g_keyboard.bindKeyDown('Ctrl+R', toggleMount, gameRootPanel)
|
||||
end
|
||||
g_keyboard.bindKeyDown('Ctrl+R', toggleMount, gameRootPanel)
|
||||
end
|
||||
|
||||
function terminate()
|
||||
if g_game.getFeature(GamePlayerMount) then
|
||||
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel)
|
||||
end
|
||||
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel)
|
||||
end
|
||||
|
||||
function toggleMount()
|
||||
g_game.mount(not g_game.isMounted())
|
||||
if g_game.getFeature(GamePlayerMounts) then
|
||||
g_game.mount(not g_game.isMounted())
|
||||
end
|
||||
end
|
||||
|
||||
function dismount()
|
||||
g_game.mount(false)
|
||||
if g_game.getFeature(GamePlayerMounts) then
|
||||
g_game.mount(false)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,7 +77,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate)
|
|||
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
|
||||
if(m_outfit.getCategory() == ThingCategoryCreature) {
|
||||
|
@ -97,6 +97,15 @@ void Creature::internalDrawOutfit(const Point& dest, float scaleFactor, bool ani
|
|||
else
|
||||
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
|
||||
for(int yPattern = 0; yPattern < getNumPatternY(); yPattern++) {
|
||||
|
||||
|
@ -105,20 +114,20 @@ void Creature::internalDrawOutfit(const Point& dest, float scaleFactor, bool ani
|
|||
continue;
|
||||
|
||||
auto datType = rawGetThingType();
|
||||
datType->draw(dest, scaleFactor, 0, xPattern, yPattern, 0, animationPhase);
|
||||
datType->draw(dest, scaleFactor, 0, xPattern, yPattern, zPattern, animationPhase);
|
||||
|
||||
if(getLayers() > 1) {
|
||||
Color oldColor = g_painter->getColor();
|
||||
Painter::CompositionMode oldComposition = g_painter->getCompositionMode();
|
||||
g_painter->setCompositionMode(Painter::CompositionMode_Multiply);
|
||||
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());
|
||||
datType->draw(dest, scaleFactor, SpriteMaskRed, xPattern, yPattern, 0, animationPhase);
|
||||
datType->draw(dest, scaleFactor, SpriteMaskRed, xPattern, yPattern, zPattern, animationPhase);
|
||||
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());
|
||||
datType->draw(dest, scaleFactor, SpriteMaskBlue, xPattern, yPattern, 0, animationPhase);
|
||||
datType->draw(dest, scaleFactor, SpriteMaskBlue, xPattern, yPattern, zPattern, animationPhase);
|
||||
g_painter->setColor(oldColor);
|
||||
g_painter->setCompositionMode(oldComposition);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
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 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
|
||||
CreaturePtr virtualOutfitCreature = CreaturePtr(new Creature);
|
||||
virtualOutfitCreature->setDirection(Otc::South);
|
||||
virtualOutfitCreature->setOutfit(currentOufit);
|
||||
|
||||
Outfit outfit = currentOufit;
|
||||
outfit.setMount(0);
|
||||
virtualOutfitCreature->setOutfit(outfit);
|
||||
|
||||
// creature virtual mount outfit
|
||||
CreaturePtr virtualMountCreature = nullptr;
|
||||
|
@ -336,8 +339,7 @@ void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector
|
|||
{
|
||||
virtualMountCreature = CreaturePtr(new Creature);
|
||||
virtualMountCreature->setDirection(Otc::South);
|
||||
if(currentOufit.getMount() > 0)
|
||||
{
|
||||
if(currentOufit.getMount() > 0) {
|
||||
Outfit mountOutfit;
|
||||
mountOutfit.setId(currentOufit.getMount());
|
||||
virtualMountCreature->setOutfit(mountOutfit);
|
||||
|
|
|
@ -126,4 +126,5 @@ void Outfit::resetClothes()
|
|||
setBody(0);
|
||||
setLegs(0);
|
||||
setFeet(0);
|
||||
setMount(0);
|
||||
}
|
||||
|
|
|
@ -832,7 +832,7 @@ void ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg)
|
|||
int vocation = msg->getU8(); // vocation
|
||||
int spellCount = msg->getU16();
|
||||
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);
|
||||
|
@ -1034,7 +1034,6 @@ void ProtocolGame::parseCloseChannel(const InputMessagePtr& msg)
|
|||
g_game.processCloseChannel(channelId);
|
||||
}
|
||||
|
||||
|
||||
void ProtocolGame::parseRuleViolationChannel(const InputMessagePtr& msg)
|
||||
{
|
||||
int channelId = msg->getU16();
|
||||
|
@ -1096,8 +1095,6 @@ void ProtocolGame::parseTextMessage(const InputMessagePtr& msg)
|
|||
Position pos = getPosition(msg);
|
||||
uint value = msg->getU32();
|
||||
int color = msg->getU8();
|
||||
msg->getU32(); // ??
|
||||
msg->getU8(); // ??
|
||||
text = msg->getString();
|
||||
|
||||
AnimatedTextPtr animatedText = AnimatedTextPtr(new AnimatedText);
|
||||
|
|
Loading…
Reference in New Issue