Bläddra i källkod

* Fixed battle positions bugs: #174, #172, #400
* Turret creatures have no longer a standing animation
* Turret creatures get cut at a certain y position(lower part of shooters are hidden)

beegee1 14 år sedan
förälder
incheckning
cef16ccc74
4 ändrade filer med 196 tillägg och 176 borttagningar
  1. 26 15
      client/CBattleInterface.cpp
  2. 1 1
      client/CCreatureAnimation.cpp
  3. 1 1
      client/Graphics.cpp
  4. 168 159
      config/wall_pos.txt

+ 26 - 15
client/CBattleInterface.cpp

@@ -3369,7 +3369,9 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
 	int ID = stack->ID;
 	if(creAnims.find(ID) == creAnims.end()) //eg. for summoned but not yet handled stacks
 		return;
-
+	const CCreature *creature = stack->getCreature();
+	SDL_Rect unitRect = {creAnims[ID]->pos.x, creAnims[ID]->pos.y, creAnims[ID]->fullWidth, creAnims[ID]->fullHeight};
+	
 	int animType = creAnims[ID]->getType();
 
 	int affectingSpeed = curInt->sysOpts.animSpeed;
@@ -3377,25 +3379,34 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
 		affectingSpeed = 2;
 	bool incrementFrame = (animCount%(4/affectingSpeed)==0) && animType!=5 && animType!=20 && animType!=2;
 
-	if(animType == 2)
+	if (creature->idNumber == 149)
+	{
+		// a turret creature has a limited height, so cut it at a certain position; turret creature has no standing anim
+		unitRect.h = graphics->wallPositions[siegeH->town->town->typeID][20].y;
+	}
+	else
 	{
-		if(standingFrame.find(ID)!=standingFrame.end())
+		// standing animation
+		if(animType == 2)
 		{
-			incrementFrame = (animCount%(8/affectingSpeed)==0);
-			if(incrementFrame)
+			if(standingFrame.find(ID)!=standingFrame.end())
 			{
-				++standingFrame[ID];
-				if(standingFrame[ID] == creAnims[ID]->framesInGroup(CCreatureAnim::HOLDING))
+				incrementFrame = (animCount%(8/affectingSpeed)==0);
+				if(incrementFrame)
 				{
-					standingFrame.erase(standingFrame.find(ID));
+					++standingFrame[ID];
+					if(standingFrame[ID] == creAnims[ID]->framesInGroup(CCreatureAnim::HOLDING))
+					{
+						standingFrame.erase(standingFrame.find(ID));
+					}
 				}
 			}
-		}
-		else
-		{
-			if((rand()%50) == 0)
+			else
 			{
-				standingFrame.insert(std::make_pair(ID, 0));
+				if((rand()%50) == 0)
+				{
+					standingFrame.insert(std::make_pair(ID, 0));
+				}
 			}
 		}
 	}
@@ -3411,9 +3422,9 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
 				incrementFrame = false;
 		}
 	}
-
+	
 	// Increment always when moving, never if stack died
-	creAnims[ID]->nextFrame(to, creAnims[ID]->pos.x, creAnims[ID]->pos.y, creDir[ID], animCount, incrementFrame, activeStack && ID==activeStack->ID, ID==mouseHoveredStack);
+	creAnims[ID]->nextFrame(to, unitRect.x, unitRect.y, creDir[ID], animCount, incrementFrame, activeStack && ID==activeStack->ID, ID==mouseHoveredStack, &unitRect);
 
 	//printing amount
 	if(stack->count > 0 //don't print if stack is not alive

+ 1 - 1
client/CCreatureAnimation.cpp

@@ -225,7 +225,7 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack
 				{
 					if(xB >= 0 && xB < dest->w && yB >= 0 && yB < dest->h)
 					{
-						if(!destRect || (destRect->x <= xB && destRect->x + destRect->w > xB))
+						if(!destRect || (destRect->x <= xB && destRect->x + destRect->w > xB && destRect->y <= yB && destRect->y + destRect->h > yB))
 						{
 							const ui8 colorNr = SegmentType == 0xff ? FDef[BaseOffset+k] : SegmentType;
 							putPixel<bpp>(dest, xB, yB, palette[colorNr], colorNr, yellowBorder, blueBorder, aCountMod);

+ 1 - 1
client/Graphics.cpp

@@ -403,7 +403,7 @@ void Graphics::loadWallPositions()
 		for(int g=0; g<ARRAY_COUNT(wallPositions); ++g)
 		{
 			inp >> dump;
-			for(int b = 0; b < 20; ++b)
+			for(int b = 0; b < 21; ++b)
 			{
 				Point pt;
 				inp >> pt.x;

+ 168 - 159
config/wall_pos.txt

@@ -1,192 +1,201 @@
 //this file is a description of positions of wall parts' positions, following lines contain positions of: 1. background wall, 2. keep, 3. bottom tower, 4. bottom wall, 5. wall below gate, 
 //6. wall over gate, 7. upper wall, 8. upper tower, 9. gate, 10. gate arch, 11. bottom static wall, 12. upper static wall, 13. moat, 14. mlip, 
-//15. keep turret cover, 16. lower turret cover, 17. upper turret cover, 18. keep creature, 19. lower turret creature, 20. upper turret creature (x, y)
+//15. keep turret cover, 16. lower turret cover, 17. upper turret cover, 18. keep creature, 19. lower turret creature, 20. upper turret creature (x, y), 21. 2nd value: turret height(from top of def image), 1st value: not used
 //Castle 
-600 55
-720 154
-601 500 
+600 49
+720 158
+602 500 
 528 350 
-468 291 
-469 127 
-523 32 
-568 35 
+469 291 
+470 127 
+524 32 
+569 35 
 399 274 
-476 238 
-511 347 
-488 79 
+477 238 
+512 347 
+489 79 
 410 90 
-410 80 
-720 154
-601 500 
-568 35 
-527 -66
-368 304
-339 -192
+403 80 
+720 158
+602 500 
+557 24 
+526 -29
+394 299
+342 -187
+0 231
 //Rampart 
-608 55
-724 154
-593 511 
-548 451 
-468 309 
-468 186 
-529 57 
+608 46
+724 189
+594 511 
+549 451 
+469 309 
+469 186 
+530 57 
 565 31 
 403 271 
-459 220 
-509 364 
-491 103 
+460 220 
+510 364 
+492 103 
 410 77 
 410 97 
-724 154
-593 511 
-565 31 
-527 -66
-368 304
-339 -192
+724 189
+594 511 
+566 31 
+532 -27
+371 296
+341 -186
+0 232
 //Tower 
-615 55
-726 154
-591 516 
+615 57
+726 148
+592 516
 547 452 
-474 298 
-487 190 
-546 66 
-579 36 
+475 298 
+488 190 
+547 66 
+580 36 
 400 253 
-470 187 
-516 365 
-513 79 
+471 187 
+517 365 
+514 79 
 410 90 
 410 80 
-726 154
-591 516 
-579 36 
-527 -66
-368 304
-339 -192
+726 148
+592 516 
+580 36 
+499 -16
+355 311
+346 -175
+0 231
 //Inferno 
-606 55
-730 154
-594 514 
-560 451 
-484 316 
-479 151 
-531 71 
-568 27 
+606 52
+730 179
+595 514 
+561 451 
+485 316 
+480 151 
+532 71 
+569 27 
 408 254 
-476 221 
-521 376 
-501 92 
-410 68 
-410 68 
-730 154
-594 514 
-568 27 
-527 -66
-368 304
-339 -192
+477 221 
+522 376 
+502 92 
+403 68 
+403 68 
+730 179
+595 514 
+569 27 
+511 -37
+369 298
+341 -187
+0 231
 //Necropolis 
-604 55
-730 154
-591 512 
-535 445 
-477 323 
-486 164 
-542 66 
-560 26 
+604 58
+730 164
+592 512 
+536 445 
+478 323 
+487 164 
+543 66 
+561 26 
 401 262 
-473 240 
-508 372 
-503 97 
-410 78 
-412 77 
-730 154
-591 512 
-560 26 
-527 -66
-368 304
-339 -192
+474 240 
+509 372 
+504 97 
+406 77 
+-1 -1
+730 164
+592 512 
+561 26 
+501 98
+371 303
+339 -177
+0 231
 //Dungeon 
-608 55
-732 154
-599 495 
-558 448 
-470 296 
-476 180 
-522 56 
-564 15 
+608 50
+732 162
+560 495 
+559 448 
+471 296 
+477 180 
+523 56 
+565 15 
 395 260 
-470 164 
-521 305 
-493 53 
-277 94 
-277 94 
-608 55
-599 495 
-564 15 
-571 -66
-412 304
-383 -192
+471 164 
+522 305 
+494 53 
+283 94 
+283 94 
+732 162
+600 495 
+565 15 
+570 -50
+410 293
+381 -187
+0 230
 //Stronghold 
-617 55
-731 154
-585 508 
-552 440 
-482 304 
-475 189 
-533 69 
-567 30 
+617 62
+731 168
+586 508 
+553 440 
+483 304 
+476 189 
+534 69 
+568 30 
 407 266 
-477 235 
-510 380 
-498 107 
+478 235 
+511 380 
+499 107 
 410 90 
 410 91 
-731 154
-585 508 
-567 30 
-527 -66
-368 304
-339 -192
+731 168
+586 508 
+568 30 
+531 -45
+361 290
+342 -187
+0 231
 //Fortress 
-599 55
-721 154
+599 62
+721 178
 599 505 
-545 441 
+546 441 
 486 306 
-497 184 
-525 80 
-547 27 
+498 184 
+526 80 
+548 27 
 392 253 
-482 236 
-521 382 
-507 130 
-369 95 
-363 70 
-721 154
+483 236 
+522 382 
+508 130 
+383 95 
+376 70 
+721 178
 599 505 
-547 27 
-527 -66
-368 304
-339 -192
+548 27 
+541 -37
+372 308
+326 -182
+0 231
 //Conflux 
-600 55
-736 154
-607 505 
-508 346 
-467 299 
-470 147 
-520 41 
-575 28 
+600 50
+736 159
+608 505 
+509 346 
+468 299 
+471 147 
+521 41 
+576 28 
 408 254 
-485 232 
-508 346 
-489 97 
-410 80 
-410 80 
-736 154
-607 505 
-575 28 
-527 -66
-368 304
-339 -192
+486 232 
+509 346 
+490 97 
+407 80 
+407 80 
+736 159
+608 505 
+576 28 
+529 -42
+382 308
+341 -162
+0 229