Title Haven & Hearth 및 SALEM용 엔더클라이언트 맵추출타일 값 변경기
Nick EvilDragon
Time 2013-01-03 01:59:55
Body
이름은 Tilevalue Changer
사용법
1.엔더클라이언트로 추출된 맵파일을 준비합니다.
2.맵파일이 들어있는 폴더에 프로그램을 넣습니다.
3.변경할 값을 입력합니다.
4.그럼 타일값이 바뀝니다.
5.변경된 타일값으로 맵합치기를 수월하게 할 수 있게 됩니다.
http://evildragon.tistory.com/attachment/cfile9.uf@1325F4495052358A307EB8.exe
--------------소스코드------------
참고: 소스코드가 ver.3 기준이라서 요상하게 작성한걸 수정안한게 있습니다.
#include <stdio.h>
#include <dirent.h>
#include <assert.h>
int main(int argc, char *argv[])
{
int num1=0, num2=0, val1=0, val2=4, checker;
char location1[200];
char location2[200];
char filename[30];
DIR * dp = NULL;
struct dirent* entry = NULL;
mkdir("./work");
printf("**** Tilevalue Changer ver.3 - By Targal the EvilDragonn****n");
printf("**** 사용하기전에n");
printf("**** 사용하는 위치에 tile_*_*.png 파일들이 있어야 합니다.n");
printf("**** 리눅스 환경에선 작동하지 않을 수 있습니다.nnn");
printf("값을 입력하세요(a값, b값): "); scanf("%d %d", &val1;, &val2;);
if((dp=opendir("./")) == NULL)
{
printf("파일 열기 실패n");
return -1;
}
while((entry = readdir(dp)) != NULL)
{
checker = tilechecker(entry->d_name);
if(checker==1)
{
sscanf(entry->d_name, "tile_%d_%d.png", &num1;, &num2;);
sprintf(location1, "./tile_%d_%d.png", num1, num2);
sprintf(location2, "./work/tile_%d_%d.png", num1+val1, num2+val2);
rename(location1, location2);
printf("Done: tile_%d_%d.png => tile_%d_%d.pngn", num1, num2, num1+val1, num2+val2);
}
}
closedir(dp);
if((dp=opendir("./work")) == NULL)
{
printf("파일 열기 실패n");
return -1;
}
while((entry = readdir(dp)) != NULL)
{
checker = tilechecker(entry->d_name);
if(checker==1)
{
sscanf(entry->d_name, "%s", filename);
sprintf(location1, "./work/%s", filename);
sprintf(location2, "./%s", filename);
rename(location1, location2);
}
}
closedir(dp);
rmdir("./work");
return 0;
}
int tilechecker(char *str)
{
if(str[0]=='t')
if(str[1]=='i')
if(str[2]=='l')
if(str[3]=='e')
if(str[4]=='_')
return 1;
return 0;
}
Reply
-
유 2013-01-03 08:26:20
뭔진모르겠지만 복잡해보이네요
-
김개편 2013-01-03 11:33:58
늪지에서 거머리에게 죽은게임