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

* [bugfix] nie zamula

* [new] uniezależnienie od rozprutego h3sprite.lod
This commit is contained in:
Michał W. Urbańczyk 2007-07-11 12:08:42 +00:00
parent de13161f2e
commit 4e0cacff14
12 changed files with 26 additions and 24 deletions

View File

@ -7,6 +7,7 @@
#include "SDL_Extensions.h"
#include "boost\filesystem.hpp"
#include <set>
#define CGI (CGameInfo::mainObj)
unsigned int intPow(unsigned int a, unsigned int b)
{
@ -1756,15 +1757,13 @@ void CAmbarCendamo::loadDefs()
{
if (loadedTypes.find(map.terrain[i][j].tertype)==loadedTypes.end())
{
CSemiDefHandler *sdh = new CSemiDefHandler();
sdh->openDef((sdh->nameFromType(map.terrain[i][j].tertype)).c_str(),"H3sprite.lod");
CDefHandler *sdh = CGI->spriteh->giveDef(CSemiDefHandler::nameFromType(map.terrain[i][j].tertype).c_str());
loadedTypes.insert(map.terrain[i][j].tertype);
defs.push_back(sdh);
}
if (map.twoLevel && loadedTypes.find(map.undergroungTerrain[i][j].tertype)==loadedTypes.end())
{
CSemiDefHandler *sdh = new CSemiDefHandler();
sdh->openDef((sdh->nameFromType(map.undergroungTerrain[i][j].tertype)).c_str(),"H3sprite.lod");
CDefHandler *sdh = CGI->spriteh->giveDef(CSemiDefHandler::nameFromType(map.undergroungTerrain[i][j].tertype).c_str());
loadedTypes.insert(map.undergroungTerrain[i][j].tertype);
defs.push_back(sdh);
}

View File

@ -21,7 +21,7 @@ public:
std::ifstream * is; // stream used to read map file
int andame; // length of map file
unsigned char * bufor; // here we store map bytecode
std::vector<CSemiDefHandler*> defs;
std::vector<CDefHandler*> defs;
/////////////////funkcje skladowe
CAmbarCendamo (const char * tie); // c-tor; tie is the path of the map file
CAmbarCendamo (unsigned char * map); // c-tor; map is pointer to array containing map; it is not copied, so don't delete

Binary file not shown.

View File

@ -1,6 +1,8 @@
#include "stdafx.h"
#include "CHeroHandler.h"
#include "CGameInfo.h"
#include <sstream>
#define CGI (CGameInfo::mainObj)
void CHeroHandler::loadHeroes()
{

View File

@ -430,7 +430,7 @@ std::vector<CDefHandler *> CLodHandler::extractManyFiles(std::vector<std::string
}
delete outp;
}
std::cout<<'\r'<<"Reading defs: 100% "<<std::endl;
//std::cout<<'\r'<<"Reading defs: 100% "<<std::endl;
for(int hh=0; hh<found.size(); ++hh)
{
if(!found[hh])

View File

@ -2,6 +2,9 @@
#include "CMessage.h"
#include "SDL_TTF.h"
#include "CSemiDefHandler.h"
#include "CDefHandler.h"
#include "CGameInfo.h"
#define CGI (CGameInfo::mainObj)
SDL_Color tytulowy, tlo, zwykly ;
SDL_Rect genRect(int hh, int ww, int xx, int yy);
@ -16,9 +19,8 @@ void updateRect (SDL_Rect * rect, SDL_Surface * scr = ekran);
bool isItIn(const SDL_Rect * rect, int x, int y);
CMessage::CMessage()
{
piecesOfBox = new CSemiDefHandler();
piecesOfBox->openDef("DIALGBOX.DEF","H3sprite.lod");
background = SDL_LoadBMP("H3bitmap.lod\\DIBOXBCK.BMP");
piecesOfBox = CGI->spriteh->giveDef("DIALGBOX.DEF");
background = CGI->bitmaph->loadBitmap("DIBOXBCK.BMP");
SDL_SetColorKey(background,SDL_SRCCOLORKEY,SDL_MapRGB(background->format,0,255,255));
}
SDL_Surface * CMessage::drawBox1(int w, int h)
@ -90,7 +92,7 @@ std::vector<std::string> * CMessage::breakText(std::string text, int line)
return ret;
}
SDL_Surface * CMessage::genMessage
(std::string title, std::string text, EWindowType type, std::vector<CSemiDefHandler*> *addPics, void * cb)
(std::string title, std::string text, EWindowType type, std::vector<CDefHandler*> *addPics, void * cb)
{
//max x 320 okolo 30 znakow
std::vector<std::string> * tekst;

View File

@ -3,6 +3,7 @@
#include "SDL_TTF.h"
#include "CSemiDefHandler.h"
#include "CDefHandler.h"
enum EWindowType {infoOnly, infoOK, yesOrNO};
class CPreGame;
class MapSel;
@ -14,7 +15,7 @@ struct OverButton
int ID;
int type;
SDL_Rect pos;
CSemiDefHandler* imgs;
CDefHandler* imgs;
int state;
virtual void show() ;
virtual void press(bool down=true);
@ -23,7 +24,7 @@ template <class T=ttt> struct Button: public OverButton
{
T fun;
CGroup<T> * ourGroup;
Button( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
:fun(Fun),ourGroup(gr){type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
Button(){};
bool selectable, selected;
@ -58,7 +59,7 @@ public:
int key;
int * what;
IntBut(){type=2;fun=NULL;};
IntBut( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel, int Key, int * What)
IntBut( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel, int Key, int * What)
: Button(Pos,Fun,Imgs,Sel,gr),key(My),key(Key),what(What){ourGroup=gr;type=2;fun=NULL;};
void set(){*what=key;};
};
@ -68,7 +69,7 @@ public:
CPoinGroup<T> * ourGroup;
int key;
IntSelBut(){};
IntSelBut( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel=false, CPoinGroup<T>* gr=NULL, int My=-1)
IntSelBut( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CPoinGroup<T>* gr=NULL, int My=-1)
: Button(Pos,Fun,Imgs,Sel,gr),key(My){ourGroup=gr;type=1;};
void select(bool on=true) {(*this).Button::select(on);ourGroup->setYour(this);}
};
@ -89,10 +90,10 @@ class CMessage
{
public:
static std::vector<std::string> * breakText(std::string text, int line=30);
CSemiDefHandler * piecesOfBox;
CDefHandler * piecesOfBox;
SDL_Surface * background;
SDL_Surface * genMessage(std::string title, std::string text, EWindowType type=infoOnly,
std::vector<CSemiDefHandler*> *addPics=NULL, void * cb=NULL);
std::vector<CDefHandler*> *addPics=NULL, void * cb=NULL);
SDL_Surface * drawBox1(int w, int h);
CMessage();
};

Binary file not shown.

View File

@ -74,7 +74,7 @@ public:
CPreGameTextHandler * preth ;
SDL_Rect * currentMessage;
SDL_Surface * behindCurMes;
CSemiDefHandler *ok, *cancel;
CDefHandler *ok, *cancel;
enum EState { //where are we?
mainMenu, newGame, loadGame, ScenarioList
} state;

View File

@ -20,8 +20,6 @@ SDL_Rect genRect(int hh, int ww, int xx, int yy)
}
void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=ekran)
{
SDL_SaveBMP(src, "bufimg.bmp");
SDL_SaveBMP(dst, "bufimg2.bmp");
SDL_Rect pom = genRect(src->h,src->w,x,y);
SDL_BlitSurface(src,NULL,dst,&pom);
}

View File

@ -41,8 +41,8 @@ public:
void CMapHandler::init()
{
fullHide = CGameInfo::mainObj->sspriteh->giveDef("TSHRC.DEF", 2);
partialHide = CGameInfo::mainObj->sspriteh->giveDef("TSHRE.DEF", 2);
fullHide = CGameInfo::mainObj->spriteh->giveDef("TSHRC.DEF");
partialHide = CGameInfo::mainObj->spriteh->giveDef("TSHRE.DEF");
for(int i=0; i<partialHide->ourImages.size(); ++i)
{
@ -78,7 +78,7 @@ void CMapHandler::init()
terrainBitmap = new SDL_Surface **[reader->map.width+8];
for (int ii=0;ii<reader->map.width+2*Woff;ii++)
terrainBitmap[ii] = new SDL_Surface*[reader->map.height+2*Hoff]; // allocate memory
CSemiDefHandler * bord = CGameInfo::mainObj->sspriteh->giveDef("EDG.DEF");
CDefHandler * bord = CGameInfo::mainObj->spriteh->giveDef("EDG.DEF");
for (int i=0; i<reader->map.width+2*Woff; i++) //jest po szerokoœci
{
for (int j=0; j<reader->map.height+2*Hoff;j++) //po wysokoœci

View File

@ -24,8 +24,8 @@ public:
SDL_Surface * terrainRect(int x, int y, int dx, int dy, int level=0, unsigned char anim=0);
SDL_Surface * terrBitmap(int x, int y);
SDL_Surface * undTerrBitmap(int x, int y);
CSemiDefHandler * fullHide;
CSemiDefHandler * partialHide;
CDefHandler * fullHide;
CDefHandler * partialHide;
std::vector< std::vector<char> > visibility; //true means that pointed place is visible
std::vector< std::vector<char> > undVisibility; //true means that pointed place is visible