mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-29 18:13:55 -07:00
skip tap animation when rewinding (#5168)
This commit is contained in:
parent
7b1653034b
commit
27055944df
3 changed files with 21 additions and 10 deletions
|
|
@ -162,6 +162,10 @@ void ReplayTimelineWidget::processNewEvents(PlaybackMode playbackMode)
|
||||||
if (playbackMode == BACKWARD_SKIP || currentTime - replayTimeline[currentEvent] > BIG_SKIP_MS)
|
if (playbackMode == BACKWARD_SKIP || currentTime - replayTimeline[currentEvent] > BIG_SKIP_MS)
|
||||||
options |= Player::EventProcessingOption::SKIP_REVEAL_WINDOW;
|
options |= Player::EventProcessingOption::SKIP_REVEAL_WINDOW;
|
||||||
|
|
||||||
|
// backwards skip => always skip tap animation
|
||||||
|
if (playbackMode == BACKWARD_SKIP)
|
||||||
|
options |= Player::EventProcessingOption::SKIP_TAP_ANIMATION;
|
||||||
|
|
||||||
emit processNextEvent(options);
|
emit processNextEvent(options);
|
||||||
++currentEvent;
|
++currentEvent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1893,7 +1893,8 @@ void Player::setCardAttrHelper(const GameEventContext &context,
|
||||||
CardItem *card,
|
CardItem *card,
|
||||||
CardAttribute attribute,
|
CardAttribute attribute,
|
||||||
const QString &avalue,
|
const QString &avalue,
|
||||||
bool allCards)
|
bool allCards,
|
||||||
|
EventProcessingOptions options)
|
||||||
{
|
{
|
||||||
if (card == nullptr) {
|
if (card == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1907,7 +1908,8 @@ void Player::setCardAttrHelper(const GameEventContext &context,
|
||||||
if (!allCards) {
|
if (!allCards) {
|
||||||
emit logSetTapped(this, card, tapped);
|
emit logSetTapped(this, card, tapped);
|
||||||
}
|
}
|
||||||
card->setTapped(tapped, !moveCardContext);
|
bool canAnimate = !options.testFlag(SKIP_TAP_ANIMATION) && !moveCardContext;
|
||||||
|
card->setTapped(tapped, canAnimate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2049,7 +2051,9 @@ void Player::eventCreateToken(const Event_CreateToken &event)
|
||||||
zone->addCard(card, true, event.x(), event.y());
|
zone->addCard(card, true, event.x(), event.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::eventSetCardAttr(const Event_SetCardAttr &event, const GameEventContext &context)
|
void Player::eventSetCardAttr(const Event_SetCardAttr &event,
|
||||||
|
const GameEventContext &context,
|
||||||
|
EventProcessingOptions options)
|
||||||
{
|
{
|
||||||
CardZone *zone = zones.value(QString::fromStdString(event.zone_name()), 0);
|
CardZone *zone = zones.value(QString::fromStdString(event.zone_name()), 0);
|
||||||
if (!zone) {
|
if (!zone) {
|
||||||
|
|
@ -2059,8 +2063,8 @@ void Player::eventSetCardAttr(const Event_SetCardAttr &event, const GameEventCon
|
||||||
if (!event.has_card_id()) {
|
if (!event.has_card_id()) {
|
||||||
const CardList &cards = zone->getCards();
|
const CardList &cards = zone->getCards();
|
||||||
for (int i = 0; i < cards.size(); ++i) {
|
for (int i = 0; i < cards.size(); ++i) {
|
||||||
setCardAttrHelper(context, cards.at(i), event.attribute(), QString::fromStdString(event.attr_value()),
|
setCardAttrHelper(context, cards.at(i), event.attribute(), QString::fromStdString(event.attr_value()), true,
|
||||||
true);
|
options);
|
||||||
}
|
}
|
||||||
if (event.attribute() == AttrTapped) {
|
if (event.attribute() == AttrTapped) {
|
||||||
emit logSetTapped(this, nullptr, event.attr_value() == "1");
|
emit logSetTapped(this, nullptr, event.attr_value() == "1");
|
||||||
|
|
@ -2071,7 +2075,7 @@ void Player::eventSetCardAttr(const Event_SetCardAttr &event, const GameEventCon
|
||||||
qWarning() << "Player::eventSetCardAttr: card id=" << event.card_id() << "not found";
|
qWarning() << "Player::eventSetCardAttr: card id=" << event.card_id() << "not found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCardAttrHelper(context, card, event.attribute(), QString::fromStdString(event.attr_value()), false);
|
setCardAttrHelper(context, card, event.attribute(), QString::fromStdString(event.attr_value()), false, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2444,7 +2448,7 @@ void Player::processGameEvent(GameEvent::GameEventType type,
|
||||||
eventCreateToken(event.GetExtension(Event_CreateToken::ext));
|
eventCreateToken(event.GetExtension(Event_CreateToken::ext));
|
||||||
break;
|
break;
|
||||||
case GameEvent::SET_CARD_ATTR:
|
case GameEvent::SET_CARD_ATTR:
|
||||||
eventSetCardAttr(event.GetExtension(Event_SetCardAttr::ext), context);
|
eventSetCardAttr(event.GetExtension(Event_SetCardAttr::ext), context, options);
|
||||||
break;
|
break;
|
||||||
case GameEvent::SET_CARD_COUNTER:
|
case GameEvent::SET_CARD_COUNTER:
|
||||||
eventSetCardCounter(event.GetExtension(Event_SetCardCounter::ext));
|
eventSetCardCounter(event.GetExtension(Event_SetCardCounter::ext));
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,8 @@ private slots:
|
||||||
public:
|
public:
|
||||||
enum EventProcessingOption
|
enum EventProcessingOption
|
||||||
{
|
{
|
||||||
SKIP_REVEAL_WINDOW = 0x0001
|
SKIP_REVEAL_WINDOW = 0x0001,
|
||||||
|
SKIP_TAP_ANIMATION = 0x0002
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(EventProcessingOptions, EventProcessingOption)
|
Q_DECLARE_FLAGS(EventProcessingOptions, EventProcessingOption)
|
||||||
|
|
||||||
|
|
@ -301,7 +302,8 @@ private:
|
||||||
CardItem *card,
|
CardItem *card,
|
||||||
CardAttribute attribute,
|
CardAttribute attribute,
|
||||||
const QString &avalue,
|
const QString &avalue,
|
||||||
bool allCards);
|
bool allCards,
|
||||||
|
EventProcessingOptions options);
|
||||||
void addRelatedCardActions(const CardItem *card, QMenu *cardMenu);
|
void addRelatedCardActions(const CardItem *card, QMenu *cardMenu);
|
||||||
void addRelatedCardView(const CardItem *card, QMenu *cardMenu);
|
void addRelatedCardView(const CardItem *card, QMenu *cardMenu);
|
||||||
void createCard(const CardItem *sourceCard,
|
void createCard(const CardItem *sourceCard,
|
||||||
|
|
@ -328,7 +330,8 @@ private:
|
||||||
void eventCreateArrow(const Event_CreateArrow &event);
|
void eventCreateArrow(const Event_CreateArrow &event);
|
||||||
void eventDeleteArrow(const Event_DeleteArrow &event);
|
void eventDeleteArrow(const Event_DeleteArrow &event);
|
||||||
void eventCreateToken(const Event_CreateToken &event);
|
void eventCreateToken(const Event_CreateToken &event);
|
||||||
void eventSetCardAttr(const Event_SetCardAttr &event, const GameEventContext &context);
|
void
|
||||||
|
eventSetCardAttr(const Event_SetCardAttr &event, const GameEventContext &context, EventProcessingOptions options);
|
||||||
void eventSetCardCounter(const Event_SetCardCounter &event);
|
void eventSetCardCounter(const Event_SetCardCounter &event);
|
||||||
void eventCreateCounter(const Event_CreateCounter &event);
|
void eventCreateCounter(const Event_CreateCounter &event);
|
||||||
void eventSetCounter(const Event_SetCounter &event);
|
void eventSetCounter(const Event_SetCounter &event);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue