mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	hopefully fixes #1397. Still too much magic in this code :(
This commit is contained in:
		| @@ -866,8 +866,13 @@ void CPlayerInterface::battleStacksAttacked(const std::vector<BattleStackAttacke | ||||
| 			if (defender && !elem.isSecondary()) | ||||
| 				battleInt->displayEffect(elem.effect, defender->position); | ||||
| 		} | ||||
| 		bool shooting = (LOCPLINT->curAction ? LOCPLINT->curAction->actionType != Battle::WALK_AND_ATTACK : false); //FIXME: why action is deleted during enchanter cast? | ||||
| 		StackAttackedInfo to_put = {defender, elem.damageAmount, elem.killedAmount, attacker, shooting, elem.killed(), elem.willRebirth(), elem.cloneKilled()}; | ||||
| 		//FIXME: why action is deleted during enchanter cast? | ||||
| 		bool remoteAttack = false; | ||||
|  | ||||
| 		if (LOCPLINT->curAction) | ||||
| 			remoteAttack |= LOCPLINT->curAction->actionType != Battle::WALK_AND_ATTACK; | ||||
|  | ||||
| 		StackAttackedInfo to_put = {defender, elem.damageAmount, elem.killedAmount, attacker, remoteAttack, elem.killed(), elem.willRebirth(), elem.cloneKilled()}; | ||||
| 		arg.push_back(to_put); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -61,8 +61,6 @@ bool CBattleAnimation::isEarliest(bool perStackConcurrency) | ||||
|  | ||||
| 	for(auto & elem : owner->pendingAnims) | ||||
| 	{ | ||||
| 		if (elem.first == this) | ||||
| 			continue; | ||||
|  | ||||
| 		CBattleStackAnimation * stAnim = dynamic_cast<CBattleStackAnimation *>(elem.first); | ||||
| 		CSpellEffectAnimation * sen = dynamic_cast<CSpellEffectAnimation *>(elem.first); | ||||
| @@ -146,7 +144,7 @@ CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attac | ||||
|  | ||||
| CDefenceAnimation::CDefenceAnimation(StackAttackedInfo _attackedInfo, CBattleInterface * _owner) | ||||
| : CBattleStackAnimation(_owner, _attackedInfo.defender), | ||||
| attacker(_attackedInfo.attacker), rangedAttack(_attackedInfo.rangedAttack), | ||||
| attacker(_attackedInfo.attacker), rangedAttack(_attackedInfo.indirectAttack), | ||||
| killed(_attackedInfo.killed)  | ||||
| {} | ||||
|  | ||||
| @@ -158,8 +156,6 @@ bool CDefenceAnimation::init() | ||||
| 	ui32 lowestMoveID = owner->animIDhelper + 5; | ||||
| 	for(auto & elem : owner->pendingAnims) | ||||
| 	{ | ||||
| 		if (elem.first == this) | ||||
| 			continue; | ||||
|  | ||||
| 		CDefenceAnimation * defAnim = dynamic_cast<CDefenceAnimation *>(elem.first); | ||||
| 		if(defAnim && defAnim->stack->ID != stack->ID) | ||||
| @@ -169,6 +165,10 @@ bool CDefenceAnimation::init() | ||||
| 		if(attAnim && attAnim->stack->ID != stack->ID) | ||||
| 			continue; | ||||
|  | ||||
| 		CSpellEffectAnimation * sen = dynamic_cast<CSpellEffectAnimation *>(elem.first); | ||||
| 		if (sen) | ||||
| 			continue; | ||||
|  | ||||
| 		CReverseAnimation * animAsRev = dynamic_cast<CReverseAnimation *>(elem.first); | ||||
|  | ||||
| 		if(animAsRev) | ||||
|   | ||||
| @@ -57,7 +57,7 @@ struct StackAttackedInfo | ||||
| 	unsigned int dmg; //damage dealt | ||||
| 	unsigned int amountKilled; //how many creatures in stack has been killed | ||||
| 	const CStack * attacker; //attacking stack | ||||
| 	bool rangedAttack; //if true, stack has been attacked by shooting | ||||
| 	bool indirectAttack; //if true, stack was attacked indirectly - spell or ranged attack | ||||
| 	bool killed; //if true, stack has been killed | ||||
| 	bool rebirth; //if true, play rebirth animation after all | ||||
| 	bool cloneKilled; | ||||
|   | ||||
| @@ -525,7 +525,8 @@ void CFramerateManager::framerateDelay() | ||||
|  | ||||
| 	fps = ceil(1000.0 / timeElapsed); | ||||
|  | ||||
| 	//recalculate timeElapsed for external calls via getElapsed() | ||||
| 	timeElapsed = currentTicks - lastticks; | ||||
| 	// recalculate timeElapsed for external calls via getElapsed() | ||||
| 	// limit it to 1000 ms to avoid breaking animation in case of huge lag (e.g. triggered breakpoint) | ||||
| 	timeElapsed = std::min<ui32>(currentTicks - lastticks, 1000); | ||||
| 	lastticks = SDL_GetTicks(); | ||||
| } | ||||
|   | ||||
| @@ -1494,7 +1494,7 @@ struct BattleStackAttacked : public CPackForClient//3005 | ||||
| 	{ | ||||
| 		return flags & SECONDARY; | ||||
| 	} | ||||
| 	bool willRebirth() const//if stack was not a primary target (receives no spell effects) | ||||
| 	bool willRebirth() const//resurrection, e.g. Phoenix | ||||
| 	{ | ||||
| 		return flags & REBIRTH; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user