mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	More changes for splitting
This commit is contained in:
		| @@ -127,7 +127,7 @@ void CMinimap::draw() | ||||
| } | ||||
| void CMinimap::redraw(int level)// (level==-1) => redraw all levels | ||||
| { | ||||
| 	(CGameInfo::mainObj); | ||||
| 	(CGI); | ||||
| 	for (int i=0; i<CGI->mh->sizes.z; i++) | ||||
| 	{ | ||||
| 		SDL_Surface * pom ; | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #include "stdafx.h" | ||||
| #include "CGameInfo.h" | ||||
|  | ||||
| CGameInfo * CGameInfo::mainObj; | ||||
| CGameInfo * CGI; | ||||
| @@ -39,7 +39,6 @@ class CDefHandler; | ||||
| class CGameInfo | ||||
| { | ||||
| public: | ||||
| 	static CGameInfo * mainObj; //pointer to main CGameInfo object | ||||
| 	CGameState * state; | ||||
| 	CArtHandler * arth; | ||||
| 	CHeroHandler * heroh; | ||||
|   | ||||
							
								
								
									
										12
									
								
								CMT.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								CMT.cpp
									
									
									
									
									
								
							| @@ -58,11 +58,10 @@ | ||||
| #  define SET_BINARY_MODE(file) | ||||
| #endif | ||||
| #ifdef _DEBUG | ||||
| CGameInfo* CGI; | ||||
| #endif | ||||
| #define CHUNK 16384 | ||||
| const char * NAME = "VCMI \"Altanatse\" 0.7"; | ||||
|  | ||||
| DLL_EXPORT void initDLL(CLodHandler *b); | ||||
| SDL_Color playerColorPalette[256]; //palette to make interface colors good | ||||
|  | ||||
| SDL_Surface * screen, * screen2; | ||||
| @@ -381,11 +380,7 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
| 		//screen = SDL_ConvertSurface(screen2, screen2->format, SDL_SWSURFACE); | ||||
|  | ||||
| 		SDL_WM_SetCaption(NAME,""); //set window title | ||||
| 		CGameInfo * cgi = new CGameInfo; //contains all global informations about game (texts, lodHandlers, map handler itp.) | ||||
| 		CGameInfo::mainObj = cgi;		 | ||||
| 		#ifdef _DEBUG | ||||
| 		CGI = cgi; | ||||
| 		#endif | ||||
| 		CGameInfo * cgi = CGI = new CGameInfo; //contains all global informations about game (texts, lodHandlers, map handler itp.) | ||||
| 		cgi->consoleh = new CConsoleHandler; | ||||
| 		cgi->mush = mush; | ||||
| 		cgi->curh = new CCursorHandler;  | ||||
| @@ -395,6 +390,7 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
| 		cgi->spriteh->init(std::string("Data\\H3sprite.lod")); | ||||
| 		BitmapHandler::bitmaph = cgi->bitmaph = new CLodHandler; | ||||
| 		cgi->bitmaph->init(std::string("Data\\H3bitmap.lod")); | ||||
| 		initDLL(cgi->bitmaph); | ||||
| 		THC std::cout<<"Loading .lod files: "<<tmh.getDif()<<std::endl; | ||||
|  | ||||
| 		boost::filesystem::directory_iterator enddir; | ||||
| @@ -504,7 +500,7 @@ int _tmain(int argc, _TCHAR* argv[]) | ||||
| 		cgi->arth = arth; | ||||
| 		THC std::cout<<"\tArtifact handler: "<<pomtime.getDif()<<std::endl; | ||||
|  | ||||
| 		CCreatureHandler * creh = new CCreatureHandler(cgi->bitmaph); | ||||
| 		CCreatureHandler * creh = new CCreatureHandler(); | ||||
| 		creh->loadCreatures(); | ||||
| 		cgi->creh = creh; | ||||
| 		THC std::cout<<"\tCreature handler: "<<pomtime.getDif()<<std::endl; | ||||
|   | ||||
| @@ -742,9 +742,9 @@ void CSDL_Ext::blueToPlayers(SDL_Surface * sur, int player) | ||||
| 			SDL_Color * cc = sur->format->palette->colors+i; | ||||
| 			if(cc->r==0 && cc->g==0 && cc->b==255) | ||||
| 			{ | ||||
| 				cc->r = CGameInfo::mainObj->playerColors[player].r; | ||||
| 				cc->g = CGameInfo::mainObj->playerColors[player].g; | ||||
| 				cc->b = CGameInfo::mainObj->playerColors[player].b; | ||||
| 				cc->r = CGI->playerColors[player].r; | ||||
| 				cc->g = CGI->playerColors[player].g; | ||||
| 				cc->b = CGI->playerColors[player].b; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -759,9 +759,9 @@ void CSDL_Ext::blueToPlayers(SDL_Surface * sur, int player) | ||||
| 				{ | ||||
| 					if(cp[0]==0 && cp[1]==0 && cp[2]==255) | ||||
| 					{ | ||||
| 						cp[0] = CGameInfo::mainObj->playerColors[player].r; | ||||
| 						cp[1] = CGameInfo::mainObj->playerColors[player].g; | ||||
| 						cp[2] = CGameInfo::mainObj->playerColors[player].b; | ||||
| 						cp[0] = CGI->playerColors[player].r; | ||||
| 						cp[1] = CGI->playerColors[player].g; | ||||
| 						cp[2] = CGI->playerColors[player].b; | ||||
| 					} | ||||
| 				} | ||||
| 				else | ||||
| @@ -769,9 +769,9 @@ void CSDL_Ext::blueToPlayers(SDL_Surface * sur, int player) | ||||
| 					 | ||||
| 					if(cp[0]==255 && cp[1]==0 && cp[2]==0) | ||||
| 					{ | ||||
| 						cp[0] = CGameInfo::mainObj->playerColors[player].b; | ||||
| 						cp[1] = CGameInfo::mainObj->playerColors[player].g; | ||||
| 						cp[2] = CGameInfo::mainObj->playerColors[player].r; | ||||
| 						cp[0] = CGI->playerColors[player].b; | ||||
| 						cp[1] = CGI->playerColors[player].g; | ||||
| 						cp[2] = CGI->playerColors[player].r; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| @@ -806,9 +806,9 @@ void CSDL_Ext::blueToPlayersAdv(SDL_Surface * sur, int player, int mode, void* a | ||||
| 						sort1.push_back(cp[1]); | ||||
| 						sort1.push_back(cp[2]); | ||||
| 						std::vector< std::pair<long long int, Uint8*> > sort2; | ||||
| 						sort2.push_back(std::make_pair(CGameInfo::mainObj->playerColors[player].r, &(cp[0]))); | ||||
| 						sort2.push_back(std::make_pair(CGameInfo::mainObj->playerColors[player].g, &(cp[1]))); | ||||
| 						sort2.push_back(std::make_pair(CGameInfo::mainObj->playerColors[player].b, &(cp[2]))); | ||||
| 						sort2.push_back(std::make_pair(CGI->playerColors[player].r, &(cp[0]))); | ||||
| 						sort2.push_back(std::make_pair(CGI->playerColors[player].g, &(cp[1]))); | ||||
| 						sort2.push_back(std::make_pair(CGI->playerColors[player].b, &(cp[2]))); | ||||
| 						std::sort(sort1.begin(), sort1.end()); | ||||
| 						if(sort2[0].first>sort2[1].first) | ||||
| 							std::swap(sort2[0], sort2[1]); | ||||
| @@ -834,9 +834,9 @@ void CSDL_Ext::blueToPlayersAdv(SDL_Surface * sur, int player, int mode, void* a | ||||
| 						sort1.push_back(cp[1]); | ||||
| 						sort1.push_back(cp[0]); | ||||
| 						std::vector< std::pair<long long int, Uint8*> > sort2; | ||||
| 						sort2.push_back(std::make_pair(CGameInfo::mainObj->playerColors[player].r, &(cp[2]))); | ||||
| 						sort2.push_back(std::make_pair(CGameInfo::mainObj->playerColors[player].g, &(cp[1]))); | ||||
| 						sort2.push_back(std::make_pair(CGameInfo::mainObj->playerColors[player].b, &(cp[0]))); | ||||
| 						sort2.push_back(std::make_pair(CGI->playerColors[player].r, &(cp[2]))); | ||||
| 						sort2.push_back(std::make_pair(CGI->playerColors[player].g, &(cp[1]))); | ||||
| 						sort2.push_back(std::make_pair(CGI->playerColors[player].b, &(cp[0]))); | ||||
| 						std::sort(sort1.begin(), sort1.end()); | ||||
| 						if(sort2[0].first>sort2[1].first) | ||||
| 							std::swap(sort2[0], sort2[1]); | ||||
| @@ -874,9 +874,9 @@ void CSDL_Ext::setPlayerColor(SDL_Surface * sur, unsigned char player) | ||||
| 	if(sur->format->BitsPerPixel==8) | ||||
| 	{ | ||||
| 		if(player != 255)  | ||||
| 			*(sur->format->palette->colors+5) = CGameInfo::mainObj->playerColors[player]; | ||||
| 			*(sur->format->palette->colors+5) = CGI->playerColors[player]; | ||||
| 		else | ||||
| 			*(sur->format->palette->colors+5) = CGameInfo::mainObj->neutralColor; | ||||
| 			*(sur->format->palette->colors+5) = CGI->neutralColor; | ||||
| 	} | ||||
| } | ||||
| int readNormalNr (std::istream &in, int bytCon) | ||||
|   | ||||
							
								
								
									
										8
									
								
								global.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								global.h
									
									
									
									
									
								
							| @@ -21,14 +21,10 @@ enum ElossCon {lossCastle, lossHero, timeExpires, lossStandard=255}; | ||||
| enum EHeroClasses {HERO_KNIGHT, HERO_CLERIC, HERO_RANGER, HERO_DRUID, HERO_ALCHEMIST, HERO_WIZARD,  | ||||
| 	HERO_DEMONIAC, HERO_HERETIC, HERO_DEATHKNIGHT, HERO_NECROMANCER, HERO_WARLOCK, HERO_OVERLORD,  | ||||
| 	HERO_BARBARIAN, HERO_BATTLEMAGE, HERO_BEASTMASTER, HERO_WITCH, HERO_PLANESWALKER, HERO_ELEMENTALIST}; | ||||
| #ifdef _DEBUG | ||||
| class CGameInfo; | ||||
| extern CGameInfo* CGI; | ||||
| #else | ||||
| #define CGI (CGameInfo::mainObj) | ||||
| #endif | ||||
| #define CURPLINT (((CPlayerInterface*)((CGameInfo::mainObj)->playerint[(CGameInfo::mainObj)->state->currentPlayer])))  | ||||
| #define LOCPLINT (((CPlayerInterface*)((CGameInfo::mainObj)->playerint[(CGameInfo::mainObj)->localPlayer])))  | ||||
| #define CURPLINT (((CPlayerInterface*)((CGI)->playerint[(CGI)->state->currentPlayer])))  | ||||
| #define LOCPLINT (((CPlayerInterface*)((CGI)->playerint[(CGI)->localPlayer])))  | ||||
| //CURPLINT gives pointer to the interface of human player which is currently making turn,  | ||||
| //LOCPLINT gives pointer to the interface which is currently showed (on this machine) | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|  | ||||
| void CAbilityHandler::loadAbilities() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("SSTRAITS.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("SSTRAITS.TXT"); | ||||
| 	int it=0; | ||||
| 	std::string dump; | ||||
| 	for(int i=0; i<2; ++i) | ||||
| @@ -28,7 +28,7 @@ void CAbilityHandler::loadAbilities() | ||||
| 	abils44 = CDefHandler::giveDef("SECSKILL.DEF"); | ||||
| 	abils82 = CDefHandler::giveDef("SECSK82.DEF"); | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("SKILLLEV.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("SKILLLEV.TXT"); | ||||
| 	it=0; | ||||
| 	for(int i=0; i<6; ++i) | ||||
| 	{ | ||||
|   | ||||
| @@ -1103,7 +1103,7 @@ void CAmbarCendamo::deh3m() | ||||
| 							{ | ||||
| 								int creType = readNormalNr(i, 2); i+=2; | ||||
| 								int creNumb = readNormalNr(i, 2); i+=2; | ||||
| 								spec->m6cre.push_back(&(CGameInfo::mainObj->creh->creatures[creType])); | ||||
| 								spec->m6cre.push_back(&(CGI->creh->creatures[creType])); | ||||
| 								spec->m6number.push_back(creNumb); | ||||
| 							} | ||||
| 							int limit = readNormalNr(i); i+=4; | ||||
| @@ -1835,7 +1835,7 @@ void CAmbarCendamo::deh3m() | ||||
| 						{ | ||||
| 							int creType = readNormalNr(i, 2); i+=2; | ||||
| 							int creNumb = readNormalNr(i, 2); i+=2; | ||||
| 							spec->m6cre.push_back(&(CGameInfo::mainObj->creh->creatures[creType])); | ||||
| 							spec->m6cre.push_back(&(CGI->creh->creatures[creType])); | ||||
| 							spec->m6number.push_back(creNumb); | ||||
| 						} | ||||
| 						int limit = readNormalNr(i); i+=4; | ||||
| @@ -2064,8 +2064,8 @@ CCreatureSet CAmbarCendamo::readCreatureSet(int number) | ||||
| 			int rettt = readNormalNr(i+ir*4, 2); | ||||
| 			if(rettt==0xffff) continue; | ||||
| 			if(rettt>32768) | ||||
| 				rettt = 65536-rettt+CGameInfo::mainObj->creh->creatures.size()-16; | ||||
| 			ins.first = &(CGameInfo::mainObj->creh->creatures[rettt]); | ||||
| 				rettt = 65536-rettt+CGI->creh->creatures.size()-16; | ||||
| 			ins.first = &(CGI->creh->creatures[rettt]); | ||||
| 			ins.second = readNormalNr(i+ir*4+2, 2); | ||||
| 			std::pair<int,std::pair<CCreature *, int> > tt(ir,ins); | ||||
| 			ret.slots.insert(tt); | ||||
| @@ -2082,8 +2082,8 @@ CCreatureSet CAmbarCendamo::readCreatureSet(int number) | ||||
| 			int rettt = readNormalNr(i+ir*3, 1); | ||||
| 			if(rettt==0xff) continue; | ||||
| 			if(rettt>220) | ||||
| 				rettt = 256-rettt+CGameInfo::mainObj->creh->creatures.size()-16; | ||||
| 			ins.first = &(CGameInfo::mainObj->creh->creatures[rettt]); | ||||
| 				rettt = 256-rettt+CGI->creh->creatures.size()-16; | ||||
| 			ins.first = &(CGI->creh->creatures[rettt]); | ||||
| 			ins.second = readNormalNr(i+ir*3+1, 2); | ||||
| 			std::pair<int,std::pair<CCreature *, int> > tt(ir,ins); | ||||
| 			ret.slots.insert(tt); | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| void CArtHandler::loadArtifacts() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("ARTRAITS.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("ARTRAITS.TXT"); | ||||
| 	int it=0; | ||||
| 	std::string dump; | ||||
| 	for(int i=0; i<2; ++i) | ||||
|   | ||||
| @@ -34,7 +34,7 @@ CBuilding * readBg(std::string &buf, unsigned int& it) | ||||
| } | ||||
| void CBuildingHandler::loadBuildings() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("BUILDING.TXT"), temp; | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("BUILDING.TXT"), temp; | ||||
| 	unsigned int andame = buf.size(), it=0; //buf iterator | ||||
|  | ||||
| 	temp = readTo(buf,it,'\n');temp = readTo(buf,it,'\n');//read 2 lines of file info | ||||
| @@ -75,7 +75,7 @@ void CBuildingHandler::loadBuildings() | ||||
| 	} | ||||
| 	/////done reading BUILDING.TXT***************************** | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("BLDGNEUT.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("BLDGNEUT.TXT"); | ||||
| 	andame = buf.size(), it=0; | ||||
|  | ||||
| 	for(int b=0;b<15;b++) | ||||
| @@ -105,7 +105,7 @@ void CBuildingHandler::loadBuildings() | ||||
| 	} | ||||
| 	/////done reading "BLDGNEUT.TXT"****************************** | ||||
| 	 | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("BLDGSPEC.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("BLDGSPEC.TXT"); | ||||
| 	andame = buf.size(), it=0; | ||||
| 	for(int f=0;f<F_NUMBER;f++) | ||||
| 	{ | ||||
| @@ -122,7 +122,7 @@ void CBuildingHandler::loadBuildings() | ||||
| 	} | ||||
| 	/////done reading BLDGSPEC.TXT********************************* | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("DWELLING.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("DWELLING.TXT"); | ||||
| 	andame = buf.size(), it=0; | ||||
| 	for(int f=0;f<F_NUMBER;f++) | ||||
| 	{ | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| #define VCMI_DLL | ||||
| #include "../stdafx.h" | ||||
| #include "CCreatureHandler.h" | ||||
| #include "CLodHandler.h" | ||||
| @@ -6,7 +7,7 @@ | ||||
| #include <boost/algorithm/string.hpp> | ||||
| #include <boost/algorithm/string/find.hpp> | ||||
| #include <boost/algorithm/string/replace.hpp> | ||||
|  | ||||
| extern CLodHandler * bitmaph; | ||||
| int CCreature::getQuantityID(int quantity) | ||||
| { | ||||
| 	if (quantity<5) | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| #ifndef CCREATUREHANDLER_H | ||||
| #define CCREATUREHANDLER_H | ||||
|  | ||||
| #include "../global.h" | ||||
| #include <string> | ||||
| #include <vector> | ||||
| #include <map> | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
| class CLodHandler; | ||||
|  | ||||
| class CCreature | ||||
| class DLL_EXPORT CCreature | ||||
| { | ||||
| public: | ||||
| 	std::string namePl, nameSing, nameRef; //name in singular and plural form; and reference name | ||||
| @@ -52,9 +52,8 @@ public: | ||||
| 	bool formation; //false - wide, true - tight | ||||
| }; | ||||
|  | ||||
| class CCreatureHandler | ||||
| class DLL_EXPORT CCreatureHandler | ||||
| { | ||||
| 	CLodHandler * bitmaph; | ||||
| public: | ||||
| 	std::vector<CCreature> creatures; //creature ID -> creature info | ||||
| 	std::map<int,std::vector<CCreature*> > levelCreatures; //level -> list of creatures | ||||
| @@ -62,6 +61,6 @@ public: | ||||
| 	void loadCreatures(); | ||||
| 	void loadAnimationInfo(); | ||||
| 	void loadUnitAnimInfo(CCreature & unit, std::string & src, int & i); | ||||
| 	CCreatureHandler(CLodHandler * Bitmaph):bitmaph(Bitmaph){}; | ||||
| 	CCreatureHandler(){}; | ||||
| }; | ||||
| #endif //CCREATUREHANDLER_H | ||||
| @@ -1,9 +1,10 @@ | ||||
| #define VCMI_DLL | ||||
| #include "../stdafx.h" | ||||
| #include "CDefObjInfoHandler.h" | ||||
| #include "../CGameInfo.h" | ||||
| #include "CLodHandler.h" | ||||
| #include <sstream> | ||||
|  | ||||
| extern CLodHandler * bitmaph; | ||||
| bool CGDefInfo::isVisitable() | ||||
| { | ||||
| 	for (int i=0; i<6; i++) | ||||
| @@ -20,7 +21,7 @@ CGDefInfo::CGDefInfo() | ||||
| void CDefObjInfoHandler::load() | ||||
| { | ||||
| 	nodrze<int> ideki; | ||||
| 	std::istringstream inp(CGameInfo::mainObj->bitmaph->getTextFile("ZOBJCTS.TXT")); | ||||
| 	std::istringstream inp(bitmaph->getTextFile("ZOBJCTS.TXT")); | ||||
| 	int objNumber; | ||||
| 	inp>>objNumber; | ||||
| 	for(int hh=0; hh<objNumber; ++hh) | ||||
|   | ||||
| @@ -2,8 +2,10 @@ | ||||
| #define COBJINFOECTHANDLER_H | ||||
| #include <vector> | ||||
| #include <map> | ||||
| #include "../global.h" | ||||
| class CDefHandler; | ||||
| class CGDefInfo | ||||
| class CLodHandler; | ||||
| class DLL_EXPORT CGDefInfo | ||||
| { | ||||
| public: | ||||
| 	std::string name;  | ||||
| @@ -27,7 +29,7 @@ public: | ||||
| 	} | ||||
| 	CGDefInfo(); | ||||
| }; | ||||
| class CDefObjInfoHandler | ||||
| class DLL_EXPORT CDefObjInfoHandler | ||||
| { | ||||
| public: | ||||
| 	std::map<int,std::map<int,CGDefInfo*> > gobjs; | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|  | ||||
| void CGeneralTextHandler::load() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("GENRLTXT.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("GENRLTXT.TXT"); | ||||
| 	int andame = buf.size(); | ||||
| 	int i=0; //buf iterator | ||||
| 	for(i; i<andame; ++i) | ||||
|   | ||||
| @@ -350,7 +350,7 @@ void CHeroHandler::loadHeroFlags() | ||||
| void CHeroHandler::loadHeroes() | ||||
| { | ||||
| 	int ID=0; | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("HOTRAITS.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("HOTRAITS.TXT"); | ||||
| 	int it=0; | ||||
| 	std::string dump; | ||||
| 	for(int i=0; i<2; ++i) | ||||
| @@ -436,7 +436,7 @@ void CHeroHandler::loadHeroes() | ||||
| } | ||||
| void CHeroHandler::loadSpecialAbilities() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("HEROSPEC.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("HEROSPEC.TXT"); | ||||
| 	int it=0; | ||||
| 	std::string dump; | ||||
| 	for(int i=0; i<2; ++i) | ||||
| @@ -453,7 +453,7 @@ void CHeroHandler::loadSpecialAbilities() | ||||
|  | ||||
| void CHeroHandler::loadBiographies() | ||||
| {	 | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("HEROBIOS.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("HEROBIOS.TXT"); | ||||
| 	int it=0; | ||||
| 	for (int i=0;i<heroes.size();i++) | ||||
| 	{ | ||||
| @@ -463,7 +463,7 @@ void CHeroHandler::loadBiographies() | ||||
|  | ||||
| void CHeroHandler::loadHeroClasses() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("HCTRAITS.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("HCTRAITS.TXT"); | ||||
| 	int andame = buf.size(); | ||||
| 	for(int y=0; y<andame; ++y) | ||||
| 		if(buf[y]==',') | ||||
| @@ -561,7 +561,7 @@ void CHeroHandler::loadHeroClasses() | ||||
|  | ||||
| 		//CHero kkk = heroes[0]; | ||||
|  | ||||
| 		for(int dd=0; dd<CGameInfo::mainObj->abilh->abilities.size(); ++dd) | ||||
| 		for(int dd=0; dd<CGI->abilh->abilities.size(); ++dd) | ||||
| 		{ | ||||
| 			befi=i; | ||||
| 			for(i; i<andame; ++i) | ||||
|   | ||||
| @@ -21,7 +21,7 @@ DLL_EXPORT int readNormalNr (int pos, int bytCon, unsigned char * str) | ||||
| 	else return -1; | ||||
| 	return ret; | ||||
| } | ||||
| DLL_EXPORT unsigned char * CLodHandler::giveFile(std::string defName, int * length) | ||||
| unsigned char * CLodHandler::giveFile(std::string defName, int * length) | ||||
| { | ||||
| 	std::transform(defName.begin(), defName.end(), defName.begin(), (int(*)(int))toupper); | ||||
| 	Entry * ourEntry = entries.znajdz(Entry(defName)); | ||||
| @@ -63,7 +63,7 @@ DLL_EXPORT unsigned char * CLodHandler::giveFile(std::string defName, int * leng | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
| DLL_EXPORT int CLodHandler::infs(unsigned char * in, int size, int realSize, std::ofstream & out, int wBits) | ||||
| int CLodHandler::infs(unsigned char * in, int size, int realSize, std::ofstream & out, int wBits) | ||||
| { | ||||
| 	int ret; | ||||
| 	unsigned have; | ||||
| @@ -222,7 +222,7 @@ DLL_EXPORT int CLodHandler::infs2(unsigned char * in, int size, int realSize, un | ||||
| 	return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; | ||||
| } | ||||
|  | ||||
| DLL_EXPORT void CLodHandler::extract(std::string FName) | ||||
| void CLodHandler::extract(std::string FName) | ||||
| { | ||||
| 	std::ofstream FOut; | ||||
| 	for (int i=0;i<totalFiles;i++) | ||||
| @@ -269,7 +269,7 @@ DLL_EXPORT void CLodHandler::extract(std::string FName) | ||||
| 	fclose(FLOD); | ||||
| } | ||||
|  | ||||
| DLL_EXPORT void CLodHandler::extractFile(std::string FName, std::string name) | ||||
| void CLodHandler::extractFile(std::string FName, std::string name) | ||||
| { | ||||
| 	std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper); | ||||
| 	for (int i=0;i<totalFiles;i++) | ||||
| @@ -335,7 +335,7 @@ int CLodHandler::readNormalNr (unsigned char* bufor, int bytCon, bool cyclic) | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| DLL_EXPORT void CLodHandler::init(std::string lodFile) | ||||
| void CLodHandler::init(std::string lodFile) | ||||
| { | ||||
| 	std::string Ts; | ||||
| 	FLOD = fopen(lodFile.c_str(), "rb"); | ||||
| @@ -381,7 +381,7 @@ DLL_EXPORT void CLodHandler::init(std::string lodFile) | ||||
| 		entries.push_back(entry); | ||||
| 	} | ||||
| } | ||||
| DLL_EXPORT std::string CLodHandler::getTextFile(std::string name) | ||||
| std::string CLodHandler::getTextFile(std::string name) | ||||
| { | ||||
| 	int length=-1; | ||||
| 	unsigned char* data = giveFile(name,&length); | ||||
|   | ||||
| @@ -38,21 +38,21 @@ struct Entry | ||||
| 	//Entry(unsigned char ): nameStr(con){}; | ||||
| 	Entry(){}; | ||||
| }; | ||||
|  class CLodHandler | ||||
|  class DLL_EXPORT CLodHandler | ||||
| { | ||||
| public: | ||||
| 	FILE* FLOD; | ||||
| 	nodrze<Entry> entries; | ||||
| 	unsigned int totalFiles; | ||||
|  | ||||
| 	DLL_EXPORT int readNormalNr (unsigned char* bufor, int bytCon, bool cyclic=false); //lod header reading helper | ||||
| 	DLL_EXPORT int infs(unsigned char * in, int size, int realSize, std::ofstream & out, int wBits=15); //zlib fast handler | ||||
| 	DLL_EXPORT int infs2(unsigned char * in, int size, int realSize, unsigned char*& out, int wBits=15); //zlib fast handler | ||||
| 	DLL_EXPORT unsigned char * giveFile(std::string defName, int * length=NULL); //returns pointer to the decompressed data - it must be deleted when no longer needed! | ||||
| 	DLL_EXPORT std::string getTextFile(std::string name); //extracts one file | ||||
| 	DLL_EXPORT void extract(std::string FName); | ||||
| 	DLL_EXPORT void extractFile(std::string FName, std::string name); //extracts a specific file | ||||
| 	DLL_EXPORT void init(std::string lodFile); | ||||
| 	int readNormalNr (unsigned char* bufor, int bytCon, bool cyclic=false); //lod header reading helper | ||||
| 	int infs(unsigned char * in, int size, int realSize, std::ofstream & out, int wBits=15); //zlib fast handler | ||||
| 	int infs2(unsigned char * in, int size, int realSize, unsigned char*& out, int wBits=15); //zlib fast handler | ||||
| 	unsigned char * giveFile(std::string defName, int * length=NULL); //returns pointer to the decompressed data - it must be deleted when no longer needed! | ||||
| 	std::string getTextFile(std::string name); //extracts one file | ||||
| 	void extract(std::string FName); | ||||
| 	void extractFile(std::string FName, std::string name); //extracts a specific file | ||||
| 	void init(std::string lodFile); | ||||
| }; | ||||
|  | ||||
| #endif //CLODHANDLER_H | ||||
| @@ -14,7 +14,7 @@ | ||||
| void CObjectHandler::loadObjects() | ||||
| { | ||||
| 	int ID=0; | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("OBJNAMES.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("OBJNAMES.TXT"); | ||||
| 	int it=0; | ||||
| 	while (it<buf.length()-1) | ||||
| 	{ | ||||
| @@ -25,7 +25,7 @@ void CObjectHandler::loadObjects() | ||||
| 		objects.push_back(nobj); | ||||
| 	} | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("ADVEVENT.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("ADVEVENT.TXT"); | ||||
| 	it=0; | ||||
| 	std::string temp; | ||||
| 	while (it<buf.length()-1) | ||||
| @@ -37,7 +37,7 @@ void CObjectHandler::loadObjects() | ||||
| 		advobtxt.push_back(temp); | ||||
| 	} | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("XTRAINFO.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("XTRAINFO.TXT"); | ||||
| 	it=0; | ||||
| 	while (it<buf.length()-1) | ||||
| 	{ | ||||
| @@ -45,7 +45,7 @@ void CObjectHandler::loadObjects() | ||||
| 		xtrainfo.push_back(temp); | ||||
| 	} | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("MINENAME.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("MINENAME.TXT"); | ||||
| 	it=0; | ||||
| 	while (it<buf.length()-1) | ||||
| 	{ | ||||
| @@ -53,7 +53,7 @@ void CObjectHandler::loadObjects() | ||||
| 		mines.push_back(std::pair<std::string,std::string>(temp,"")); | ||||
| 	} | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("MINEEVNT.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("MINEEVNT.TXT"); | ||||
| 	it=0; | ||||
| 	int i=0; | ||||
| 	while (it<buf.length()-1) | ||||
| @@ -63,7 +63,7 @@ void CObjectHandler::loadObjects() | ||||
| 		mines[i++].second = temp; | ||||
| 	} | ||||
|  | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("RESTYPES.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("RESTYPES.TXT"); | ||||
| 	it=0; | ||||
| 	while (it<buf.length()-1) | ||||
| 	{ | ||||
| @@ -83,7 +83,7 @@ void CObjectHandler::loadObjects() | ||||
| 	} | ||||
| 	ifs.close(); | ||||
| 	ifs.clear(); | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("ZCRGN1.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("ZCRGN1.TXT"); | ||||
| 	it=0; | ||||
| 	while (it<buf.length()-1) | ||||
| 	{ | ||||
|   | ||||
| @@ -25,7 +25,7 @@ std::string CPreGameTextHandler::getDescr(std::string text) | ||||
| } | ||||
| void CPreGameTextHandler::loadTexts() | ||||
| { | ||||
| 	std::string buf1 = CGameInfo::mainObj->bitmaph->getTextFile("ZELP.TXT"); | ||||
| 	std::string buf1 = CGI->bitmaph->getTextFile("ZELP.TXT"); | ||||
| 	int itr=0, eol=-1, eolnext=-1, pom; | ||||
| 	eolnext = buf1.find_first_of('\r',itr); | ||||
| 	while(itr<buf1.size()) | ||||
| @@ -48,7 +48,7 @@ void CPreGameTextHandler::loadTexts() | ||||
| 		} | ||||
| 		itr=eol+2; | ||||
| 	} | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("VCDESC.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("VCDESC.TXT"); | ||||
| 	int andame = buf.size(); | ||||
| 	int i=0; //buf iterator | ||||
| 	for(int gg=0; gg<14; ++gg) | ||||
| @@ -62,7 +62,7 @@ void CPreGameTextHandler::loadTexts() | ||||
| 		victoryConditions[gg] = buf.substr(befi, i-befi); | ||||
| 		i+=2; | ||||
| 	} | ||||
| 	buf = CGameInfo::mainObj->bitmaph->getTextFile("LCDESC.TXT"); | ||||
| 	buf = CGI->bitmaph->getTextFile("LCDESC.TXT"); | ||||
| 	andame = buf.size(); | ||||
| 	i=0; //buf iterator | ||||
| 	for(int gg=0; gg<4; ++gg) | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|  | ||||
| void CSpellHandler::loadSpells() | ||||
| { | ||||
| 	std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("SPTRAITS.TXT"); | ||||
| 	std::string buf = CGI->bitmaph->getTextFile("SPTRAITS.TXT"); | ||||
| 	int andame = buf.size(); | ||||
| 	int i=0; //buf iterator | ||||
| 	int hmcr=0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user