mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
* fixed positions of stack queue and battle result window when resolution is != 800x600
* attack is now possible when hex under cursor is not displayed * first part of obstacles support
This commit is contained in:
parent
131c220685
commit
02309c5bb8
@ -364,20 +364,20 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
}
|
||||
}
|
||||
//printing hovered cell
|
||||
if(printMouseShadow)
|
||||
for(int b=0; b<BFIELD_SIZE; ++b)
|
||||
{
|
||||
for(int b=0; b<BFIELD_SIZE; ++b)
|
||||
if(bfield[b].strictHovered && bfield[b].hovered)
|
||||
{
|
||||
if(bfield[b].strictHovered && bfield[b].hovered)
|
||||
if(previouslyHoveredHex == -1) previouslyHoveredHex = b; //something to start with
|
||||
if(currentlyHoveredHex == -1) currentlyHoveredHex = b; //something to start with
|
||||
if(currentlyHoveredHex != b) //repair hover info
|
||||
{
|
||||
previouslyHoveredHex = currentlyHoveredHex;
|
||||
currentlyHoveredHex = b;
|
||||
}
|
||||
//print shade
|
||||
if(printMouseShadow)
|
||||
{
|
||||
if(previouslyHoveredHex == -1) previouslyHoveredHex = b; //something to start with
|
||||
if(currentlyHoveredHex == -1) currentlyHoveredHex = b; //something to start with
|
||||
if(currentlyHoveredHex != b) //repair hover info
|
||||
{
|
||||
previouslyHoveredHex = currentlyHoveredHex;
|
||||
currentlyHoveredHex = b;
|
||||
}
|
||||
//print shade
|
||||
int x = 14 + ((b/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(b%BFIELD_WIDTH) + pos.x;
|
||||
int y = 86 + 42 * (b/BFIELD_WIDTH) + pos.y;
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &genRect(cellShade->h, cellShade->w, x, y));
|
||||
@ -521,7 +521,7 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
if(showStackQueue)
|
||||
{
|
||||
int xPos = screen->w/2 - ( stacks.size() * 37 )/2;
|
||||
int yPos = 10;
|
||||
int yPos = (screen->h - 600)/2 + 10;
|
||||
|
||||
std::vector<CStack> stacksSorted;
|
||||
stacksSorted = LOCPLINT->cb->battleGetStackQueue();
|
||||
@ -1545,7 +1545,7 @@ void CBattleInterface::battleFinished(const BattleResult& br)
|
||||
deactivate();
|
||||
CGI->curh->changeGraphic(0,0);
|
||||
|
||||
SDL_Rect temp_rect = genRect(561, 470, 165, 19);
|
||||
SDL_Rect temp_rect = genRect(561, 470, (screen->w - 800)/2 + 165, (screen->h - 600)/2 + 19);
|
||||
resWindow = new CBattleReslutWindow(br, temp_rect, this);
|
||||
resWindow->activate();
|
||||
}
|
||||
@ -2465,7 +2465,7 @@ CBattleReslutWindow::CBattleReslutWindow(const BattleResult &br, const SDL_Rect
|
||||
SDL_Surface * pom = SDL_ConvertSurface(background, screen->format, screen->flags);
|
||||
SDL_FreeSurface(background);
|
||||
background = pom;
|
||||
exit = new AdventureMapButton (std::string(), std::string(), boost::bind(&CBattleReslutWindow::bExitf,this), 549, 524, "iok6432.def", SDLK_RETURN);
|
||||
exit = new AdventureMapButton (std::string(), std::string(), boost::bind(&CBattleReslutWindow::bExitf,this), 384 + pos.x, 505 + pos.y, "iok6432.def", SDLK_RETURN);
|
||||
|
||||
if(br.winner==0) //attacker won
|
||||
{
|
||||
|
85
config/obstacles.txt
Normal file
85
config/obstacles.txt
Normal file
@ -0,0 +1,85 @@
|
||||
BATTLE OBSTACLES
|
||||
[id] [Def name] [blockmap] [allowed terrins]
|
||||
{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 XXX 1111110000000010000000100
|
||||
56 OBBHS02.DEF XXLNX 1111100000000010000000100
|
||||
57 OBBHS03.DEF XXX 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 XXX 1111110000000010000000100
|
||||
1 OBDINO3.DEF XXLXX 1111110000000010000000100
|
||||
6 OBDRK01.DEF XX 1111110000000010000000100
|
||||
7 OBDRK02.DEF XX 1111110000000010000000100
|
||||
8 OBDRK03.DEF X 1111110000000010000000100
|
||||
9 OBDRK04.DEF XX 1111110000000010000000100
|
||||
10 OBDSH01.DEF XX 1111110000000010000000100
|
||||
93 OBDSM01.DEF NXXLNXXLNNXX 1100000000000000000000000
|
||||
17 OBDSM02.DEF XXLNX 1111100000000010000000100
|
||||
18 OBDSS17.DEF XXLNXXX 1111100000000010000000100
|
||||
11 OBDTF03.DEF XX 1111100000000010000000100
|
||||
12 OBDTS03.DEF XXXX 1111100000000010000000100
|
||||
13 OBDTS04.DEF XX 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
|
||||
20 OBGRK02.DEF XX 0000000000001010000000000
|
||||
22 OBGRS02.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
|
||||
-1
|
@ -45,6 +45,35 @@ CHeroHandler::~CHeroHandler()
|
||||
CHeroHandler::CHeroHandler()
|
||||
{}
|
||||
|
||||
void CHeroHandler::loadObstacles()
|
||||
{
|
||||
std::ifstream inp;
|
||||
inp.open("config" PATHSEPARATOR "obstacles.txt", std::ios_base::in|std::ios_base::binary);
|
||||
if(!inp.is_open())
|
||||
{
|
||||
tlog1<<"missing file: config/heroes_sec_skills.txt"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string dump;
|
||||
for(int i=0; i<99; ++i)
|
||||
{
|
||||
inp>>dump;
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
SObstacleInfo obi;
|
||||
inp>>obi.ID;
|
||||
if(obi.ID == -1) break;
|
||||
inp>>obi.defName;
|
||||
inp>>obi.blockmap;
|
||||
inp>>obi.allowedTerrains;
|
||||
obstacles[obi.ID] = obi;
|
||||
}
|
||||
inp.close();
|
||||
}
|
||||
}
|
||||
|
||||
void CHeroHandler::loadHeroes()
|
||||
{
|
||||
VLC->heroh = this;
|
||||
|
@ -50,6 +50,22 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct DLL_EXPORT SObstacleInfo
|
||||
{
|
||||
int ID;
|
||||
std::string defName,
|
||||
blockmap, //blockmap: X - blocked, N - not blocked, L - description goes to the next line, staring with the left bottom hex
|
||||
allowedTerrains; /*terrains[i]: 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*/
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & ID & defName & blockmap & allowedTerrains;
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CHeroHandler
|
||||
{
|
||||
public:
|
||||
@ -70,6 +86,10 @@ public:
|
||||
};
|
||||
std::vector<SBallisticsLevelInfo> ballistics; //info about ballistics ability per level; [0] - none; [1] - basic; [2] - adv; [3] - expert
|
||||
|
||||
std::map<int, SObstacleInfo> obstacles; //info about obstacles that may be placed on battlefield
|
||||
|
||||
void loadObstacles();
|
||||
|
||||
unsigned int level(unsigned int experience);
|
||||
unsigned int reqExp(unsigned int level);
|
||||
|
||||
@ -82,7 +102,7 @@ public:
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & heroClasses & heroes & expPerLevel & ballistics;
|
||||
h & heroClasses & heroes & expPerLevel & ballistics & obstacles;
|
||||
if(!h.saving)
|
||||
{
|
||||
//restore class pointers
|
||||
|
@ -155,6 +155,7 @@ void LibClasses::init()
|
||||
|
||||
heroh = new CHeroHandler;
|
||||
heroh->loadHeroes();
|
||||
heroh->loadObstacles();
|
||||
tlog0 <<"\tHero handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
arth = new CArtHandler;
|
||||
|
Loading…
Reference in New Issue
Block a user