mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
* added #17
* added txt file with reference names of creatures * minor changes
This commit is contained in:
parent
f1d5e686ce
commit
730b469ec6
13
CMT.cpp
13
CMT.cpp
@ -127,6 +127,19 @@ void initGameState(CGameInfo * cgi)
|
||||
if (vhi->portrait < 0)
|
||||
vhi->portrait = vhi->type->ID;
|
||||
|
||||
|
||||
CCreature * ct1 = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType2stack])]);
|
||||
int cid1 = (cgi->creh->nameToID[vhi->type->refType2stack]);
|
||||
|
||||
int cid2 = (cgi->creh->nameToID[vhi->type->refType3stack]);
|
||||
|
||||
vhi->army.slots[0].first = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType1stack])]);
|
||||
vhi->army.slots[0].second = (rand()%(vhi->type->high1stack-vhi->type->low1stack))+vhi->type->low1stack;
|
||||
vhi->army.slots[1].first = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType2stack])]);
|
||||
vhi->army.slots[1].second = (rand()%(vhi->type->high2stack-vhi->type->low2stack))+vhi->type->low2stack;
|
||||
vhi->army.slots[2].first = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType3stack])]);
|
||||
vhi->army.slots[2].second = (rand()%(vhi->type->high3stack-vhi->type->low3stack))+vhi->type->low3stack;
|
||||
|
||||
cgi->state->players[vhi->owner].heroes.push_back(vhi);
|
||||
|
||||
}
|
||||
|
216
config/crerefnam.txt
Normal file
216
config/crerefnam.txt
Normal file
@ -0,0 +1,216 @@
|
||||
0 Pikeman
|
||||
1 Halberdier
|
||||
2 LightCrossbowman
|
||||
2 Archer
|
||||
3 HeavyCrossbowman
|
||||
4 Griffin
|
||||
5 RoyalGriffin
|
||||
6 Swordsman
|
||||
7 Crusader
|
||||
8 Monk
|
||||
9 Zealot
|
||||
10 Cavalier
|
||||
11 Champion
|
||||
12 Angel
|
||||
13 Archangel
|
||||
14 Centaur
|
||||
15 EliteCentaur
|
||||
16 Dwarf
|
||||
17 BattleDwarf
|
||||
18 WoodElf
|
||||
19 GrandElf
|
||||
20 Pegasus
|
||||
21 SilverPegasus
|
||||
22 Treefolk
|
||||
23 BriarTreefolk
|
||||
24 Unicorn
|
||||
25 WarUnicorn
|
||||
26 GreenDragon
|
||||
27 GoldDragon
|
||||
28 ApprenticeGremlin
|
||||
29 MasterGremlin
|
||||
30 StoneGargoyle
|
||||
31 ObsidianGargoyle
|
||||
32 IronGolem
|
||||
33 StoneGolem
|
||||
34 Mage
|
||||
35 ArchMage
|
||||
36 Genie
|
||||
37 Caliph
|
||||
38 NagaSentinel
|
||||
39 NagaGuardian
|
||||
40 LesserTitan
|
||||
41 GreaterTitan
|
||||
42 Imp
|
||||
43 Familiar
|
||||
44 Gog
|
||||
45 Magog
|
||||
46 HellHound
|
||||
47 Cerberus
|
||||
48 Single-HornedDemon
|
||||
49 Dual-HornedDemon
|
||||
50 PitFiend
|
||||
51 PitFoe
|
||||
52 Efreet
|
||||
53 EfreetSultan
|
||||
54 Devil
|
||||
55 ArchDevil
|
||||
56 Skeleton
|
||||
57 SkeletonWarrior
|
||||
58 Zombie
|
||||
59 ZombieLord
|
||||
60 Wight
|
||||
61 Wraith
|
||||
62 Vampire
|
||||
63 Nosferatu
|
||||
64 Lich
|
||||
65 PowerLich
|
||||
66 BlackKnight
|
||||
67 BlackLord
|
||||
68 BoneDragon
|
||||
69 GhostDragon
|
||||
70 Troglodyte
|
||||
71 InfernalTroglodyte
|
||||
72 Harpy
|
||||
73 HarpyHag
|
||||
74 Beholder
|
||||
75 EvilEye
|
||||
76 Medusa
|
||||
77 MedusaQueen
|
||||
78 Minotaur
|
||||
79 MinotaurKing
|
||||
80 Manticore
|
||||
81 Scorpicore
|
||||
82 RedDragon
|
||||
83 BlackDragon
|
||||
84 Goblin
|
||||
85 Hobgoblin
|
||||
86 GoblinWolfRider
|
||||
87 HobgoblinWolfRider
|
||||
88 Orc
|
||||
89 OrcChieftain
|
||||
90 Ogre
|
||||
91 OgreMage
|
||||
92 Roc
|
||||
93 Thunderbird
|
||||
94 Cyclops
|
||||
95 CyclopsLord
|
||||
96 YoungBehemoth
|
||||
97 AncientBehemoth
|
||||
98 Gnoll
|
||||
99 GnollMarauder
|
||||
100 PrimitiveLizardman
|
||||
101 AdvancedLizardman
|
||||
102 CopperGorgon
|
||||
103 BronzeGorgon
|
||||
104 DragonFly
|
||||
105 FireDragonFly
|
||||
106 Basilisk
|
||||
107 GreaterBasilisk
|
||||
108 Wyvern
|
||||
109 WyvernMonarch
|
||||
110 Hydra
|
||||
111 ChaosHydra
|
||||
112 AirElemental
|
||||
113 EarthElemental
|
||||
114 FireElemental
|
||||
115 WaterElemental
|
||||
116 GoldGolem
|
||||
117 DiamondGolem
|
||||
118 Pixie
|
||||
119 Sprite
|
||||
120 PsiElemental
|
||||
121 MagicElemental
|
||||
122 NOTUSED
|
||||
123 IceElemental
|
||||
124 NOTUSED
|
||||
125 StoneElemental
|
||||
126 ElectricityElemental
|
||||
127 StormElemental
|
||||
128 FireElemental
|
||||
129 FireElemental
|
||||
130 Firebird
|
||||
131 Pheonix
|
||||
132 AzureDragon
|
||||
133 CrystalDragon
|
||||
134 FairieDragon
|
||||
135 RustDragon
|
||||
136 Enchanter
|
||||
137 Sharpshooter
|
||||
138 Halfling
|
||||
139 Peasant
|
||||
140 Boar
|
||||
141 Mummy
|
||||
142 warrior
|
||||
143 Rogue
|
||||
144 OgreShaman
|
||||
145 Catapult
|
||||
146 Ballista
|
||||
147 First-AidTent
|
||||
148 AmmoCart
|
||||
149 ArrowTower
|
||||
150 SupremeArchangel
|
||||
151 DiamondDragon
|
||||
152 LordofThunder
|
||||
153 HellBaron
|
||||
154 BloodDragon
|
||||
155 DarknessDragon
|
||||
156 GhostBehemoth
|
||||
157 HellHydra
|
||||
158 SacredPhoenix
|
||||
159 Ghost
|
||||
160 God1War
|
||||
161 God2Peace
|
||||
162 God3Mana
|
||||
163 God4Lore
|
||||
164 MinotaurKing
|
||||
165 MineralElemental
|
||||
166 ElectricityElemental
|
||||
167 AncientBasilisk
|
||||
168 Gorynych
|
||||
169 WarZealot
|
||||
170 Myriad
|
||||
171 MedusaMatriarch
|
||||
172 Nightmare
|
||||
173 SantaGremlin
|
||||
174 Paladin1
|
||||
175 Hierophant1
|
||||
176 TempleGuardian1
|
||||
177 Succubus1
|
||||
178 SoulEater1
|
||||
179 Brute1
|
||||
180 OgreLeader1
|
||||
181 Shaman1
|
||||
182 AstralSpirit1
|
||||
183 Paladin2
|
||||
184 Hierophant2
|
||||
185 TempleGuardian2
|
||||
186 Succubus2
|
||||
187 SoulEater2
|
||||
188 Brute2
|
||||
189 OgreLeader2
|
||||
190 Shaman2
|
||||
191 AstralSpirit2
|
||||
192 SylvanCentaur
|
||||
193 Sorceress
|
||||
194 Werewolf
|
||||
195 HellSteed
|
||||
196 Dracolich
|
||||
197
|
||||
198
|
||||
199
|
||||
200
|
||||
201
|
||||
202
|
||||
203
|
||||
204
|
||||
205
|
||||
206
|
||||
207
|
||||
208
|
||||
209
|
||||
210
|
||||
999 999 999 999
|
||||
|
||||
FORMAT:
|
||||
ID Reference_name
|
@ -2,7 +2,10 @@
|
||||
#include "../CGameInfo.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include "CLodHandler.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/assign/std/vector.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
void CCreatureHandler::loadCreatures()
|
||||
{
|
||||
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("ZCRTRAIT.TXT");
|
||||
@ -20,12 +23,12 @@ void CCreatureHandler::loadCreatures()
|
||||
|
||||
while(i<buf.size())
|
||||
{
|
||||
if(creatures.size()>190 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos)
|
||||
{
|
||||
loadAnimationInfo();
|
||||
//loadUnitAnimations();
|
||||
break;
|
||||
}
|
||||
//if(creatures.size()>190 && buf.substr(i, buf.size()-i).find('\r')==std::string::npos)
|
||||
//{
|
||||
// loadAnimationInfo();
|
||||
// loadUnitAnimations();
|
||||
// break;
|
||||
//}
|
||||
|
||||
CCreature ncre;
|
||||
|
||||
@ -270,26 +273,39 @@ void CCreatureHandler::loadCreatures()
|
||||
ncre.indefUpgraded = true;
|
||||
creatures.push_back(ncre);
|
||||
}
|
||||
|
||||
std::ifstream ifs("config/crerefnam.txt");
|
||||
int tempi;
|
||||
std::string temps;
|
||||
for (;;)
|
||||
{
|
||||
ifs >> tempi >> temps;
|
||||
if (tempi>=creatures.size())
|
||||
break;
|
||||
boost::assign::insert(nameToID)(temps,tempi);
|
||||
creatures[tempi].nameRef=temps;
|
||||
}
|
||||
ifs.close();
|
||||
}
|
||||
|
||||
void CCreatureHandler::loadAnimationInfo()
|
||||
{
|
||||
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("CRANIM.TXT");
|
||||
int andame = buf.size();
|
||||
int i=0; //buf iterator
|
||||
int hmcr=0;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
++hmcr;
|
||||
if(hmcr==2)
|
||||
break;
|
||||
}
|
||||
i+=2;
|
||||
for(int dd=0; dd<creatures.size(); ++dd)
|
||||
{
|
||||
loadUnitAnimInfo(creatures[dd], buf, i);
|
||||
}
|
||||
//std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("CRANIM.TXT");
|
||||
//int andame = buf.size();
|
||||
//int i=0; //buf iterator
|
||||
//hmcr=0;
|
||||
//for(i; i<andame; ++i)
|
||||
//{
|
||||
// if(buf[i]=='\r')
|
||||
// ++hmcr;
|
||||
// if(hmcr==2)
|
||||
// break;
|
||||
//}
|
||||
//i+=2;
|
||||
//for(int dd=0; dd<creatures.size(); ++dd)
|
||||
//{
|
||||
// loadUnitAnimInfo(creatures[dd], buf, i);
|
||||
//}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
class CCreature
|
||||
{
|
||||
public:
|
||||
std::string namePl, nameSing; //name in singular and plural form
|
||||
std::string namePl, nameSing, nameRef; //name in singular and plural form; and reference name
|
||||
int wood, mercury, ore, sulfur, crystal, gems, gold, fightValue, AIValue, growth, hordeGrowth, hitPoints, speed, attack, defence, shots, spells;
|
||||
int low1, low2, high1, high2; //TODO - co to w ogóle jest???
|
||||
std::string abilityText; //description of abilities
|
||||
@ -45,6 +45,7 @@ class CCreatureHandler
|
||||
{
|
||||
public:
|
||||
std::vector<CCreature> creatures;
|
||||
std::map<std::string,int> nameToID;
|
||||
void loadCreatures();
|
||||
void loadAnimationInfo();
|
||||
void loadUnitAnimInfo(CCreature & unit, std::string & src, int & i);
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
advDate, advWorldMap, advStatusWindow1;
|
||||
|
||||
void loadTexts();
|
||||
void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, dest to tab, dump to eol //mode 1 - dump to tab, src to eol //mode 2 - copy to tab, dump to eol //mode 3 - copy to eol //mode 4 - copy to tab
|
||||
static void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, dest to tab, dump to eol //mode 1 - dump to tab, src to eol //mode 2 - copy to tab, dump to eol //mode 3 - copy to eol //mode 4 - copy to tab
|
||||
void loadVictoryConditions();
|
||||
void loadLossConditions();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user