mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
* poprawna obsługa podziemi, przełączanie widoku przez "u"
* naprawione nagłówki * okno ma tytuł
This commit is contained in:
parent
081b2ec024
commit
7b84806588
@ -1,5 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "CAbilityHandler.h"
|
||||
#include <fstream>
|
||||
|
||||
void CAbilityHandler::loadAbilities()
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "CAmbarCendamo.h"
|
||||
#include "CSemiDefHandler.h"
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
CAmbarCendamo::CAmbarCendamo (const char * tie)
|
||||
{
|
||||
@ -290,9 +289,9 @@ void CAmbarCendamo::deh3m()
|
||||
}
|
||||
if (map.twoLevel) // read underground terrain
|
||||
{
|
||||
for (int z=0; z<map.width; z++) // reading terrain
|
||||
for (int c=0; c<map.width; c++) // reading terrain
|
||||
{
|
||||
for (int c=0; c<map.height; c++)
|
||||
for (int z=0; z<map.height; z++)
|
||||
{
|
||||
map.undergroungTerrain[z][c].tertype = (EterrainType)(bufor[i++]);
|
||||
map.undergroungTerrain[z][c].terview = bufor[i++];
|
||||
@ -344,13 +343,20 @@ void CAmbarCendamo::loadDefs()
|
||||
{
|
||||
for (int j=0; j<map.width; j++)
|
||||
{
|
||||
if (loadedTypes.find(map.terrain[i][j].tertype)==loadedTypes.end())
|
||||
{
|
||||
CSemiDefHandler *sdh = new CSemiDefHandler();
|
||||
sdh->openDef(("H3sprite.lod\\"+sdh->nameFromType(map.terrain[i][j].tertype)).c_str());
|
||||
loadedTypes.insert(map.terrain[i][j].tertype);
|
||||
defs.push_back(sdh);
|
||||
}
|
||||
if (loadedTypes.find(map.terrain[i][j].tertype)==loadedTypes.end())
|
||||
{
|
||||
CSemiDefHandler *sdh = new CSemiDefHandler();
|
||||
sdh->openDef(("H3sprite.lod\\"+sdh->nameFromType(map.terrain[i][j].tertype)).c_str());
|
||||
loadedTypes.insert(map.terrain[i][j].tertype);
|
||||
defs.push_back(sdh);
|
||||
}
|
||||
if (loadedTypes.find(map.undergroungTerrain[i][j].tertype)==loadedTypes.end())
|
||||
{
|
||||
CSemiDefHandler *sdh = new CSemiDefHandler();
|
||||
sdh->openDef(("H3sprite.lod\\"+sdh->nameFromType(map.undergroungTerrain[i][j].tertype)).c_str());
|
||||
loadedTypes.insert(map.undergroungTerrain[i][j].tertype);
|
||||
defs.push_back(sdh);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "CArtHandler.h"
|
||||
#include <fstream>
|
||||
|
||||
void CArtHandler::loadArtifacts()
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include <fstream>
|
||||
|
||||
void CCreatureHandler::loadCreatures()
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <fstream>
|
||||
#include "stdafx.h"
|
||||
#include "CHeroHandler.h"
|
||||
|
||||
void CHeroHandler::loadHeroes()
|
||||
|
13
CMT.cpp
13
CMT.cpp
@ -24,6 +24,7 @@
|
||||
#endif
|
||||
#define CHUNK 16384
|
||||
#define pi 3.14159
|
||||
const char * NAME = "VCMI 0.1";
|
||||
|
||||
|
||||
#include "CAmbarCendamo.h"
|
||||
@ -196,7 +197,7 @@ void SDL_PutPixel(SDL_Surface *ekran, int x, int y, Uint8 R, Uint8 G, Uint8 B)
|
||||
}
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
int xx=0, yy=0;
|
||||
int xx=0, yy=0, zz=0;
|
||||
SDL_Event sEvent;
|
||||
srand ( time(NULL) );
|
||||
SDL_Surface *screen, *temp;
|
||||
@ -223,6 +224,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
// def(zr,ko,i);
|
||||
// fclose(ko);fclose(zr);
|
||||
//}
|
||||
SDL_WM_SetCaption(NAME,"");
|
||||
THC timeHandler tmh;
|
||||
CArtHandler * arth = new CArtHandler;
|
||||
arth->loadArtifacts();
|
||||
@ -295,9 +297,16 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
case (SDLK_u):
|
||||
{
|
||||
if (zz)
|
||||
zz--;
|
||||
else zz++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_FillRect(ekran, NULL, SDL_MapRGB(ekran->format, 0, 0, 0));
|
||||
SDL_Surface * help = mh->terrainRect(xx,yy,32,24);
|
||||
SDL_Surface * help = mh->terrainRect(xx,yy,32,24,zz);
|
||||
SDL_BlitSurface(help,NULL,ekran,NULL);
|
||||
SDL_FreeSurface(help);
|
||||
SDL_Flip(ekran);
|
||||
|
@ -55,8 +55,60 @@ void mapHandler::init()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reader->map.twoLevel)
|
||||
{
|
||||
undTerrainBitmap = new SDL_Surface **[reader->map.width];
|
||||
for (int ii=0;ii<reader->map.width;ii++)
|
||||
undTerrainBitmap[ii] = new SDL_Surface*[reader->map.height]; // allocate memory
|
||||
for (int i=0; i<reader->map.width; i++)
|
||||
{
|
||||
for (int j=0; j<reader->map.height;j++)
|
||||
{
|
||||
TerrainTile zz = reader->map.undergroungTerrain[i][j];
|
||||
std::string name = CSemiDefHandler::nameFromType(reader->map.undergroungTerrain[i][j].tertype);
|
||||
for (int k=0; k<reader->defs.size(); k++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (reader->defs[k]->defName != name)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
SDL_Surface * n;
|
||||
int ktora = reader->map.undergroungTerrain[i][j].terview;
|
||||
undTerrainBitmap[i][j] = reader->defs[k]->ourImages[ktora].bitmap;
|
||||
//TODO: odwracanie
|
||||
switch ((reader->map.undergroungTerrain[i][j].siodmyTajemniczyBajt)%4)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
undTerrainBitmap[i][j] = CSDL_Ext::rotate01(undTerrainBitmap[i][j]);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
undTerrainBitmap[i][j] = CSDL_Ext::hFlip(undTerrainBitmap[i][j]);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
undTerrainBitmap[i][j] = CSDL_Ext::rotate03(undTerrainBitmap[i][j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//SDL_BlitSurface(undTerrainBitmap[i][j],NULL,ekran,NULL); SDL_Flip(ekran);SDL_Delay(50);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{ continue; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_Surface * mapHandler::terrainRect(int x, int y, int dx, int dy)
|
||||
SDL_Surface * mapHandler::terrainRect(int x, int y, int dx, int dy, int level)
|
||||
{
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
int rmask = 0xff000000;
|
||||
@ -81,8 +133,10 @@ SDL_Surface * mapHandler::terrainRect(int x, int y, int dx, int dy)
|
||||
sr->y=by*32;
|
||||
sr->x=bx*32;
|
||||
sr->h=sr->w=32;
|
||||
|
||||
SDL_BlitSurface(terrainBitmap[bx+x][by+y],NULL,su,sr);
|
||||
if (!level)
|
||||
SDL_BlitSurface(terrainBitmap[bx+x][by+y],NULL,su,sr);
|
||||
else
|
||||
SDL_BlitSurface(undTerrainBitmap[bx+x][by+y],NULL,su,sr);
|
||||
delete sr;
|
||||
//SDL_BlitSurface(su,NULL,ekran,NULL);SDL_Flip(ekran);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ public:
|
||||
CAmbarCendamo * reader;
|
||||
SDL_Surface *** terrainBitmap;
|
||||
SDL_Surface *** undTerrainBitmap; // used only if there is underground level
|
||||
SDL_Surface * terrainRect(int x, int y, int dx, int dy);
|
||||
SDL_Surface * terrainRect(int x, int y, int dx, int dy, int level=0);
|
||||
SDL_Surface mirrorImage(SDL_Surface *src);
|
||||
void init();
|
||||
};
|
Loading…
Reference in New Issue
Block a user