mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
* positions of obstacles in the battlefield can now be individually shifted by config file
This commit is contained in:
parent
ca7ee8936c
commit
4672070e8c
@ -470,8 +470,9 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
std::vector<CObstacleInstance> obstacles = LOCPLINT->cb->battleGetAllObstacles();
|
||||
for(int b=0; b<obstacles.size(); ++b)
|
||||
{
|
||||
int x = ((obstacles[b].pos/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(obstacles[b].pos%BFIELD_WIDTH) + pos.x;
|
||||
int y = 86 + 42 * (obstacles[b].pos/BFIELD_WIDTH) + pos.y;
|
||||
std::pair<si16, si16> shift = CGI->heroh->obstacles[obstacles[b].ID].posShift;
|
||||
int x = ((obstacles[b].pos/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(obstacles[b].pos%BFIELD_WIDTH) + pos.x + shift.first;
|
||||
int y = 86 + 42 * (obstacles[b].pos/BFIELD_WIDTH) + pos.y + shift.second;
|
||||
std::vector<Cimage> &images = idToObstacle[obstacles[b].ID]->ourImages; //reference to animation of obstacle
|
||||
blitAt(images[((animCount+1)/(4/settings.animSpeed))%images.size()].bitmap, x, y, to);
|
||||
}
|
||||
|
@ -1,106 +1,106 @@
|
||||
BATTLE OBSTACLES
|
||||
[id] [Def name] [blockmap] [allowed terrins]
|
||||
[id] [Def name] [blockmap] [allowed terrins] [two numbers: shift of obstacle's position in the battlefield <x shift, y shift>, eg. if it's <-1, 2> obstacle will be printed one pixel to the left and two to the bottom]
|
||||
{terrains: 1. sand/shore 2. sand/mesas 3. dirt/birches 4. dirt/hills 5. dirt/pines 6. grass/hills
|
||||
7. grass/pines 8. lava 9. magic plains 10. snow/mountains 11. snow/trees 12. subterranean 13. swamp/trees
|
||||
14. fiery fields 15. rock lands 16. magic clouds 17. lucid pools 18. holy ground 19. clover field
|
||||
20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough
|
||||
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 }
|
||||
5 OBBDT01.DEF LNXXX 1111110000000010000000100
|
||||
56 OBBHS02.DEF XXLNX 1100000000000000000000100
|
||||
57 OBBHS03.DEF LXXX 1111100000000010000000100
|
||||
91 OBBHS04.DEF XXLNXX 1100000000000000000000000
|
||||
58 OBBHS11A.DEF XXXLNXXX 1100000000000000000000000
|
||||
59 OBBHS12B.DEF NXXLNXX 1100000000000000000000000
|
||||
60 OBBHS14B.DEF NXLNXX 1111100000000010000000100
|
||||
92 OBBHS16A.DEF XLNXX 1100000000000000000000000
|
||||
55 OBBTS04.DEF XLXX 0000000000000000000000011
|
||||
71 OBCFS00.DEF X 0000000000000000001000000
|
||||
72 OBCFS01.DEF XXX 0000000000000000001000000
|
||||
73 OBCFS02.DEF XXLNXX 0000000000000000001000000
|
||||
74 OBCFS03.DEF NXXLNXX 0000000000000000001000000
|
||||
0 OBDINO1.DEF XX 1111110000000010000000100
|
||||
2 OBDINO2.DEF LXXX 1111110000000010000000100
|
||||
1 OBDINO3.DEF XXLXX 1111110000000010000000100
|
||||
6 OBDRK01.DEF XX 1111110000000010000000100
|
||||
7 OBDRK02.DEF LXX 1111110000000010000000100
|
||||
8 OBDRK03.DEF X 1111110000000010000000100
|
||||
9 OBDRK04.DEF LXX 1111110000000010000000100
|
||||
10 OBDSH01.DEF LXX 1111110000000010000000100
|
||||
93 OBDSM01.DEF NXXLNXXLNNXX 1100000000000000000000000
|
||||
17 OBDSM02.DEF XXLNX 1111100000000010000000100
|
||||
18 OBDSS17.DEF XXLNXXX 1111100000000010000000100
|
||||
11 OBDTF03.DEF XX 1111100000000010000000100
|
||||
12 OBDTS03.DEF LLNXXXX 1111100000000010000000100
|
||||
13 OBDTS04.DEF LNXX 1111100000000010000000100
|
||||
14 OBDTS14.DEF XXLNNX 1111100000000010000000100
|
||||
15 OBDTS15.DEF XLXLNX 1111100000000010000000100
|
||||
66 OBEFS00.DEF X 0000000000000000000100000
|
||||
67 OBEFS01.DEF XX 0000000000000000000100000
|
||||
68 OBEFS02.DEF NXLXXX 0000000000000000000100000
|
||||
69 OBEFS03.DEF XXXLNXX 0000000000000000000100000
|
||||
70 OBEFS04.DEF XXXXXLNXX 0000000000000000000100000
|
||||
79 OBFFS00.DEF X 0000000100000000000000000
|
||||
80 OBFFS01.DEF XX 0000000100000000000000000
|
||||
81 OBFFS02.DEF NXLXXX 0000000100000000000000000
|
||||
82 OBFFS03.DEF XXLNXXX 0000000100000000000000000
|
||||
83 OBFFS04.DEF XXXLXXXX 0000000100000000000000000
|
||||
19 OBGLG01.DEF XX 0000000000001010000000000
|
||||
94 OBGRK01.DEF XX 0000000000001010000000000
|
||||
23 OBGRK02.DEF XX 0000000000001010000000000
|
||||
20 OBGRS02.DEF NXX 0000000000001010000000000
|
||||
22 OBGRS01.DEF NXXXXLNXXXXX 0000011010001100000000000
|
||||
35 OBGRSO3.DEF XXXXXXX 1111111010000010000000100
|
||||
21 OBGST01.DEF X 1111111010000010000000100
|
||||
61 OBHGS00.DEF X 0000000000000000000001000
|
||||
62 OBHGS01.DEF XX 0000000000000000000001000
|
||||
63 OBHGS02.DEF X 0000000000000000000001000
|
||||
64 OBHGS03.DEF XXX 0000000000000000000001000
|
||||
65 OBHGS04.DEF XXXX 0000000000000000000001000
|
||||
75 OBLPS00.DEF X 0000000000000000100000000
|
||||
76 OBLPS01.DEF XX 0000000000000000100000000
|
||||
77 OBLPS02.DEF NXXLNXX 0000000000000000100000000
|
||||
78 OBLPS03.DEF XXXXLNXXXX 0000000000000000100000000
|
||||
48 OBLVS01.DEF XXXLNNXXLNNNXX 0000000100000000000000000
|
||||
49 OBLVS02.DEF XXXXLXXXX 0000000100000000000000000
|
||||
50 OBLVS03.DEF XXXXLNXXX 0000000100000000000000000
|
||||
51 OBLVS04.DEF XXX 0000000100000000000000000
|
||||
52 OBLVS09.DEF XXLNXXLNNXX 0000000100000000000000000
|
||||
53 OBLVS17.DEF NNXLXXXX 0000000100000000000000000
|
||||
54 OBLVS22.DEF XXXLXXXX 0000000100000000000000000
|
||||
88 OBMCS00.DEF X 0000000000000001000000000
|
||||
89 OBMCS01.DEF XLNX 0000000000000001000000000
|
||||
90 OBMCS02.DEF NXX 0000000000000001000000000
|
||||
41 OBRGS01.DEF XLXX 1111100000000000000000100
|
||||
40 OBRGS02.DEF NXXLNXXLNXXX 1111100000000000000000100
|
||||
42 OBRGS03.DEF XXLNXX 1111100000000000000000100
|
||||
43 OBRGS04.DEF XXLX 1111100000000000000000100
|
||||
44 OBRGS05.DEF NXLXX 1111100000000000000000100
|
||||
95 OBRGS06.DEF NXXXXLNNNNXLNNNNNX 1111100000000000000000100
|
||||
84 OBRLS00.DEF X 000000000000001000000000
|
||||
85 OBRLS01.DEF XX 000000000000001000000000
|
||||
86 OBRLS02.DEF XXX 000000000000001000000000
|
||||
87 OBRLS03.DEF XLNXX 000000000000001000000000
|
||||
4 OBSKEL1.DEF XX 1111110000000010000000100
|
||||
3 OBSKEL2.DEF XX 1111110000000010000000100
|
||||
24 OBSNS01.DEF XXX 0000000001100000000000000
|
||||
25 OBSNS02.DEF NXXXX 0000000001100000000000000
|
||||
26 OBSNS03.DEF XLXLX 0000000001100000000000000
|
||||
27 OBSNS04.DEF XXX 0000000001100000000000000
|
||||
28 OBSNS05.DEF X 0000000001100000000000000
|
||||
29 OBSNS06.DEF LNXX 0000000001100000000000000
|
||||
30 OBSNS07.DEF XX 0000000001100000000000000
|
||||
31 OBSNS08.DEF LNXXX 0000000001100000000000000
|
||||
32 OBSNS09.DEF XXXXLNNXXXX 0000000001100000000000000
|
||||
33 OBSNS10.DEF XXLNXLNXXXLNNXX 0000000001100000000000000
|
||||
45 OBSUS01.DEF XLXXX 0000000000010000000000000
|
||||
46 OBSUS02.DEF XXX 0000000000010000000000000
|
||||
47 OBSUS11B.DEF XXXLXXXX 0000000000010000000000000
|
||||
34 OBSWS01.DEF LNX 0000000000001000000000000
|
||||
35 OBSWS02.DEF XXXXXXX 0000000000001000000000000
|
||||
36 OBSWS03.DEF XX 0000000000001000000000000
|
||||
37 OBSWS04.DEF XXX 0000000000001000000000000
|
||||
38 OBSWS11B.DEF XXXXLXXXX 0000000000001000000000000
|
||||
16 OBSWS11B.DEF NXXXLXXXLXXX 0000000000001000000000000
|
||||
39 OBSWS13A.DEF XXXXLXX 0000000000001000000000000
|
||||
5 OBBDT01.DEF LNXXX 1111110000000010000000100 0 0
|
||||
56 OBBHS02.DEF XXLNX 1100000000000000000000100 0 0
|
||||
57 OBBHS03.DEF LXXX 1111100000000010000000100 0 0
|
||||
91 OBBHS04.DEF XXLNXX 1100000000000000000000000 0 0
|
||||
58 OBBHS11A.DEF XXXLNXXX 1100000000000000000000000 0 0
|
||||
59 OBBHS12B.DEF NXXLNXX 1100000000000000000000000 0 0
|
||||
60 OBBHS14B.DEF NXLNXX 1111100000000010000000100 0 0
|
||||
92 OBBHS16A.DEF XLNXX 1100000000000000000000000 0 0
|
||||
55 OBBTS04.DEF XLXX 0000000000000000000000011 0 0
|
||||
71 OBCFS00.DEF X 0000000000000000001000000 0 0
|
||||
72 OBCFS01.DEF XXX 0000000000000000001000000 0 0
|
||||
73 OBCFS02.DEF XXLNXX 0000000000000000001000000 0 0
|
||||
74 OBCFS03.DEF NXXLNXX 0000000000000000001000000 0 0
|
||||
0 OBDINO1.DEF XX 1111110000000010000000100 0 0
|
||||
2 OBDINO2.DEF LXXX 1111110000000010000000100 0 0
|
||||
1 OBDINO3.DEF XXLXX 1111110000000010000000100 0 0
|
||||
6 OBDRK01.DEF XX 1111110000000010000000100 0 0
|
||||
7 OBDRK02.DEF LXX 1111110000000010000000100 0 0
|
||||
8 OBDRK03.DEF X 1111110000000010000000100 0 0
|
||||
9 OBDRK04.DEF LXX 1111110000000010000000100 0 0
|
||||
10 OBDSH01.DEF LXX 1111110000000010000000100 0 0
|
||||
93 OBDSM01.DEF NXXLNXXLNNXX 1100000000000000000000000 0 0
|
||||
17 OBDSM02.DEF XXLNX 1111100000000010000000100 0 0
|
||||
18 OBDSS17.DEF XXLNXXX 1111100000000010000000100 0 0
|
||||
11 OBDTF03.DEF XX 1111100000000010000000100 0 0
|
||||
12 OBDTS03.DEF LLNXXXX 1111100000000010000000100 0 0
|
||||
13 OBDTS04.DEF LNXX 1111100000000010000000100 0 0
|
||||
14 OBDTS14.DEF XXLNNX 1111100000000010000000100 0 0
|
||||
15 OBDTS15.DEF XLXLNX 1111100000000010000000100 0 0
|
||||
66 OBEFS00.DEF X 0000000000000000000100000 0 0
|
||||
67 OBEFS01.DEF XX 0000000000000000000100000 0 0
|
||||
68 OBEFS02.DEF NXLXXX 0000000000000000000100000 0 0
|
||||
69 OBEFS03.DEF XXXLNXX 0000000000000000000100000 0 0
|
||||
70 OBEFS04.DEF XXXXXLNXX 0000000000000000000100000 0 0
|
||||
79 OBFFS00.DEF X 0000000100000000000000000 0 0
|
||||
80 OBFFS01.DEF XX 0000000100000000000000000 0 0
|
||||
81 OBFFS02.DEF NXLXXX 0000000100000000000000000 0 0
|
||||
82 OBFFS03.DEF XXLNXXX 0000000100000000000000000 0 0
|
||||
83 OBFFS04.DEF XXXLXXXX 0000000100000000000000000 0 0
|
||||
19 OBGLG01.DEF XX 0000000000001010000000000 0 0
|
||||
94 OBGRK01.DEF XX 0000000000001010000000000 0 0
|
||||
23 OBGRK02.DEF XX 0000000000001010000000000 0 0
|
||||
20 OBGRS02.DEF NXX 0000000000001010000000000 0 0
|
||||
22 OBGRS01.DEF NXXXXLNXXXXX 0000011010001100000000000 0 0
|
||||
35 OBGRSO3.DEF XXXXXXX 1111111010000010000000100 0 0
|
||||
21 OBGST01.DEF X 1111111010000010000000100 0 0
|
||||
61 OBHGS00.DEF X 0000000000000000000001000 0 0
|
||||
62 OBHGS01.DEF XX 0000000000000000000001000 0 0
|
||||
63 OBHGS02.DEF X 0000000000000000000001000 0 0
|
||||
64 OBHGS03.DEF XXX 0000000000000000000001000 0 0
|
||||
65 OBHGS04.DEF XXXX 0000000000000000000001000 0 0
|
||||
75 OBLPS00.DEF X 0000000000000000100000000 0 0
|
||||
76 OBLPS01.DEF XX 0000000000000000100000000 0 0
|
||||
77 OBLPS02.DEF NXXLNXX 0000000000000000100000000 0 0
|
||||
78 OBLPS03.DEF XXXXLNXXXX 0000000000000000100000000 0 0
|
||||
48 OBLVS01.DEF XXXLNNXXLNNNXX 0000000100000000000000000 0 0
|
||||
49 OBLVS02.DEF XXXXLXXXX 0000000100000000000000000 0 0
|
||||
50 OBLVS03.DEF XXXXLNXXX 0000000100000000000000000 0 0
|
||||
51 OBLVS04.DEF XXX 0000000100000000000000000 0 0
|
||||
52 OBLVS09.DEF XXLNXXLNNXX 0000000100000000000000000 0 0
|
||||
53 OBLVS17.DEF NNXLXXXX 0000000100000000000000000 0 0
|
||||
54 OBLVS22.DEF XXXLXXXX 0000000100000000000000000 0 0
|
||||
88 OBMCS00.DEF X 0000000000000001000000000 0 0
|
||||
89 OBMCS01.DEF XLNX 0000000000000001000000000 0 0
|
||||
90 OBMCS02.DEF NXX 0000000000000001000000000 0 0
|
||||
41 OBRGS01.DEF XLXX 1111100000000000000000100 0 0
|
||||
40 OBRGS02.DEF NXXLNXXLNXXX 1111100000000000000000100 0 0
|
||||
42 OBRGS03.DEF XXLNXX 1111100000000000000000100 0 0
|
||||
43 OBRGS04.DEF XXLX 1111100000000000000000100 0 0
|
||||
44 OBRGS05.DEF NXLXX 1111100000000000000000100 0 0
|
||||
95 OBRGS06.DEF NXXXXLNNNNXLNNNNNX 1111100000000000000000100 0 0
|
||||
84 OBRLS00.DEF X 000000000000001000000000 0 0
|
||||
85 OBRLS01.DEF XX 000000000000001000000000 0 0
|
||||
86 OBRLS02.DEF XXX 000000000000001000000000 0 0
|
||||
87 OBRLS03.DEF XLNXX 000000000000001000000000 0 0
|
||||
4 OBSKEL1.DEF XX 1111110000000010000000100 0 0
|
||||
3 OBSKEL2.DEF XX 1111110000000010000000100 0 0
|
||||
24 OBSNS01.DEF XXX 0000000001100000000000000 0 0
|
||||
25 OBSNS02.DEF NXXXX 0000000001100000000000000 0 0
|
||||
26 OBSNS03.DEF XLXLX 0000000001100000000000000 0 0
|
||||
27 OBSNS04.DEF XXX 0000000001100000000000000 0 0
|
||||
28 OBSNS05.DEF X 0000000001100000000000000 0 0
|
||||
29 OBSNS06.DEF LNXX 0000000001100000000000000 0 0
|
||||
30 OBSNS07.DEF XX 0000000001100000000000000 0 0
|
||||
31 OBSNS08.DEF LNXXX 0000000001100000000000000 0 0
|
||||
32 OBSNS09.DEF XXXXLNNXXXX 0000000001100000000000000 0 0
|
||||
33 OBSNS10.DEF XXLNXLNXXXLNNXX 0000000001100000000000000 0 0
|
||||
45 OBSUS01.DEF XLXXX 0000000000010000000000000 0 0
|
||||
46 OBSUS02.DEF XXX 0000000000010000000000000 0 0
|
||||
47 OBSUS11B.DEF XXXLXXXX 0000000000010000000000000 0 0
|
||||
34 OBSWS01.DEF LNX 0000000000001000000000000 0 0
|
||||
35 OBSWS02.DEF XXXXXXX 0000000000001000000000000 0 0
|
||||
36 OBSWS03.DEF XX 0000000000001000000000000 0 0
|
||||
37 OBSWS04.DEF XXX 0000000000001000000000000 0 0
|
||||
38 OBSWS11B.DEF XXXXLXXXX 0000000000001000000000000 0 0
|
||||
16 OBSWS11B.DEF NXXXLXXXLXXX 0000000000001000000000000 0 0
|
||||
39 OBSWS13A.DEF XXXXLXX 0000000000001000000000000 0 0
|
||||
-1
|
@ -163,10 +163,12 @@ void CHeroHandler::loadObstacles()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string dump;
|
||||
for(int i=0; i<99; ++i)
|
||||
const int MAX_DUMP = 10000;
|
||||
char dump[MAX_DUMP+1];
|
||||
|
||||
for(int i=0; i<8; ++i)
|
||||
{
|
||||
inp>>dump;
|
||||
inp.getline(dump, MAX_DUMP);
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
@ -176,6 +178,8 @@ void CHeroHandler::loadObstacles()
|
||||
inp>>obi.defName;
|
||||
inp>>obi.blockmap;
|
||||
inp>>obi.allowedTerrains;
|
||||
inp>>obi.posShift.first;
|
||||
inp>>obi.posShift.second;
|
||||
obstacles[obi.ID] = obi;
|
||||
}
|
||||
inp.close();
|
||||
|
@ -79,12 +79,13 @@ struct DLL_EXPORT CObstacleInfo
|
||||
14. fiery fields 15. rock lands 16. magic clouds 17. lucid pools 18. holy ground 19. clover field
|
||||
20. evil fog 21. "favourable winds" text on magic plains background 22. cursed ground 23. rough
|
||||
24. ship to ship 25. ship*/
|
||||
std::pair<si16, si16> posShift; //shift of obstacle's position in the battlefield <x shift, y shift>, eg. if it's <-1, 2> obstacle will be printed one pixel to the left and two to the bottom
|
||||
int getWidth(); //returns width of obstacle in hexes
|
||||
int getHeight(); //returns height of obstacle in hexes
|
||||
std::vector<int> getBlocked(int hex); //returns vector of hexes blocked by obstacle when it's placed on hex 'hex'
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & ID & defName & blockmap & allowedTerrains;
|
||||
h & ID & defName & blockmap & allowedTerrains & posShift;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user