1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

* 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)
This commit is contained in:
beegee1 2011-06-27 17:11:17 +00:00
parent e6409e8ddd
commit cef16ccc74
4 changed files with 196 additions and 176 deletions

View File

@ -3369,6 +3369,8 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
int ID = stack->ID; int ID = stack->ID;
if(creAnims.find(ID) == creAnims.end()) //eg. for summoned but not yet handled stacks if(creAnims.find(ID) == creAnims.end()) //eg. for summoned but not yet handled stacks
return; 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 animType = creAnims[ID]->getType();
@ -3377,6 +3379,14 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
affectingSpeed = 2; affectingSpeed = 2;
bool incrementFrame = (animCount%(4/affectingSpeed)==0) && animType!=5 && animType!=20 && animType!=2; bool incrementFrame = (animCount%(4/affectingSpeed)==0) && animType!=5 && animType!=20 && 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
{
// standing animation
if(animType == 2) if(animType == 2)
{ {
if(standingFrame.find(ID)!=standingFrame.end()) if(standingFrame.find(ID)!=standingFrame.end())
@ -3399,6 +3409,7 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
} }
} }
} }
}
// As long as the projectile of the shooter-stack is flying incrementFrame should be false // As long as the projectile of the shooter-stack is flying incrementFrame should be false
bool shootingFinished = true; bool shootingFinished = true;
@ -3413,7 +3424,7 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
} }
// Increment always when moving, never if stack died // 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 //printing amount
if(stack->count > 0 //don't print if stack is not alive if(stack->count > 0 //don't print if stack is not alive

View File

@ -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(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; const ui8 colorNr = SegmentType == 0xff ? FDef[BaseOffset+k] : SegmentType;
putPixel<bpp>(dest, xB, yB, palette[colorNr], colorNr, yellowBorder, blueBorder, aCountMod); putPixel<bpp>(dest, xB, yB, palette[colorNr], colorNr, yellowBorder, blueBorder, aCountMod);

View File

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

View File

@ -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, //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, //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 //Castle
600 55 600 49
720 154 720 158
601 500 602 500
528 350 528 350
468 291 469 291
469 127 470 127
523 32 524 32
568 35 569 35
399 274 399 274
476 238 477 238
511 347 512 347
488 79 489 79
410 90 410 90
410 80 403 80
720 154 720 158
601 500 602 500
568 35 557 24
527 -66 526 -29
368 304 394 299
339 -192 342 -187
0 231
//Rampart //Rampart
608 55 608 46
724 154 724 189
593 511 594 511
548 451 549 451
468 309 469 309
468 186 469 186
529 57 530 57
565 31 565 31
403 271 403 271
459 220 460 220
509 364 510 364
491 103 492 103
410 77 410 77
410 97 410 97
724 154 724 189
593 511 594 511
565 31 566 31
527 -66 532 -27
368 304 371 296
339 -192 341 -186
0 232
//Tower //Tower
615 55 615 57
726 154 726 148
591 516 592 516
547 452 547 452
474 298 475 298
487 190 488 190
546 66 547 66
579 36 580 36
400 253 400 253
470 187 471 187
516 365 517 365
513 79 514 79
410 90 410 90
410 80 410 80
726 154 726 148
591 516 592 516
579 36 580 36
527 -66 499 -16
368 304 355 311
339 -192 346 -175
0 231
//Inferno //Inferno
606 55 606 52
730 154 730 179
594 514 595 514
560 451 561 451
484 316 485 316
479 151 480 151
531 71 532 71
568 27 569 27
408 254 408 254
476 221 477 221
521 376 522 376
501 92 502 92
410 68 403 68
410 68 403 68
730 154 730 179
594 514 595 514
568 27 569 27
527 -66 511 -37
368 304 369 298
339 -192 341 -187
0 231
//Necropolis //Necropolis
604 55 604 58
730 154 730 164
591 512 592 512
535 445 536 445
477 323 478 323
486 164 487 164
542 66 543 66
560 26 561 26
401 262 401 262
473 240 474 240
508 372 509 372
503 97 504 97
410 78 406 77
412 77 -1 -1
730 154 730 164
591 512 592 512
560 26 561 26
527 -66 501 98
368 304 371 303
339 -192 339 -177
0 231
//Dungeon //Dungeon
608 55 608 50
732 154 732 162
599 495 560 495
558 448 559 448
470 296 471 296
476 180 477 180
522 56 523 56
564 15 565 15
395 260 395 260
470 164 471 164
521 305 522 305
493 53 494 53
277 94 283 94
277 94 283 94
608 55 732 162
599 495 600 495
564 15 565 15
571 -66 570 -50
412 304 410 293
383 -192 381 -187
0 230
//Stronghold //Stronghold
617 55 617 62
731 154 731 168
585 508 586 508
552 440 553 440
482 304 483 304
475 189 476 189
533 69 534 69
567 30 568 30
407 266 407 266
477 235 478 235
510 380 511 380
498 107 499 107
410 90 410 90
410 91 410 91
731 154 731 168
585 508 586 508
567 30 568 30
527 -66 531 -45
368 304 361 290
339 -192 342 -187
0 231
//Fortress //Fortress
599 55 599 62
721 154 721 178
599 505 599 505
545 441 546 441
486 306 486 306
497 184 498 184
525 80 526 80
547 27 548 27
392 253 392 253
482 236 483 236
521 382 522 382
507 130 508 130
369 95 383 95
363 70 376 70
721 154 721 178
599 505 599 505
547 27 548 27
527 -66 541 -37
368 304 372 308
339 -192 326 -182
0 231
//Conflux //Conflux
600 55 600 50
736 154 736 159
607 505 608 505
508 346 509 346
467 299 468 299
470 147 471 147
520 41 521 41
575 28 576 28
408 254 408 254
485 232 486 232
508 346 509 346
489 97 490 97
410 80 407 80
410 80 407 80
736 154 736 159
607 505 608 505
575 28 576 28
527 -66 529 -42
368 304 382 308
339 -192 341 -162
0 229