walk changes, nothing special
This commit is contained in:
		
							parent
							
								
									4208e40c76
								
							
						
					
					
						commit
						7db6b8b5e6
					
				|  | @ -96,14 +96,7 @@ void UIWindow::onGeometryUpdate(const Rect& oldRect, const Rect& newRect) | |||
|     UIWidgetPtr parent = getParent(); | ||||
|     if(parent) { | ||||
|         Rect parentRect = parent->getRect(); | ||||
|         if(boundRect.left() < parentRect.left()) | ||||
|             boundRect.moveLeft(parentRect.left()); | ||||
|         if(boundRect.top() < parentRect.top()) | ||||
|             boundRect.moveTop(parentRect.top()); | ||||
|         if(boundRect.bottom() > parentRect.bottom()) | ||||
|             boundRect.moveBottom(parentRect.bottom()); | ||||
|         if(boundRect.right() > parentRect.right()) | ||||
|             boundRect.moveRight(parentRect.right()); | ||||
|         boundRect.bound(parentRect); | ||||
|     } | ||||
| 
 | ||||
|     if(boundRect != newRect) | ||||
|  |  | |||
|  | @ -251,6 +251,20 @@ public: | |||
|         return tmp; | ||||
|     } | ||||
| 
 | ||||
|     void bound(const TRect<T> &r) { | ||||
|         if(isNull() || r.isNull()) | ||||
|             return; | ||||
| 
 | ||||
|         if(left() < r.left()) | ||||
|             moveLeft(r.left()); | ||||
|         if(top() < r.top()) | ||||
|             moveTop(r.top()); | ||||
|         if(bottom() > r.bottom()) | ||||
|             moveBottom(r.bottom()); | ||||
|         if(right() > r.right()) | ||||
|             moveRight(r.right()); | ||||
|     } | ||||
| 
 | ||||
|     TRect<T>& operator=(const TRect<T>& other) { x1 = other.x1; y1 = other.y1; x2 = other.x2; y2 = other.y2; return *this;  } | ||||
|     bool operator==(const TRect<T>& other) const { return (x1 == other.x1 && y1 == other.y1 && x2 == other.x2 && y2 == other.y2); } | ||||
|     bool operator!=(const TRect<T>& other) const { return (x1 != other.x1 || y1 != other.y1 || x2 != other.x2 || y2 != other.y2); } | ||||
|  |  | |||
|  | @ -100,25 +100,11 @@ void Creature::drawInformation(int x, int y, bool useGray, const Rect& rect) | |||
| 
 | ||||
|     // calculate main rects
 | ||||
|     Rect backgroundRect = Rect(x-(13.5), y, 27, 4); | ||||
|     if(backgroundRect.left() < rect.left()) | ||||
|         backgroundRect.moveLeft(rect.left()); | ||||
|     if(backgroundRect.top() < rect.top()) | ||||
|         backgroundRect.moveTop(rect.top()); | ||||
|     if(backgroundRect.bottom() > rect.bottom()) | ||||
|         backgroundRect.moveBottom(rect.bottom()); | ||||
|     if(backgroundRect.right() > rect.right()) | ||||
|         backgroundRect.moveRight(rect.right()); | ||||
|     backgroundRect.bound(rect); | ||||
| 
 | ||||
|     Size textSize = m_informationFont->calculateTextRectSize(m_name); | ||||
|     Rect textRect = Rect(x - textSize.width() / 2.0, y-15, textSize); | ||||
|     if(textRect.left() < rect.left()) | ||||
|         textRect.moveLeft(rect.left()); | ||||
|     if(textRect.top() < rect.top()) | ||||
|         textRect.moveTop(rect.top()); | ||||
|     if(textRect.bottom() > rect.bottom()) | ||||
|         textRect.moveBottom(rect.bottom()); | ||||
|     if(textRect.right() > rect.right()) | ||||
|         textRect.moveRight(rect.right()); | ||||
|     textRect.bound(rect); | ||||
| 
 | ||||
|     // distance them
 | ||||
|     if(textRect.top() == rect.top()) | ||||
|  | @ -264,7 +250,7 @@ void Creature::updateWalk() | |||
|                 m_walkOffsetX = -totalPixelsWalked; | ||||
|         } | ||||
| 
 | ||||
|         int totalWalkTileTicks = (int)m_walkTimePerPixel*32; | ||||
|         int totalWalkTileTicks = (int)m_walkTimePerPixel*32 * 0.5; | ||||
|         m_animation = (g_platform.getTicks() % totalWalkTileTicks) / (totalWalkTileTicks / (type.animationPhases - 1)) + 1; | ||||
|         g_dispatcher.scheduleEvent(std::bind(&Creature::updateWalk, asCreature()), m_walkTimePerPixel); | ||||
| 
 | ||||
|  | @ -285,7 +271,7 @@ void Creature::cancelWalk(Otc::Direction direction) | |||
|     g_dispatcher.scheduleEvent([=]() { | ||||
|         if(!self->m_walking) | ||||
|             self->m_animation = 0; | ||||
|     }, 150); | ||||
|     }, m_walkTimePerPixel * 2); | ||||
| } | ||||
| 
 | ||||
| void Creature::setHealthPercent(uint8 healthPercent) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Henrique
						Henrique