Browse Source

drobna poprawka i bugreport - PRAWIE ŻADNA MAPA SIĘ NIE WCZYTUJE

mateuszb 18 năm trước cách đây
mục cha
commit
a5eff43d24
4 tập tin đã thay đổi với 28 bổ sung3 xóa
  1. 7 2
      CMT.cpp
  2. BIN
      CPreGame.cpp
  3. 21 1
      SDL_Extensions.cpp
  4. BIN
      h3m.txt

+ 7 - 2
CMT.cpp

@@ -317,7 +317,7 @@ int _tmain(int argc, _TCHAR* argv[])
 
 		THC std::cout<<"Handlers initailization: "<<tmh.getDif()<<std::endl;
 		std::string mapname;
-		CPG->ourScenSel->mapsel.selected = 1;
+		if(CPG->ourScenSel->mapsel.selected==0) CPG->ourScenSel->mapsel.selected = 1; //only for tests
 		if (CPG) mapname = CPG->ourScenSel->mapsel.ourMaps[CPG->ourScenSel->mapsel.selected].filename;
 		gzFile map = gzopen(mapname.c_str(),"rb");
 		std::string mapstr;int pom;
@@ -325,7 +325,12 @@ int _tmain(int argc, _TCHAR* argv[])
 		{
 			mapstr+=pom;
 		}
-		CAmbarCendamo * ac = new CAmbarCendamo((unsigned char*)mapstr.c_str()); //4gryf
+		unsigned char *initTable = new unsigned char[mapstr.size()];
+		for(int ss=0; ss<mapstr.size(); ++ss)
+		{
+			initTable[ss] = mapstr[ss];
+		}
+		CAmbarCendamo * ac = new CAmbarCendamo(initTable); //4gryf
 		//CAmbarCendamo * ac = new CAmbarCendamo("4gryf"); //4gryf
 		CMapHeader * mmhh = new CMapHeader(ac->bufor); //czytanie nag³ówka
 		cgi->ac = ac;

BIN
CPreGame.cpp


+ 21 - 1
SDL_Extensions.cpp

@@ -37,7 +37,27 @@ void updateRect (SDL_Rect * rect, SDL_Surface * scr = ekran)
 }
 void CSDL_Ext::printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor, SDL_Surface * dst, unsigned char quality)
 {
-	SDL_Surface * temp = TTF_RenderText_Blended(font,text.c_str(),kolor);
+	SDL_Surface * temp;
+	switch (quality)
+	{
+	case 0:
+		temp = TTF_RenderText_Solid(font,text.c_str(),kolor);
+		break;
+	case 1:
+		SDL_Color tem;
+		tem.b = 0xff-kolor.b;
+		tem.g = 0xff-kolor.g;
+		tem.r = 0xff-kolor.r;
+		tem.unused = 0xff-kolor.unused;
+		temp = TTF_RenderText_Shaded(font,text.c_str(),kolor,tem);
+		break;
+	case 2:
+		temp = TTF_RenderText_Blended(font,text.c_str(),kolor);
+		break;
+	default:
+		temp = TTF_RenderText_Blended(font,text.c_str(),kolor);
+		break;
+	}
 	SDL_BlitSurface(temp,NULL,dst,&genRect(temp->h,temp->w,x,y));
 	SDL_UpdateRect(dst,x,y,temp->w,temp->h);
 	SDL_FreeSurface(temp);

BIN
h3m.txt