소스 검색

[Optimized]:
- clif_specialeffect to use the enums.
[Improved]:
- buildin_specialeffect and buildin_specialeffect2 to accept effect area definition.

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

Lance 19 년 전
부모
커밋
e266a08f7c
7개의 변경된 파일63개의 추가작업 그리고 83개의 파일을 삭제
  1. 5 0
      Changelog-Trunk.txt
  2. 9 20
      src/map/atcommand.c
  3. 1 1
      src/map/charcommand.c
  4. 14 55
      src/map/clif.c
  5. 27 0
      src/map/clif.h
  6. 4 4
      src/map/script.c
  7. 3 3
      src/map/skill.c

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/05/30
+	* [Optimized]:
+	  - clif_specialeffect to use the enums.
+	  [Improved]:
+	  - buildin_specialeffect and buildin_specialeffect2 to accept effect area 
+	    definition. [Lance]
 	* [Added]:
 	  - Visual Studio .NET 2003 includes for mercenary.c [Lance]
 	* Removed the on-die specific code from unit_remove_map and placed it on

+ 9 - 20
src/map/atcommand.c

@@ -2378,7 +2378,7 @@ int atcommand_die(
 	const char* command, const char* message)
 {
 	nullpo_retr(-1, sd);
-	clif_specialeffect(&sd->bl,450,1);
+	clif_specialeffect(&sd->bl,450,SELF);
 	status_kill(&sd->bl);
 	clif_displaymessage(fd, msg_table[13]); // A pity! You've died.
 
@@ -4827,7 +4827,7 @@ int atcommand_doom(
 	struct map_session_data *pl_sd, **pl_allsd;
 	int i, users;
 	nullpo_retr(-1, sd);
-	clif_specialeffect(&sd->bl,450,2);
+	clif_specialeffect(&sd->bl,450,ALL_SAMEMAP);
 	pl_allsd = map_getallusers(&users);
 	for(i = 0; i < users; i++) {
 		if ((pl_sd = pl_allsd[i]) && pl_sd->fd != fd && pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can doom only lower or same gm level
@@ -4851,7 +4851,7 @@ int atcommand_doommap(
 	struct map_session_data *pl_sd, **pl_allsd;
 	int i, users;
 	nullpo_retr(-1, sd);
-	clif_specialeffect(&sd->bl,450,3);
+	clif_specialeffect(&sd->bl,450,ALL_CLIENT);
 	pl_allsd = map_getallusers(&users);
 	for (i = 0; i < users; i++) {
 		if ((pl_sd = pl_allsd[i]) && pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m &&
@@ -6808,27 +6808,16 @@ int atcommand_effect(
 	const int fd, struct map_session_data* sd,
 	const char* command, const char* message)
 {
-	struct map_session_data *pl_sd, **pl_allsd;
-	int type = 0, flag = 0, i, users;
+	int type = 0, flag = 0;
 	nullpo_retr(-1, sd);
 
 	if (!message || !*message || sscanf(message, "%d %d", &type,&flag) < 2) {
 		clif_displaymessage(fd, "Please, enter at least a option (usage: @effect <type+>).");
 		return -1;
 	}
-	if(flag <=0){
-		clif_specialeffect(&sd->bl, type, flag);
-		clif_displaymessage(fd, msg_table[229]); // Your effect has changed.
-	}
-	else{
-		pl_allsd = map_getallusers(&users);
-		for (i = 0; i < users; i++) {
-			if ((pl_sd = pl_allsd[i])) {
-				clif_specialeffect(&pl_sd->bl, type, flag);
-				clif_displaymessage(pl_sd->fd, msg_table[229]); // Your effect has changed.
-			}
-		}
-	}
+
+	clif_specialeffect(&sd->bl, type, flag);
+	clif_displaymessage(fd, msg_table[229]); // Your effect has changed.
 
 	return 0;
 }
@@ -9796,10 +9785,10 @@ int atcommand_size(
 
 	if(size==1) {
 		sd->state.size=1;
-		clif_specialeffect(&sd->bl,420,0);
+		clif_specialeffect(&sd->bl,420,AREA);
 	} else if(size==2) {
 		sd->state.size=2;
-		clif_specialeffect(&sd->bl,422,0);
+		clif_specialeffect(&sd->bl,422,AREA);
 	}
 
 	return 0;

+ 1 - 1
src/map/charcommand.c

@@ -890,7 +890,7 @@ charcommand_effect(const int fd, struct map_session_data* sd,
 	if((pl_sd=map_nick2sd((char *) target)) == NULL)
 		return -1;
 
-	clif_specialeffect(&pl_sd->bl, type, 0);
+	clif_specialeffect(&pl_sd->bl, type, AREA);
 	clif_displaymessage(fd, msg_table[229]); // Your effect has changed.
 
 	return 0;

+ 14 - 55
src/map/clif.c

@@ -120,33 +120,6 @@ static const int packet_len_table[MAX_PACKET_DB] = {
     3, 32,  -1,  3,  3,  5,  5,  8,   2,  3, -1, -1,  4,-1,  4
 };
 
-// local define
-enum {
-	ALL_CLIENT,
-	ALL_SAMEMAP,
-	AREA,
-	AREA_WOS,
-	AREA_WOC,
-	AREA_WOSC,
-	AREA_CHAT_WOC,
-	CHAT,
-	CHAT_WOS,
-	CHAT_MAINCHAT,
-	PARTY,
-	PARTY_WOS,
-	PARTY_SAMEMAP,
-	PARTY_SAMEMAP_WOS,
-	PARTY_AREA,
-	PARTY_AREA_WOS,
-	GUILD,
-	GUILD_WOS,
-	GUILD_SAMEMAP,	// [Valaris]
-	GUILD_SAMEMAP_WOS,
-	GUILD_AREA,
-	GUILD_AREA_WOS,	// end additions [Valaris]
-	SELF
-};
-
 //Converts item type in case of pet eggs.
 #define itemtype(a) (a == 7)?4:a
 
@@ -1347,18 +1320,18 @@ int clif_spawn(struct block_list *bl)
 			if (sd->spiritball > 0)
 				clif_spiritball(sd);
 			if(sd->state.size==2) // tiny/big players [Valaris]
-				clif_specialeffect(bl,423,0);
+				clif_specialeffect(bl,423,AREA);
 			else if(sd->state.size==1)
-				clif_specialeffect(bl,421,0);
+				clif_specialeffect(bl,421,AREA);
 		}
 	break;
 	case BL_MOB:
 		{
 			TBL_MOB *md = ((TBL_MOB*)bl);
 			if(md->special_state.size==2) // tiny/big mobs [Valaris]
-				clif_specialeffect(&md->bl,423,0);
+				clif_specialeffect(&md->bl,423,AREA);
 			else if(md->special_state.size==1)
-				clif_specialeffect(&md->bl,421,0);
+				clif_specialeffect(&md->bl,421,AREA);
 		}
 	break;
 	}
@@ -1599,18 +1572,18 @@ int clif_move(struct block_list *bl) {
 			TBL_PC *sd = ((TBL_PC*)bl);
 //			clif_movepc(sd);
 			if(sd->state.size==2) // tiny/big players [Valaris]
-				clif_specialeffect(&sd->bl,423,0);
+				clif_specialeffect(&sd->bl,423,AREA);
 			else if(sd->state.size==1)
-				clif_specialeffect(&sd->bl,421,0);
+				clif_specialeffect(&sd->bl,421,AREA);
 		}
 		break;
 	case BL_MOB:
 		{
 			TBL_MOB *md = ((TBL_MOB*)bl);
 			if(md->special_state.size==2) // tiny/big mobs [Valaris]
-				clif_specialeffect(&md->bl,423,0);
+				clif_specialeffect(&md->bl,423,AREA);
 			else if(md->special_state.size==1)
-				clif_specialeffect(&md->bl,421,0);
+				clif_specialeffect(&md->bl,421,AREA);
 		}
 		break;
 	}
@@ -3864,9 +3837,9 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl)
 			TBL_PC* tsd = (TBL_PC*)bl;
 			clif_getareachar_pc(sd, tsd);
 			if(tsd->state.size==2) // tiny/big players [Valaris]
-				clif_specialeffect(bl,423,0);
+				clif_specialeffect(bl,423,AREA);
 			else if(tsd->state.size==1)
-				clif_specialeffect(bl,421,0);
+				clif_specialeffect(bl,421,AREA);
 		}
 		break;
 	case BL_NPC:
@@ -3879,9 +3852,9 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl)
 		{
 			TBL_MOB* md = (TBL_MOB*)bl;
 			if(md->special_state.size==2) // tiny/big mobs [Valaris]
-				clif_specialeffect(bl,423,0);
+				clif_specialeffect(bl,423,AREA);
 			else if(md->special_state.size==1)
-				clif_specialeffect(bl,421,0);
+				clif_specialeffect(bl,421,AREA);
 		}
 		break;
 	}
@@ -7753,22 +7726,8 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
 	WBUFL(buf,2) = bl->id;
 	WBUFL(buf,6) = type;
 
-	switch (flag) {
-	case 4:
-		clif_send(buf, packet_len_table[0x1f3], bl, AREA_WOS);
-		break;
-	case 3:
-		clif_send(buf, packet_len_table[0x1f3], bl, ALL_CLIENT);
-		break;
-	case 2:
-		clif_send(buf, packet_len_table[0x1f3], bl, ALL_SAMEMAP);
-		break;
-	case 1:
-		clif_send(buf, packet_len_table[0x1f3], bl, SELF);
-		break;
-	default:
-		clif_send(buf, packet_len_table[0x1f3], bl, AREA);
-	}
+	clif_send(buf, packet_len_table[0x1f3], bl, flag);
+
 	if (disguised(bl)) {
 		WBUFL(buf,2) = -bl->id;
 		clif_send(buf, packet_len_table[0x1f3], bl, SELF);

+ 27 - 0
src/map/clif.h

@@ -28,6 +28,33 @@ struct packet_db {
 	short pos[20];
 };
 
+// local define
+enum {
+	ALL_CLIENT,
+	ALL_SAMEMAP,
+	AREA,
+	AREA_WOS,
+	AREA_WOC,
+	AREA_WOSC,
+	AREA_CHAT_WOC,
+	CHAT,
+	CHAT_WOS,
+	CHAT_MAINCHAT,
+	PARTY,
+	PARTY_WOS,
+	PARTY_SAMEMAP,
+	PARTY_SAMEMAP_WOS,
+	PARTY_AREA,
+	PARTY_AREA_WOS,
+	GUILD,
+	GUILD_WOS,
+	GUILD_SAMEMAP,	// [Valaris]
+	GUILD_SAMEMAP_WOS,
+	GUILD_AREA,
+	GUILD_AREA_WOS,	// end additions [Valaris]
+	SELF
+};
+
 extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB];
 
 void clif_setip(char*);

+ 4 - 4
src/map/script.c

@@ -669,8 +669,8 @@ struct {
 	{buildin_petskillsupport,"petskillsupport","iiiii"}, // [Skotlex]
 	{buildin_skilleffect,"skilleffect","ii"}, // skill effect [Celest]
 	{buildin_npcskilleffect,"npcskilleffect","iiii"}, // npc skill effect [Valaris]
-	{buildin_specialeffect,"specialeffect","i"}, // npc skill effect [Valaris]
-	{buildin_specialeffect2,"specialeffect2","i"}, // skill effect on players[Valaris]
+	{buildin_specialeffect,"specialeffect","i*"}, // npc skill effect [Valaris]
+	{buildin_specialeffect2,"specialeffect2","i*"}, // skill effect on players[Valaris]
 	{buildin_nude,"nude",""}, // nude command [Valaris]
 	{buildin_mapwarp,"mapwarp","ssii"},		// Added by RoVeRT
 	{buildin_inittimer,"inittimer",""},
@@ -8646,7 +8646,7 @@ int buildin_specialeffect(struct script_state *st)
 	if(bl==NULL)
 		return 0;
 
-	clif_specialeffect(bl,conv_num(st,& (st->stack->stack_data[st->start+2])), 0);
+	clif_specialeffect(bl,conv_num(st,& (st->stack->stack_data[st->start+2])), ((st->end > st->start+3)?conv_num(st,& (st->stack->stack_data[st->start+3])):AREA));
 
 	return 0;
 }
@@ -8658,7 +8658,7 @@ int buildin_specialeffect2(struct script_state *st)
 	if(sd==NULL)
 		return 0;
 
-	clif_specialeffect(&sd->bl,conv_num(st,& (st->stack->stack_data[st->start+2])), 0);
+	clif_specialeffect(&sd->bl,conv_num(st,& (st->stack->stack_data[st->start+2])), ((st->end > st->start+3)?conv_num(st,& (st->stack->stack_data[st->start+3])):AREA));
 
 	return 0;
 }

+ 3 - 3
src/map/skill.c

@@ -5206,7 +5206,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 			}
 			do {
 				eff = rand() % 14;
-				clif_specialeffect(bl, 523 + eff, 0);
+				clif_specialeffect(bl, 523 + eff, AREA);
 				switch (eff)
 				{
 				case 0:	// heals SP to 0
@@ -10106,7 +10106,7 @@ int skill_produce_mix( struct map_session_data *sd, int skill_id,
 					break;
 				default: //Those that don't require a skill?
 					if (skill_produce_db[idx].itemlv==11) //Cooking items.
-						clif_specialeffect(&sd->bl, 608, 0);
+						clif_specialeffect(&sd->bl, 608, AREA);
 					break;
 			}
 		}
@@ -10146,7 +10146,7 @@ int skill_produce_mix( struct map_session_data *sd, int skill_id,
 				break;
 			default:
 				if (skill_produce_db[idx].itemlv==11)
-					clif_specialeffect(&sd->bl, 609, 0);
+					clif_specialeffect(&sd->bl, 609, AREA);
 		}
 	}
 	return 0;