1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* reading 8. byte of player description from map header

* disabled loading creatures battle animations 
* fixed memory leaks (a few of many)
* creating default start options
* minor bugfix in main menu (slider wasn't removed)
* added txt file with portrait list
* reading heroes portraits
This commit is contained in:
Michał W. Urbańczyk 2007-07-19 23:38:11 +00:00
parent db65d9ee15
commit bbbfce798c
11 changed files with 192 additions and 10 deletions

View File

@ -107,7 +107,7 @@ void CAmbarCendamo::deh3m()
if (map.players[pom].hasMainTown) if (map.players[pom].hasMainTown)
{ {
map.players[pom].generateHeroAtMainTown = bufor[i++]; map.players[pom].generateHeroAtMainTown = bufor[i++];
i++; //unknown byte map.players[pom].generateHero = bufor[i++];
map.players[pom].posOfMainTown.x = bufor[i++]; map.players[pom].posOfMainTown.x = bufor[i++];
map.players[pom].posOfMainTown.y = bufor[i++]; map.players[pom].posOfMainTown.y = bufor[i++];
map.players[pom].posOfMainTown.z = bufor[i++]; map.players[pom].posOfMainTown.z = bufor[i++];

View File

@ -22,7 +22,7 @@ void CCreatureHandler::loadCreatures()
if(creatures.size()>190 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos) if(creatures.size()>190 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos)
{ {
loadAnimationInfo(); loadAnimationInfo();
loadUnitAnimations(); //loadUnitAnimations();
break; break;
} }

View File

@ -4,6 +4,30 @@
#include <sstream> #include <sstream>
#define CGI (CGameInfo::mainObj) #define CGI (CGameInfo::mainObj)
CHeroHandler::~CHeroHandler()
{
for (int j=0;j<heroes.size();j++)
{
if (heroes[j]->portraitSmall)
SDL_FreeSurface(heroes[j]->portraitSmall);
delete heroes[j];
}
}
void CHeroHandler::loadPortraits()
{
std::ifstream of("portrety.txt");
for (int j=0;j<heroes.size();j++)
{
int ID;
of>>ID;
std::string path;
of>>path;
heroes[ID]->portraitSmall=CGI->bitmaph->loadBitmap(path);
if (!heroes[ID]->portraitSmall)
std::cout<<"Can't read portrait for "<<ID<<" ("<<path<<")\n";
}
of.close();
}
void CHeroHandler::loadHeroes() void CHeroHandler::loadHeroes()
{ {
int ID=0; int ID=0;
@ -143,9 +167,6 @@ void CHeroHandler::loadHeroes()
} }
loadSpecialAbilities(); loadSpecialAbilities();
//for (int i=0;i<heroes.size();i++)
//TODO: read portrait
} }
void CHeroHandler::loadSpecialAbilities() void CHeroHandler::loadSpecialAbilities()
{ {

View File

@ -58,7 +58,9 @@ public:
void loadSpecialAbilities(); void loadSpecialAbilities();
void loadBiographies(); void loadBiographies();
void loadHeroClasses(); void loadHeroClasses();
void loadPortraits();
void initHeroClasses(); void initHeroClasses();
~CHeroHandler();
}; };

View File

@ -313,6 +313,7 @@ int _tmain(int argc, _TCHAR* argv[])
cgi->abilh = abilh; cgi->abilh = abilh;
CHeroHandler * heroh = new CHeroHandler; CHeroHandler * heroh = new CHeroHandler;
heroh->loadHeroes(); heroh->loadHeroes();
heroh->loadPortraits();
cgi->heroh = heroh; cgi->heroh = heroh;
CSpellHandler * spellh = new CSpellHandler; CSpellHandler * spellh = new CSpellHandler;
spellh->loadSpells(); spellh->loadSpells();

Binary file not shown.

View File

@ -14,7 +14,8 @@ struct StartInfo
{ {
struct PlayerSettings struct PlayerSettings
{ {
int castle, hero; //ID, if -1 then random, if -2 then none int castle, hero, heroPortrait; //ID, if -1 then random, if -2 then none
std::string heroName;
Ebonus bonus; Ebonus bonus;
Ecolor color; //from 0 - Ecolor color; //from 0 -
int handicap;//0-no, 1-mild, 2-severe int handicap;//0-no, 1-mild, 2-severe

BIN
h3m.txt

Binary file not shown.

View File

@ -65,14 +65,14 @@ CMapHeader::CMapHeader(unsigned char *map)
if (this->players[pom].hasMainTown) if (this->players[pom].hasMainTown)
{ {
this->players[pom].generateHeroAtMainTown = map[i++]; this->players[pom].generateHeroAtMainTown = map[i++];
i++; //unknown byte this->players[pom].generateHero = map[i++];
this->players[pom].posOfMainTown.x = map[i++]; this->players[pom].posOfMainTown.x = map[i++];
this->players[pom].posOfMainTown.y = map[i++]; this->players[pom].posOfMainTown.y = map[i++];
this->players[pom].posOfMainTown.z = map[i++]; this->players[pom].posOfMainTown.z = map[i++];
} }
i++; //unknown byte i++; //unknown byte
int unknown = map[i++]; int customPortrait = map[i++];
if (unknown == 255) if (customPortrait == 255)
{ {
this->players[pom].mainHeroPortrait = 255; this->players[pom].mainHeroPortrait = 255;
i+=5; i+=5;
@ -83,7 +83,7 @@ CMapHeader::CMapHeader(unsigned char *map)
i+=3; i+=3;
for (int pp=0;pp<nameLength;pp++) for (int pp=0;pp<nameLength;pp++)
this->players[pom].mainHeroName+=map[i++]; this->players[pom].mainHeroName+=map[i++];
i++; ////unknown byte i++; ////heroes placeholders //domostwa
int heroCount = map[i++]; int heroCount = map[i++];
i+=3; i+=3;
for (int pp=0;pp<heroCount;pp++) for (int pp=0;pp<heroCount;pp++)

1
map.h
View File

@ -87,6 +87,7 @@ struct PlayerInfo
bool generateHeroAtMainTown; bool generateHeroAtMainTown;
Location posOfMainTown; Location posOfMainTown;
int team; int team;
bool generateHero;
}; };
struct LossCondition struct LossCondition
{ {

156
portrety.txt Normal file
View File

@ -0,0 +1,156 @@
0 HPS000KN.bmp
1 HPS001KN.bmp
2 HPS002KN.bmp
3 HPS003KN.bmp
4 HPS004KN.bmp
5 HPS005KN.bmp
6 HPS006KN.bmp
7 HPS007KN.bmp
8 HPS008CL.bmp
9 HPS009CL.bmp
10 HPS010CL.bmp
11 HPS011CL.bmp
12 HPS012CL.bmp
13 HPS013CL.bmp
14 HPS014CL.bmp
15 HPS015CL.bmp
16 HPS016RN.bmp
17 HPS017RN.bmp
18 HPS018RN.bmp
19 HPS019RN.bmp
20 HPS020RN.bmp
21 HPS021RN.bmp
22 HPS022RN.bmp
23 HPS023RN.bmp
24 HPS024DR.bmp
25 HPS025DR.bmp
26 HPS026DR.bmp
27 HPS027DR.bmp
28 HPS028DR.bmp
29 HPS029DR.bmp
30 HPS030DR.bmp
31 HPS031DR.bmp
32 HPS032AL.bmp
33 HPS033AL.bmp
34 HPS034AL.bmp
35 HPS035AL.bmp
36 HPS036AL.bmp
37 HPS037AL.bmp
38 HPS038AL.bmp
39 HPS039AL.bmp
40 HPS040WZ.bmp
41 HPS041WZ.bmp
42 HPS042WZ.bmp
43 HPS043WZ.bmp
44 HPS044WZ.bmp
45 HPS045WZ.bmp
46 HPS046WZ.bmp
47 HPS047WZ.bmp
48 HPS048HR.bmp
49 HPS049HR.bmp
50 HPS050HR.bmp
51 HPS051HR.bmp
52 HPS052HR.bmp
53 HPS053HR.bmp
54 HPS054HR.bmp
55 HPS055HR.bmp
56 HPS056DM.bmp
57 HPS057DM.bmp
58 HPS058DM.bmp
59 HPS059DM.bmp
60 HPS060DM.bmp
61 HPS061DM.bmp
62 HPS062DM.bmp
63 HPS063DM.bmp
64 HPS064DK.bmp
65 HPS065DK.bmp
66 HPS066DK.bmp
67 HPS067DK.bmp
68 HPS068DK.bmp
69 HPS069DK.bmp
70 HPS070DK.bmp
71 HPS071DK.bmp
72 HPS072NC.bmp
73 HPS073NC.bmp
74 HPS074NC.bmp
75 HPS075NC.bmp
76 HPS076NC.bmp
77 HPS077NC.bmp
78 HPS078NC.bmp
79 HPS079NC.bmp
80 HPS080OV.bmp
81 HPS081OV.bmp
82 HPS082OV.bmp
83 HPS083OV.bmp
84 HPS084OV.bmp
85 HPS085OV.bmp
86 HPS086OV.bmp
87 HPS087OV.bmp
88 HPS088WL.bmp
89 HPS089WL.bmp
90 HPS090WL.bmp
91 HPS091WL.bmp
92 HPS092WL.bmp
93 HPS093WL.bmp
94 HPS094WL.bmp
95 HPS095WL.bmp
96 HPS096BR.bmp
97 HPS097BR.bmp
98 HPS098BR.bmp
99 HPS099BR.bmp
100 HPS100BR.bmp
101 HPS101BR.bmp
102 HPS102BR.bmp
103 HPS103BR.bmp
104 HPS104BM.bmp
105 HPS105BM.bmp
106 HPS106BM.bmp
107 HPS107BM.bmp
108 HPS108BM.bmp
109 HPS109BM.bmp
110 HPS110BM.bmp
111 HPS111BM.bmp
112 HPS112BS.bmp
113 HPS113BS.bmp
114 HPS114BS.bmp
115 HPS115BS.bmp
116 HPS116BS.bmp
117 HPS117BS.bmp
118 HPS118BS.bmp
119 HPS119BS.bmp
120 HPS120WH.bmp
121 HPS121WH.bmp
122 HPS122WH.bmp
123 HPS123WH.bmp
124 HPS124WH.bmp
125 HPS125WH.bmp
126 HPS126WH.bmp
127 HPS127WH.bmp
128 HPS000PL.bmp
129 HPS001PL.bmp
130 HPS002PL.bmp
131 HPS003PL.bmp
132 HPS004PL.bmp
133 HPS005PL.bmp
134 HPS006PL.bmp
135 HPS007PL.bmp
136 HPS000EL.bmp
137 HPS001EL.bmp
138 HPS002EL.bmp
139 HPS003EL.bmp
140 HPS004EL.bmp
141 HPS005EL.bmp
142 HPS006EL.bmp
143 HPS007EL.bmp
144 HPS130KN.bmp
145 HPS000SH.bmp
146 HPS128QC.bmp
147 HPS003SH.bmp
148 HPS004SH.bmp
149 HPS005SH.bmp
150 HPS006SH.bmp
151 HPS007SH.bmp
152 HPS009SH.bmp
153 HPS008SH.bmp
154 HPS001SH.bmp
155 HPS131DM.bmp