mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
loading unit's battle animations; requires CREDEFS.TXT
This commit is contained in:
parent
cc67967051
commit
66ba3d0eab
@ -22,6 +22,7 @@ void CCreatureHandler::loadCreatures()
|
||||
if(creatures.size()>190 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos)
|
||||
{
|
||||
loadAnimationInfo();
|
||||
loadUnitAnimations();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -442,3 +443,50 @@ void CCreatureHandler::loadUnitAnimInfo(CCreature & unit, std::string & src, int
|
||||
}
|
||||
i+=2;
|
||||
}
|
||||
|
||||
void CCreatureHandler::loadUnitAnimations()
|
||||
{
|
||||
std::ifstream inp("CREDEFS.TXT", std::ios::in | std::ios::binary);
|
||||
inp.seekg(0,std::ios::end); // na koniec
|
||||
int andame = inp.tellg(); // read length
|
||||
inp.seekg(0,std::ios::beg); // wracamy na poczatek
|
||||
char * bufor = new char[andame]; // allocate memory
|
||||
inp.read((char*)bufor, andame); // read map file to buffer
|
||||
inp.close();
|
||||
std::string buf = std::string(bufor);
|
||||
delete [andame] bufor;
|
||||
|
||||
int i = 0; //buf iterator
|
||||
int hmcr = 0;
|
||||
for(i; i<andame; ++i) //omitting rubbish
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
i+=2;
|
||||
for(int s=0; s<creatures.size(); ++s)
|
||||
{
|
||||
int befi=i;
|
||||
std::string rub;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]==' ')
|
||||
break;
|
||||
}
|
||||
rub = buf.substr(befi, i-befi);
|
||||
++i;
|
||||
|
||||
befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
std::string defName = buf.substr(befi, i-befi);
|
||||
if(defName != std::string("x"))
|
||||
creatures[s].battleAnimation = CGameInfo::mainObj->spriteh->giveDef(defName);
|
||||
else
|
||||
creatures[s].battleAnimation = NULL;
|
||||
i+=2;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "CDefHandler.h"
|
||||
|
||||
class CCreature
|
||||
{
|
||||
@ -26,7 +27,7 @@ public:
|
||||
int indefLevel; //only if indefinite
|
||||
bool indefUpgraded; //onlu if inddefinite
|
||||
//end
|
||||
|
||||
CDefHandler * battleAnimation;
|
||||
//TODO - zdolnoœci - na typie wyliczeniowym czy czymœ
|
||||
};
|
||||
|
||||
@ -45,6 +46,7 @@ public:
|
||||
void loadCreatures();
|
||||
void loadAnimationInfo();
|
||||
void loadUnitAnimInfo(CCreature & unit, std::string & src, int & i);
|
||||
void loadUnitAnimations();
|
||||
};
|
||||
|
||||
#endif //CCREATUREHANDLER_H
|
198
CREDEFS.TXT
Normal file
198
CREDEFS.TXT
Normal file
@ -0,0 +1,198 @@
|
||||
Names_of_Units_DEFS_in_order_of_ID
|
||||
0 CPKMAN.DEF
|
||||
1 CHALBD.DEF
|
||||
2 CLCBOW.DEF
|
||||
3 CHCBOW.DEF
|
||||
4 CGRIFF.DEF
|
||||
5 CRGRIF.DEF
|
||||
6 CSWORD.DEF
|
||||
7 CCRUSD.DEF
|
||||
8 CMONKK.DEF
|
||||
9 CZEALT.DEF
|
||||
10 CCAVLR.DEF
|
||||
11 CCHAMP.DEF
|
||||
12 CANGEL.DEF
|
||||
13 CRANGL.DEF
|
||||
14 CCENTR.DEF
|
||||
15 CECENT.DEF
|
||||
16 CDWARF.DEF
|
||||
17 CBDWAR.DEF
|
||||
18 CELF.DEF
|
||||
19 CGELF.DEF
|
||||
20 CPEGAS.DEF
|
||||
21 CAPEGS.DEF
|
||||
22 CTREE.DEF
|
||||
23 CBTREE.DEF
|
||||
24 CUNICO.DEF
|
||||
25 CWUNIC.DEF
|
||||
26 CGDRAG.DEF
|
||||
27 CDDRAG.DEF
|
||||
28 CGREMA.DEF
|
||||
29 CGREMM.DEF
|
||||
30 CGARGO.DEF
|
||||
31 COGARG.DEF
|
||||
32 CSGOLE.DEF
|
||||
33 CIGOLE.DEF
|
||||
34 CMAGE.DEF
|
||||
35 CAMAGE.DEF
|
||||
36 CGENIE.DEF
|
||||
37 CSULTA.DEF
|
||||
38 CNAGA.DEF
|
||||
39 CNAGAG.DEF
|
||||
40 CLTITA.DEF
|
||||
41 CGTITA.DEF
|
||||
42 CIMP.DEF
|
||||
43 CFAMIL.DEF
|
||||
44 CGOG.DEF
|
||||
45 CMAGOG.DEF
|
||||
46 CHHOUN.DEF
|
||||
47 CCERBU.DEF
|
||||
48 COHDEM.DEF
|
||||
49 CTHDEM.DEF
|
||||
50 CPFIEN.DEF
|
||||
51 CPFOE.DEF
|
||||
52 CEFREE.DEF
|
||||
53 CEFRES.DEF
|
||||
54 CDEFIL.DEF
|
||||
55 CADEVL.DEF
|
||||
56 CSKELE.DEF
|
||||
57 CWSKEL.DEF
|
||||
58 CZOMBI.DEF
|
||||
59 CZOMLO.DEF
|
||||
60 CWIGHT.DEF
|
||||
61 CWRAIT.DEF
|
||||
62 CVAMP.DEF
|
||||
63 CNOSFE.DEF
|
||||
64 CLICH.DEF
|
||||
65 CPLICH.DEF
|
||||
66 CBKNIG.DEF
|
||||
67 CBLORD.DEF
|
||||
68 CNDRGN.DEF
|
||||
69 CHDRGN.DEF
|
||||
70 CTROGL.DEF
|
||||
71 CITROG.DEF
|
||||
72 CHARPY.DEF
|
||||
73 CHARPH.DEF
|
||||
74 CBEHOL.DEF
|
||||
75 CEVEYE.DEF
|
||||
76 CMEDUS.DEF
|
||||
77 CEMDUQ.DEF
|
||||
78 CMINOT.DEF
|
||||
79 CMINOK.DEF
|
||||
80 CMCORE.DEF
|
||||
81 CCMCOR.DEF
|
||||
82 CRDRGN.DEF
|
||||
83 CBDRGN.DEF
|
||||
84 CGOBLI.DEF
|
||||
85 CHGOBL.DEF
|
||||
86 CBWLFR.DEF
|
||||
87 CUWLFR.DFE
|
||||
88 CORC.DEF
|
||||
89 CORCCH.DEF
|
||||
90 COGRE.DEF
|
||||
91 COGMAG.DEF
|
||||
92 CROC.DEF
|
||||
93 CTBIRD.DEF
|
||||
94 CCYCLR.DEF
|
||||
95 CCYCLLOR.DEF
|
||||
96 CYBEHE.DEF
|
||||
97 CABEHE.DEF
|
||||
98 CGNOLL.DEF
|
||||
99 CGNOLM.DEF
|
||||
100 CPLIZA.DEF
|
||||
101 CALIZA.DEF
|
||||
102 CCGORG.DEF
|
||||
103 CBGOG.DEF
|
||||
104 CDRFLY.DEF
|
||||
105 CDRFIR.DEF
|
||||
106 CBASIL.DEF
|
||||
107 CGBASI.DEF
|
||||
108 CWYVER.DEF
|
||||
109 CWYVMN.DEF
|
||||
110 CHYDRA.DEF
|
||||
111 CCHYDR.DEF
|
||||
112 CAELEM.DEF
|
||||
113 CEELEM.DEF
|
||||
114 CFELEM.DEF
|
||||
115 CWELEM.DEF
|
||||
116 CGGOLE.DEF
|
||||
117 CDGOLE.DEF
|
||||
118 CPIXIE.DEF
|
||||
119 CSPRITE.DEF
|
||||
120 CPSYEL.DEF
|
||||
121 CMAGEL.DEF
|
||||
122 x
|
||||
123 CICEE.DEF
|
||||
124 x
|
||||
125 CSTONE.DEF
|
||||
126 x
|
||||
127 CSTORM.DEF
|
||||
128 x
|
||||
129 CNRG.DEF
|
||||
130 CFBIRD.DEF
|
||||
131 CPHX.DEF
|
||||
132 CADRGN.DEF
|
||||
133 CCDRGN.DEF
|
||||
134 CFDRGN.DEF
|
||||
135 CRSDGN.DEF
|
||||
136 CENCH.DEF
|
||||
137 CSHARP.DEF
|
||||
138 CHALF.DEF
|
||||
139 CPEAS.DEF
|
||||
140 CBOAR.DEF
|
||||
141 CMUMMY.DEF
|
||||
142 CNOMAD.DEF
|
||||
143 CROGUE.DEF
|
||||
144 CTROLL.DEF
|
||||
145 SMCATA.DEF
|
||||
146 SMBAL.DEF
|
||||
147 SMTENT.DEF
|
||||
148 SMCART.DEF
|
||||
149 x
|
||||
150 ZM150Z.DEF
|
||||
151 ZM151Z.DEF
|
||||
152 ZM152Z.DEF
|
||||
153 ZM153Z.DEF
|
||||
154 ZM154Z.DEF
|
||||
155 ZM155Z.DEF
|
||||
156 ZM156Z.DEF
|
||||
157 ZM157Z.DEF
|
||||
158 ZM158Z.DEF
|
||||
159 ZM159G.DEF
|
||||
160 ZM160G.DEF
|
||||
161 ZM161G.DEF
|
||||
162 ZM162G.DEF
|
||||
163 ZM163G.DEF
|
||||
164 ZM164GD.DEF
|
||||
165 ZM165GD.DEF
|
||||
166 ZM166GD.DEF
|
||||
167 ZM167GD.DEF
|
||||
168 ZM168GD.DEF
|
||||
169 ZM169ZL.DEF
|
||||
170 ZM170SW.DEF
|
||||
171 ZM171SR.DEF
|
||||
172 ZM172N.DEF
|
||||
173 ZM173M.DEF
|
||||
174 ZM174NPC.DEF
|
||||
175 ZM175NPC.DEF
|
||||
176 ZM176NPC.DEF
|
||||
177 ZM177NPC.DEF
|
||||
178 ZM178NPC.DEF
|
||||
179 ZM179NPC.DEF
|
||||
180 ZM180NPC.DEF
|
||||
181 ZM181NPC.DEF
|
||||
182 ZM182NPC.DEF
|
||||
183 ZM174NPC.DEF
|
||||
184 ZM175NPC.DEF
|
||||
185 ZM176NPC.DEF
|
||||
186 ZM177NPC.DEF
|
||||
187 ZM178NPC.DEF
|
||||
188 ZM179NPC.DEF
|
||||
189 ZM180NPC.DEF
|
||||
190 ZM181NPC.DEF
|
||||
191 ZM182NPC.DEF
|
||||
192 ZM192Z.DEF
|
||||
193 ZM193Z.DEF
|
||||
194 ZM194Z.DEF
|
||||
195 ZM195Z.DEF
|
||||
196 ZM196Z.DEF
|
Loading…
Reference in New Issue
Block a user