1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

* magic arrow probably works

* war machines support partially added
* queue of stacks narrowed
* minor fixes
This commit is contained in:
mateuszb
2008-11-06 17:17:48 +00:00
parent b988d5a51c
commit ceb3cf8eae
5 changed files with 62 additions and 8 deletions

View File

@ -426,7 +426,7 @@ void CBattleInterface::show(SDL_Surface * to)
//showing queue of stacks //showing queue of stacks
if(showStackQueue) if(showStackQueue)
{ {
int xPos = 400 - ( stacks.size() * 42 )/2; int xPos = 400 - ( stacks.size() * 37 )/2;
int yPos = 10; int yPos = 10;
std::vector<CStack> stacksSorted; std::vector<CStack> stacksSorted;
@ -472,7 +472,7 @@ void CBattleInterface::show(SDL_Surface * to)
} }
//colored border printed //colored border printed
SDL_BlitSurface(graphics->smallImgs[stacksSorted[b % stacksSorted.size()].creature->idNumber], NULL, to, &genRect(32, 32, xPos, yPos)); SDL_BlitSurface(graphics->smallImgs[stacksSorted[b % stacksSorted.size()].creature->idNumber], NULL, to, &genRect(32, 32, xPos, yPos));
xPos += 42; xPos += 37;
} }
} }
} }
@ -1281,6 +1281,7 @@ void CBattleInterface::castThisSpell(int spellID)
ba->actionType = 1; ba->actionType = 1;
ba->additionalInfo = spellID; //spell number ba->additionalInfo = spellID; //spell number
ba->destinationTile = -1; ba->destinationTile = -1;
ba->stackNumber = (attackingHeroInstance->tempOwner == LOCPLINT->playerID) ? -1 : -2;
ba->side = defendingHeroInstance ? (LOCPLINT->playerID == defendingHeroInstance->tempOwner) : false; ba->side = defendingHeroInstance ? (LOCPLINT->playerID == defendingHeroInstance->tempOwner) : false;
spellToCast = ba; spellToCast = ba;
spellDestSelectMode = true; spellDestSelectMode = true;

View File

@ -1376,7 +1376,11 @@ void CFortScreen::draw( CCastleInterface * owner, bool first)
//damage //damage
printAt(CGI->generaltexth->allTexts[199],positions[i].x+288,positions[i].y+46,GEOR13,zwykly,bg); printAt(CGI->generaltexth->allTexts[199],positions[i].x+288,positions[i].y+46,GEOR13,zwykly,bg);
SDL_itoa(c->damageMin,buf,10); SDL_itoa(c->damageMin,buf,10);
int hlp=log10f(c->damageMin)+2; int hlp;
if(c->damageMin > 0)
hlp = log10f(c->damageMin)+2;
else
hlp = 2;
buf[hlp-1]=' '; buf[hlp]='-'; buf[hlp+1]=' '; buf[hlp-1]=' '; buf[hlp]='-'; buf[hlp+1]=' ';
SDL_itoa(c->damageMax,buf+hlp+2,10); SDL_itoa(c->damageMax,buf+hlp+2,10);
printToWR(buf,positions[i].x+381,positions[i].y+59,GEOR13,zwykly,bg); printToWR(buf,positions[i].x+381,positions[i].y+59,GEOR13,zwykly,bg);

View File

@ -3143,7 +3143,7 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
graphics->blueToPlayersAdv(bitmap,LOCPLINT->playerID); graphics->blueToPlayersAdv(bitmap,LOCPLINT->playerID);
SDL_SetColorKey(bitmap,SDL_SRCCOLORKEY,SDL_MapRGB(bitmap->format,0,255,255)); SDL_SetColorKey(bitmap,SDL_SRCCOLORKEY,SDL_MapRGB(bitmap->format,0,255,255));
anim = new CCreaturePic(c); anim = new CCreaturePic(c);
if(!type) anim->anim->setType(1); if(!type) anim->anim->setType(2);
char pom[75];int hlp=0; char pom[75];int hlp=0;
@ -3160,7 +3160,11 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
SDL_itoa(c->attack,pom,10); SDL_itoa(c->attack,pom,10);
if(State && State->attackBonus) if(State && State->attackBonus)
{ {
int hlp = log10f(c->attack)+2; int hlp;
if(c->attack > 0)
hlp = log10f(c->attack)+2;
else
hlp = 2;
pom[hlp-1] = ' '; pom[hlp] = '('; pom[hlp-1] = ' '; pom[hlp] = '(';
SDL_itoa(c->attack+State->attackBonus,pom+hlp+1,10); SDL_itoa(c->attack+State->attackBonus,pom+hlp+1,10);
hlp += 2+(int)log10f(State->attackBonus+c->attack); hlp += 2+(int)log10f(State->attackBonus+c->attack);
@ -3173,7 +3177,11 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
SDL_itoa(c->defence,pom,10); SDL_itoa(c->defence,pom,10);
if(State && State->defenseBonus) if(State && State->defenseBonus)
{ {
int hlp = log10f(c->defence)+2; int hlp;
if(c->defence > 0)
hlp = log10f(c->defence)+2;
else
hlp = 2;
pom[hlp-1] = ' '; pom[hlp] = '('; pom[hlp-1] = ' '; pom[hlp] = '(';
SDL_itoa(c->defence+State->defenseBonus,pom+hlp+1,10); SDL_itoa(c->defence+State->defenseBonus,pom+hlp+1,10);
hlp += 2+(int)log10f(State->defenseBonus+c->defence); hlp += 2+(int)log10f(State->defenseBonus+c->defence);
@ -3195,7 +3203,10 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
//damage //damage
printAt(CGI->generaltexth->allTexts[199],155,105,GEOR13,zwykly,bitmap); printAt(CGI->generaltexth->allTexts[199],155,105,GEOR13,zwykly,bitmap);
SDL_itoa(c->damageMin,pom,10); SDL_itoa(c->damageMin,pom,10);
hlp=log10f(c->damageMin)+2; if(c->damageMin > 0)
hlp = log10f(c->damageMin)+2;
else
hlp = 2;
pom[hlp-1]=' '; pom[hlp]='-'; pom[hlp+1]=' '; pom[hlp-1]=' '; pom[hlp]='-'; pom[hlp+1]=' ';
SDL_itoa(c->damageMax,pom+hlp+2,10); SDL_itoa(c->damageMax,pom+hlp+2,10);
printToWR(pom,276,118,GEOR13,zwykly,bitmap); printToWR(pom,276,118,GEOR13,zwykly,bitmap);

View File

@ -138,7 +138,7 @@ void CCreatureAnimation::incrementFrame()
int j=-1; //first frame in displayed group int j=-1; //first frame in displayed group
for(int g=0; g<SEntries.size(); ++g) for(int g=0; g<SEntries.size(); ++g)
{ {
if(SEntries[g].group==type && j==-1) if(SEntries[g].group==type)
{ {
j = g; j = g;
break; break;

View File

@ -1627,6 +1627,44 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army
stacks[g]->position -= 1; stacks[g]->position -= 1;
} }
} }
//adding war machines
if(hero1)
{
if(hero1->artifWorn[13]) //ballista
{
stacks.push_back(new CStack(&VLC->creh->creatures[146], 1, hero1->tempOwner, stacks.size(), true, 255));
stacks[stacks.size()-1]->position = 52;
}
if(hero1->artifWorn[14]) //ammo cart
{
stacks.push_back(new CStack(&VLC->creh->creatures[148], 1, hero1->tempOwner, stacks.size(), true, 255));
stacks[stacks.size()-1]->position = 18;
}
if(hero1->artifWorn[15]) //first aid tent
{
stacks.push_back(new CStack(&VLC->creh->creatures[147], 1, hero1->tempOwner, stacks.size(), true, 255));
stacks[stacks.size()-1]->position = 154;
}
}
if(hero2)
{
if(hero2->artifWorn[13]) //ballista
{
stacks.push_back(new CStack(&VLC->creh->creatures[146], 1, hero2->tempOwner, stacks.size(), false, 255));
stacks[stacks.size()-1]->position = 66;
}
if(hero2->artifWorn[14]) //ammo cart
{
stacks.push_back(new CStack(&VLC->creh->creatures[148], 1, hero2->tempOwner, stacks.size(), false, 255));
stacks[stacks.size()-1]->position = 32;
}
if(hero2->artifWorn[15]) //first aid tent
{
stacks.push_back(new CStack(&VLC->creh->creatures[147], 1, hero2->tempOwner, stacks.size(), false, 255));
stacks[stacks.size()-1]->position = 168;
}
}
//war machiens added
std::stable_sort(stacks.begin(),stacks.end(),cmpst); std::stable_sort(stacks.begin(),stacks.end(),cmpst);
//block engaged players //block engaged players