From bbbfce798cc58762300cd46b9a03726e94b5d56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Thu, 19 Jul 2007 23:38:11 +0000 Subject: [PATCH] * 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 --- CAmbarCendamo.cpp | 2 +- CCreatureHandler.cpp | 2 +- CHeroHandler.cpp | 27 +++++++- CHeroHandler.h | 2 + CMT.cpp | 1 + CPreGame.cpp | Bin 94040 -> 95986 bytes CPreGame.h | 3 +- h3m.txt | Bin 110434 -> 110882 bytes map.cpp | 8 +-- map.h | 1 + portrety.txt | 156 +++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 192 insertions(+), 10 deletions(-) create mode 100644 portrety.txt diff --git a/CAmbarCendamo.cpp b/CAmbarCendamo.cpp index 68ef6f809..7f687a4b7 100644 --- a/CAmbarCendamo.cpp +++ b/CAmbarCendamo.cpp @@ -107,7 +107,7 @@ void CAmbarCendamo::deh3m() if (map.players[pom].hasMainTown) { 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.y = bufor[i++]; map.players[pom].posOfMainTown.z = bufor[i++]; diff --git a/CCreatureHandler.cpp b/CCreatureHandler.cpp index b549802bd..2566c24cb 100644 --- a/CCreatureHandler.cpp +++ b/CCreatureHandler.cpp @@ -22,7 +22,7 @@ void CCreatureHandler::loadCreatures() if(creatures.size()>190 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos) { loadAnimationInfo(); - loadUnitAnimations(); + //loadUnitAnimations(); break; } diff --git a/CHeroHandler.cpp b/CHeroHandler.cpp index d939d58b2..e1921b260 100644 --- a/CHeroHandler.cpp +++ b/CHeroHandler.cpp @@ -4,6 +4,30 @@ #include #define CGI (CGameInfo::mainObj) +CHeroHandler::~CHeroHandler() +{ + for (int j=0;jportraitSmall) + SDL_FreeSurface(heroes[j]->portraitSmall); + delete heroes[j]; + } +} +void CHeroHandler::loadPortraits() +{ + std::ifstream of("portrety.txt"); + for (int j=0;j>ID; + std::string path; + of>>path; + heroes[ID]->portraitSmall=CGI->bitmaph->loadBitmap(path); + if (!heroes[ID]->portraitSmall) + std::cout<<"Can't read portrait for "<abilh = abilh; CHeroHandler * heroh = new CHeroHandler; heroh->loadHeroes(); + heroh->loadPortraits(); cgi->heroh = heroh; CSpellHandler * spellh = new CSpellHandler; spellh->loadSpells(); diff --git a/CPreGame.cpp b/CPreGame.cpp index 44ea01b3e46eb1ed46b49c93aff3def32c579666..749eaee7d6adf4de840d84ae10c14b0f6f7e6a03 100644 GIT binary patch delta 784 zcmca{kM+}A)(xweCh7_B+At(Dw(~A&X#CKNlu0opg;}~mjJN>LmE&6h-b7px^+I!enoBU<2%49!Bo5`Q%gJ_eM~mF#4?RMRS(6z} zlvOntG=L7x1KO$yv@M^Z9LU!I>n{bG2J(O=gVAKiUg^mXW{Ln^D>k{I*J84rK8G>P zwR+$XDh8SWQf&uxl>tx>%m*M}Ap9ZUr#QV%laa$*1Lieg0D=M-rrj2(U6;WKrvdwW zd4;CMil`c1YEm!90BDI$$&j2}>KE>N8<%xZTG z-B1;XXn_X|Fce_U2>?2&2pE{4h|C1iaP#ER%|lZ;`Cx}CFco6D3>>19r%v=_hste! WIx#S6@+En($!rc{o6X)RH3I-Dj=PTl delta 38 wcmV+>0NMZY?FHE01+c0Dv(5rwfwNqMS^<+>8wj)Dg^mofXqh}(v(WP*gK(@8cK`qY diff --git a/CPreGame.h b/CPreGame.h index c5f55fbbe..3983db10f 100644 --- a/CPreGame.h +++ b/CPreGame.h @@ -14,7 +14,8 @@ struct StartInfo { 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; Ecolor color; //from 0 - int handicap;//0-no, 1-mild, 2-severe diff --git a/h3m.txt b/h3m.txt index e2a75d0df1a4cf1b0ed2c1f096006c2d531789e9..27ddff7cfd7d5d10d6c2628ceafdd59d06d538b1 100644 GIT binary patch delta 523 zcmYjNu}T9$5PfS*MA0gQv}>at1W^<$1&df&iG}6m?hLuR#Bi5zTu3zFCv0Vt!Y>d~ zSc#2a;0K7r#@-LmH>(j@cK7k-&CHvby_W7~rTdrc+C_{28XdUEhiLKK?%c}Z}^(@n3R5Bf`VTE<~nb(4zzGv%;<|AJ< zZ-b2>rYPkVBTfDqTk!3lu~CC4L7%Lcm9|nkfoGdJWDadc`e(z(fUzYdwo_t{H<&uZ zTjeg}l(K+Sjthz+mh$Z68pn2u9CgbD*tG3rKA$LLR*j8@EGxSTtdaSiIyBfOml*e} zdiJwP*@cWF_L?|SpBzwjG3R=}SpOTgNlr8g^D=gojk>Jhpk~ylTrMhcuIaIEtNO@| pdsV5-H{YgOT*ma%Fi+=Il}{f>CkusL?3u#&;AS#@n2go)_BY6qZomKl delta 149 zcmZ4Vi0#omwhfoc8SOVaRv5BO-cl{YsmGwepuu3kV6d69b|&NIJM|t+ll7Vm;td%L zfik*4Y{*~?WhFD@Gek3j)TaPh$qbnctc>Xlc|cl{5yVRcssqU=Fqi;w5players[pom].hasMainTown) { 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.y = map[i++]; this->players[pom].posOfMainTown.z = map[i++]; } i++; //unknown byte - int unknown = map[i++]; - if (unknown == 255) + int customPortrait = map[i++]; + if (customPortrait == 255) { this->players[pom].mainHeroPortrait = 255; i+=5; @@ -83,7 +83,7 @@ CMapHeader::CMapHeader(unsigned char *map) i+=3; for (int pp=0;ppplayers[pom].mainHeroName+=map[i++]; - i++; ////unknown byte + i++; ////heroes placeholders //domostwa int heroCount = map[i++]; i+=3; for (int pp=0;pp