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

* various obstacles fixes

* better support for battle backgrounds
This commit is contained in:
mateuszb
2009-02-10 14:21:51 +00:00
parent 8e12a5c0a4
commit 489bd1e4f2
6 changed files with 332 additions and 292 deletions

View File

@ -1554,12 +1554,36 @@ int CGameState::battleGetStack(int pos)
int CGameState::battleGetBattlefieldType(int3 tile) int CGameState::battleGetBattlefieldType(int3 tile)
{ {
if(tile!=int3()) if(tile==int3() && curB)
return map->terrain[tile.x][tile.y][tile.z].tertype; tile = curB->tile;
else if(curB) else if(tile==int3() && !curB)
return map->terrain[curB->tile.x][curB->tile.y][curB->tile.z].tertype;
else
return -1; return -1;
switch(map->terrain[tile.x][tile.y][tile.z].tertype)
{
case dirt:
return rand()%3+3;
case sand:
return 2; //TODO: coast support
case grass:
return rand()%2+6;
case snow:
return rand()%2+10;
case swamp:
return 13;
case rough:
return 23;
case subterranean:
return 12;
case lava:
return 8;
case water:
return 25;
case rock:
return 15;
default:
return -1;
}
} }
UpgradeInfo CGameState::getUpgradeInfo(CArmedInstance *obj, int stackPos) UpgradeInfo CGameState::getUpgradeInfo(CArmedInstance *obj, int stackPos)

View File

@ -128,8 +128,8 @@ void Graphics::loadPaletteAndColors()
void Graphics::initializeBattleGraphics() void Graphics::initializeBattleGraphics()
{ {
std::ifstream bback("config/battleBack.txt"); std::ifstream bback("config/battleBack.txt");
battleBacks.resize(9); battleBacks.resize(26);
for(int i=0; i<9; ++i) //9 - number of terrains battle can be fought on for(int i=1; i<26; ++i) //25 - number of terrains battle can be fought on
{ {
int am; int am;
bback>>am; bback>>am;

View File

@ -1,9 +1,25 @@
3 CMBKDRDD.BMP CMBKDRMT.BMP CMBKDRTR.BMP 1 CMBKBCH.BMP
1 CMBKDES.BMP 1 CMBKDES.BMP
2 CMBKGRMT.BMP CMBKGRTR.BMP 1 CMBKDRTR.BMP
2 CMBKSNMT.BMP CMBKSNTR.BMP 1 CMBKDRMT.BMP
1 CMBKSWMP.BMP 1 CMBKDRDD.BMP
2 CMBKRGH.BMP CMBKRK.BMP 1 CMBKGRMT.BMP
1 CMBKSUB.BMP 1 CMBKGRTR.BMP
1 CMBKLAVA.BMP 1 CMBKLAVA.BMP
1 CMBKMAG.BMP
1 CMBKSNMT.BMP
1 CMBKSNTR.BMP
1 CMBKSUB.BMP
1 CMBKSWMP.BMP
1 CMBKFF.BMP
1 CMBKRK.BMP
1 CMBKMC.BMP
1 CMBKLP.BMP
1 CMBKHG.BMP
1 CMBKCF.BMP
1 CMBKEF.BMP
1 CMBKFW.BMP
1 CMBKCUR.BMP
1 CMBKRGH.BMP
1 CMBKBOAT.BMP
1 CMBKDECK.BMP 1 CMBKDECK.BMP

View File

@ -6,7 +6,7 @@ BATTLE OBSTACLES
20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough 20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough
24. ship to ship 25. ship} 24. ship to ship 25. ship}
{blockmap: X - blocked, N - not blocked, L - description goes to the next line, staring with the left bottom hex } {blockmap: X - blocked, N - not blocked, L - description goes to the next line, staring with the left bottom hex }
5 OBBDT01.DEF XXX 1111110000000010000000100 5 OBBDT01.DEF LNXXX 1111110000000010000000100
56 OBBHS02.DEF XXLNX 1100000000000000000000100 56 OBBHS02.DEF XXLNX 1100000000000000000000100
57 OBBHS03.DEF LXXX 1111100000000010000000100 57 OBBHS03.DEF LXXX 1111100000000010000000100
91 OBBHS04.DEF XXLNXX 1100000000000000000000000 91 OBBHS04.DEF XXLNXX 1100000000000000000000000
@ -23,7 +23,7 @@ BATTLE OBSTACLES
2 OBDINO2.DEF XXX 1111110000000010000000100 2 OBDINO2.DEF XXX 1111110000000010000000100
1 OBDINO3.DEF XXLXX 1111110000000010000000100 1 OBDINO3.DEF XXLXX 1111110000000010000000100
6 OBDRK01.DEF XX 1111110000000010000000100 6 OBDRK01.DEF XX 1111110000000010000000100
7 OBDRK02.DEF XX 1111110000000010000000100 7 OBDRK02.DEF LXX 1111110000000010000000100
8 OBDRK03.DEF X 1111110000000010000000100 8 OBDRK03.DEF X 1111110000000010000000100
9 OBDRK04.DEF XX 1111110000000010000000100 9 OBDRK04.DEF XX 1111110000000010000000100
10 OBDSH01.DEF XX 1111110000000010000000100 10 OBDSH01.DEF XX 1111110000000010000000100
@ -49,7 +49,7 @@ BATTLE OBSTACLES
94 OBGRK01.DEF XX 0000000000001010000000000 94 OBGRK01.DEF XX 0000000000001010000000000
23 OBGRK02.DEF XX 0000000000001010000000000 23 OBGRK02.DEF XX 0000000000001010000000000
20 OBGRS02.DEF NXX 0000000000001010000000000 20 OBGRS02.DEF NXX 0000000000001010000000000
22 OBGRS02.DEF NXXXXLNXXXXX 0000011010001100000000000 22 OBGRS01.DEF NXXXXLNXXXXX 0000011010001100000000000
35 OBGRSO3.DEF XXXXXXX 1111111010000010000000100 35 OBGRSO3.DEF XXXXXXX 1111111010000010000000100
21 OBGST01.DEF X 1111111010000010000000100 21 OBGST01.DEF X 1111111010000010000000100
61 OBHGS00.DEF X 0000000000000000000001000 61 OBHGS00.DEF X 0000000000000000000001000

View File

@ -2000,7 +2000,7 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army
} }
} }
int terType = gs->battleGetBattlefieldType(tile); //TODO: merge it with battleGetBattlefieldType int terType = gs->battleGetBattlefieldType(tile);
for(std::map<int, CObstacleInfo>::const_iterator g=VLC->heroh->obstacles.begin(); g!=VLC->heroh->obstacles.end(); ++g) for(std::map<int, CObstacleInfo>::const_iterator g=VLC->heroh->obstacles.begin(); g!=VLC->heroh->obstacles.end(); ++g)
{ {