Forráskód Böngészése

- status_check_skilluse won't block skill-specific checks (silence, berserk, steel-body, etc) when the skill in use is an item-invoked skill.
- Merged LittleWolf's function to read the map-height directly from the rsw file.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5706 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 éve
szülő
commit
7fac8ac102
6 módosított fájl, 77 hozzáadás és 116 törlés
  1. 10 0
      Changelog-Trunk.txt
  2. 4 81
      conf-tmpl/mapflag/water_height.txt
  3. 0 1
      src/login/login.c
  4. 59 32
      src/map/map.c
  5. 1 0
      src/map/map.h
  6. 3 2
      src/map/status.c

+ 10 - 0
Changelog-Trunk.txt

@@ -5,6 +5,16 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EV
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
 2006/03/22
+	* status_check_skilluse won't block skill-specific checks (silence,
+	  berserk, steel-body, etc) when the skill in use is an item-invoked skill.
+	  [Skotlex]
+	* Merged LittleWolf's function to read the map-height directly from the rsw
+	  file. Now when building the map-cache, the water-heights should be
+	  automatically read as well directly from the rsw's. [Skotlex]
+	  WARNING: Not tested yet!
+	  The water-height config file now is for aliases. When the rsw for a
+	  certain map is not found, and this map exists in the water_height list,
+	  then the water height of the second map listed in that file is used.
 	* Some cleanups in irc.c [Skotlex]
 	* Magic skills that ignore element now also don't take into account
 	  elemental cards. [Skotlex]

+ 4 - 81
conf-tmpl/mapflag/water_height.txt

@@ -1,82 +1,5 @@
-// Water Heigh Value for maps.
+// Water Height aliases for maps.
 // It affects WATER related skills as Water Ball, creation Holy Water, etc
-//water_height.txt eAthenaDB 2005/12/21 11:23:09 +0900 (JST)
-
-xmas.gat	3
-mjolnir_01.gat	0
-mjolnir_02.gat	-19
-mjolnir_12.gat	15
-prt_fild00.gat	11
-prt_fild01.gat	25
-prt_fild02.gat	42
-prt_fild04.gat	14
-prt_fild05.gat	14
-prt_fild10.gat	40
-gef_fild00.gat	10
-gef_fild01.gat	14
-gef_fild03.gat	82
-gef_fild04.gat	14
-gef_fild07.gat	19
-gef_fild09.gat	11
-gef_fild10.gat	24
-moc_fild01.gat	26
-moc_fild11.gat	9
-iz_dun00.gat	5
-iz_dun01.gat	5
-iz_dun02.gat	-58
-mjo_dun01.gat	7
-orcsdun02.gat	3
-pay_dun01.gat	8
-pay_dun02.gat	5
-pay_dun03.gat	10
-prt_sewb2.gat	5
-prt_sewb3.gat	5
-treasure01.gat	-4
-treasure02.gat	-1
-moc_ruins.gat	6
-pay_arche.gat	8
-glast_01.gat	8
-alde_dun03.gat	2
-alde_dun04.gat	0
-gl_prison1.gat	35
-gl_sew01.gat	56
-gl_sew02.gat	12
-gl_sew03.gat	15
-gl_sew04.gat	70
-comodo.gat	14
-cmd_fild01.gat	46
-cmd_fild02.gat	4
-cmd_fild03.gat	0
-cmd_fild04.gat	4
-cmd_fild05.gat	46
-beach_dun2.gat	6
-beach_dun3.gat	0
-beach_dun.gat	9
-gef_fild13.gat	19
-gld_dun01.gat	5
-gld_dun02.gat	5
-gld_dun03.gat	14
-gld_dun04.gat	3
-aldeg_cas01.gat	40
-aldeg_cas02.gat	35
-aldeg_cas03.gat	16
-aldeg_cas04.gat	31
-aldeg_cas05.gat	25
-gefg_cas02.gat	8
-gefg_cas04.gat	15
-gefg_cas05.gat	5
-prtg_cas05.gat	13
-gon_dun01.gat	5
-tur_dun01.gat	-65
-ama_fild01.gat	5
-yuno_fild09.gat	10
-yuno_fild11.gat	-19
-jawaii.gat	-10
-sec_in02.gat	5 
-ayothaya.gat	20
-ayo_dun01.gat	20
-ayo_dun02.gat	15
-lhz_dun03.gat	30
-abyss_01.gat	20
-abyss_03.gat	-20
-nguild_alde.gat	40
+// map_name map_water_level_to_use
+// Example: Use geffen's water level for prontera when prontera.rsw isn't found in the grf.
+// prontera.gat geffen.gat

+ 0 - 1
src/login/login.c

@@ -3515,7 +3515,6 @@ int login_lan_config_read(const char *lancfgName) {
 	return 0;
 }
 
-
 //-----------------------------------
 // Reading general configuration file
 //-----------------------------------

+ 59 - 32
src/map/map.c

@@ -2351,21 +2351,22 @@ int map_eraseipport(unsigned short mapindex,unsigned long ip,int port)
  *------------------------------------------
  */
 static struct waterlist_ {
-	char mapname[MAP_NAME_LENGTH];
-	int waterheight;
+	char mapname[MAP_NAME_LENGTH], clonemapname[MAP_NAME_LENGTH];
 } *waterlist=NULL;
 
 #define NO_WATER 1000000
 
-static int map_setwaterheight_sub(int m, int wh) {
+static int map_setwaterheight_sub(int m) {
 	char fn[256];
 	char *gat;
 	int x,y;
+	int wh;
 	struct gat_1cell {float high[4]; int type;} *p = NULL;
 	
 	if (m < 0)
 		return 0;
-	
+	wh = map[m].water_height;
+		
 	sprintf(fn,"data\\%s",mapindex_id2name(map[m].index));
 
 	// read & convert fn
@@ -2388,34 +2389,56 @@ static int map_setwaterheight_sub(int m, int wh) {
 	return 1;
 }
 int map_setwaterheight(int m, char *mapname, int height) {
-	int i=0;
 	if (height < 0)
 		height = NO_WATER;
-	if(waterlist){
-		for(i=0;waterlist[i].mapname[0] && i < MAX_MAP_PER_SERVER;i++)
-			if(strcmp(waterlist[i].mapname,mapname)==0) {
-				waterlist[i].waterheight = height;
-			}
-	}
-	if (i < MAX_MAP_PER_SERVER) {
-		memcpy(waterlist[i].mapname,mapname, MAP_NAME_LENGTH-1);
-		waterlist[i].waterheight = height;
-	}
-	return map_setwaterheight_sub(m, height);
+	map[m].water_height = height;
+	return map_setwaterheight_sub(m);
 }
 
+/* map_readwaterheight
+ * Reads from the .rsw for each map
+ * Returns water height (or NO_WATER if file doesn't exist)
+ * or other error is encountered.
+ * This receives a map-name, and changes the extension to rsw if it isn't set already.
+ * assumed path for file is data/mapname.rsw
+ * Credits to LittleWolf
+ */
 int map_waterheight(char *mapname) {
+	char fn[256];
+ 	char *rsw;
+	float whtemp;
+	int wh;
+#ifdef _WIN32
+	sprintf(fn,"data\\%s",mapname);
+#else
+	sprintf(fn,"data/%s",mapname);
+#endif
+	rsw = strstr(fn, ".");
+	if (rsw && strstr(fn, ".rsw") == NULL)
+		strcat (rsw, "rsw");
+
+	// read & convert fn
+	// again, might not need to be unsigned char
+	rsw = (char *) grfio_read (fn);
+	if (rsw)
+	{	//Load water height from file
+		whtemp = *(float*)(rsw+166);
+		wh = (int) whtemp;
+		aFree(rsw);
+		return wh;
+	}
+	//Look up for clone map.
 	if(waterlist){
 		int i;
 		for(i=0;waterlist[i].mapname[0] && i < MAX_MAP_PER_SERVER;i++)
 			if(strcmp(waterlist[i].mapname,mapname)==0)
-				return waterlist[i].waterheight;
+				return map_waterheight(waterlist[i].clonemapname);
 	}
 	return NO_WATER;
 }
 
 static void map_readwater(char *watertxt) {
-	char line[1024],w1[1024];
+	char line[1024],w1[1024],w2[1024];
 	FILE *fp=NULL;
 	int n=0;
 
@@ -2427,17 +2450,13 @@ static void map_readwater(char *watertxt) {
 	if(waterlist==NULL)
 		waterlist = (struct waterlist_*)aCallocA(MAX_MAP_PER_SERVER,sizeof(*waterlist));
 	while(fgets(line,1020,fp) && n < MAX_MAP_PER_SERVER){
-		int wh,count;
 		if(line[0] == '/' && line[1] == '/')
 			continue;
-		if((count=sscanf(line,"%s%d",w1,&wh)) < 1){
+		if(sscanf(line,"%s %s",w1,w2) < 2){
 			continue;
 		}
 		memcpy(waterlist[n].mapname,w1, MAP_NAME_LENGTH-1);
-		if(count >= 2)
-			waterlist[n].waterheight = wh;
-		else
-			waterlist[n].waterheight = 3;
+		memcpy(waterlist[n].clonemapname, w2, MAP_NAME_LENGTH-1);
 		n++;
 	}
 	fclose(fp);
@@ -2538,14 +2557,12 @@ int map_cache_read(struct map_data *m)
 	if(!map_cache.fp) { return 0; }
 	for(i = 0;i < map_cache.head.nmaps ; i++) {
 		if(!strcmp(m->name,map_cache.map[i].fn)) {
-			if(map_cache.map[i].water_height != map_waterheight(m->name)) {
-				// 水場の高さが違うので読み直し
-				return 0;
-			} else if(map_cache.map[i].compressed == 0) {
+			if(map_cache.map[i].compressed == 0) {
 				// 非圧縮ファイル
 				int size = map_cache.map[i].xs * map_cache.map[i].ys;
 				m->xs = map_cache.map[i].xs;
 				m->ys = map_cache.map[i].ys;
+				m->water_height = map_cache.map[i].water_height;
 				m->gat = (unsigned char *)aCalloc(m->xs * m->ys,sizeof(unsigned char));
 				fseek(map_cache.fp,map_cache.map[i].pos,SEEK_SET);
 				if(fread(m->gat,1,size,map_cache.fp) == size) {
@@ -2563,6 +2580,7 @@ int map_cache_read(struct map_data *m)
 				int size_compress = map_cache.map[i].compressed_len;
 				m->xs = map_cache.map[i].xs;
 				m->ys = map_cache.map[i].ys;
+				m->water_height = map_cache.map[i].water_height;
 				m->gat = (unsigned char *)aMalloc(m->xs * m->ys * sizeof(unsigned char));
 				buf = (unsigned char*)aMalloc(size_compress);
 				fseek(map_cache.fp,map_cache.map[i].pos,SEEK_SET);
@@ -2633,7 +2651,7 @@ static int map_cache_write(struct map_data *m)
 			}
 			map_cache.map[i].xs  = m->xs;
 			map_cache.map[i].ys  = m->ys;
-			map_cache.map[i].water_height = map_waterheight(m->name);
+			map_cache.map[i].water_height = m->water_height;
 			map_cache.dirty = 1;
 			if(map_read_flag == 2) {
 				aFree(write_buf);
@@ -2663,7 +2681,7 @@ static int map_cache_write(struct map_data *m)
 			map_cache.map[i].pos = map_cache.head.filesize;
 			map_cache.map[i].xs  = m->xs;
 			map_cache.map[i].ys  = m->ys;
-			map_cache.map[i].water_height = map_waterheight(m->name);
+			map_cache.map[i].water_height = m->water_height;
 			map_cache.head.filesize += len_new;
 			map_cache.dirty = 1;
 			if(map_read_flag == 2) {
@@ -2803,7 +2821,8 @@ static int map_loadafm (struct map_data *m, char *fn)
 
 		xs = m->xs = afm_size[0];
 		ys = m->ys = afm_size[1];
-		// check this, unsigned where it might not need to be
+		m->water_height = map_waterheight(m->name);
+
 		m->gat = (unsigned char*)aCallocA(xs * ys, 1);
 
 		for (y = 0; y < ys; y++) {
@@ -2911,11 +2930,19 @@ int map_readgat (struct map_data *m)
 	if ((pt = strstr(m->name,"<")) != NULL) { // [MouseJstr]
 		char buf[64];
 		*pt++ = '\0';
+#ifdef _WIN32
 		sprintf(buf,"data\\%s", pt);
+#else
+		sprintf(buf,"data/%s", pt);
+#endif
 		m->alias = aStrdup(buf);
 	}
 
+#ifdef _WIN32
 	sprintf(fn,"data\\%s",m->name);
+#else
+	sprintf(fn,"data/%s",m->name);
+#endif
 
 	// read & convert fn
 	// again, might not need to be unsigned char
@@ -2927,7 +2954,7 @@ int map_readgat (struct map_data *m)
 	ys = m->ys = *(int*)(gat+10);
 	m->gat = (unsigned char *)aCallocA(m->xs * m->ys, sizeof(unsigned char));
 
-	wh = map_waterheight(m->name);
+	m->water_height = wh = map_waterheight(m->name);
 	for (y = 0; y < ys; y++) {
 		p = (struct gat_1cell*)(gat+y*xs*20+14);
 		for (x = 0; x < xs; x++) {

+ 1 - 0
src/map/map.h

@@ -997,6 +997,7 @@ struct map_data {
 	int m;
 	short xs,ys;
 	short bxs,bys;
+	int water_height;
 	int npc_num;
 	int users;
 	struct {

+ 3 - 2
src/map/status.c

@@ -419,8 +419,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
 				default: return 0;
 			}
 		}
-		if (skill_num)
-		{	//Skills blocked through status changes...
+		if (skill_num && //Do not block item-casted skills.
+			(src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_num)
+		) {	//Skills blocked through status changes...
 			if (!flag && ( //Blocked only from using the skill (stuff like autospell may still go through
 				(sc->data[SC_MARIONETTE].timer != -1 && skill_num != CG_MARIONETTE) ||
 				(sc->data[SC_MARIONETTE2].timer != -1 && skill_num == CG_MARIONETTE) ||