Răsfoiți Sursa

* magic arrow probably works
* war machines support partially added
* queue of stacks narrowed
* minor fixes

mateuszb 17 ani în urmă
părinte
comite
ceb3cf8eae

+ 3 - 2
CBattleInterface.cpp

@@ -426,7 +426,7 @@ void CBattleInterface::show(SDL_Surface * to)
 	//showing queue of stacks
 	if(showStackQueue)
 	{
-		int xPos = 400 - ( stacks.size() * 42 )/2;
+		int xPos = 400 - ( stacks.size() * 37 )/2;
 		int yPos = 10;
 
 		std::vector<CStack> stacksSorted;
@@ -472,7 +472,7 @@ void CBattleInterface::show(SDL_Surface * to)
 				}
 				//colored border printed
 				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->additionalInfo = spellID; //spell number
 	ba->destinationTile = -1;
+	ba->stackNumber = (attackingHeroInstance->tempOwner == LOCPLINT->playerID) ? -1 : -2;
 	ba->side = defendingHeroInstance ? (LOCPLINT->playerID == defendingHeroInstance->tempOwner) : false;
 	spellToCast = ba;
 	spellDestSelectMode = true;

+ 5 - 1
CCastleInterface.cpp

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

+ 15 - 4
CPlayerInterface.cpp

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

+ 1 - 1
client/CCreatureAnimation.cpp

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

+ 38 - 0
server/CGameHandler.cpp

@@ -1627,6 +1627,44 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army
 			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);
 
 	//block engaged players