- Re-coded 'soundeffectall'; removed the third parameter ('coverage')

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10844 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-07-03 15:15:23 +00:00
parent f8e09d76d0
commit 8db83e248a
10 changed files with 89 additions and 94 deletions

View File

@ -4,6 +4,8 @@ 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.
2007/07/03
* Re-coded 'soundeffectall'; removed the third parameter ('coverage')
- adjust your scripts if you use this command [ultramage]
* Defined out a problematic piece code in conv_num.
* Added reporting of constant and param script data.
* Fixed an incorrect check in menu script command. [FlavioJS]

View File

@ -5647,23 +5647,22 @@ those that actually work may differ greatly between client versions.
---------------------------------------
*soundeffect "<effect filename>",<number>
*soundeffectall "<effect filename>",<number>
*soundeffect "<effect filename>",<type>
*soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>}
These two commands will play a sound effect to either the invoking character
only 'soundeffect' or everyone around ('soundeffectall'). If the running code
does not have an object ID (a 'floating' npc) or is not running from an NPC
only ('soundeffect') or multiple characters ('soundeffectall'). If the running
code does not have an object ID (a 'floating' npc) or is not running from an NPC
object at all (an item script) the sound will be centered on the character who's
RID got attached to the script, if any. If it does, it will be centered on that
object. (an NPC sprite)
Effect filename is the filename of the wav in GRF. It must have an extension.
Effect filename is the filename in a GRF. It must have the .wav extension.
It's not quite certain what the number actually does, it is sent to the client
directly, probably it determines which directory of the GRF the effect is played
from - the sound effect type. It's certain that giving 0 for the number will
play sound files from 'data/wav', but where the other numbers will read from is
unclear.
It's not quite certain what the 'type' actually does, it is sent to the client
directly. It probably determines which directory to play the effect from.
It's certain that giving 0 for the number will play sound files from 'data/wav',
but where the other numbers will read from is unclear.
You can add your own effects this way, naturally.

View File

@ -1014,7 +1014,7 @@ prt_monk,226,257,6 script Ill Girl#tu 93,{
mes "Are you alright?";
next;
//misceffect EF_CURSEATTACK ;
//soundeffectall "_curse.wav",0;
soundeffectall "_curse.wav",0;
emotion e_omg;
mes "["+strcharinfo(0)+"]";
mes "This is....!";

View File

@ -1749,7 +1749,7 @@ prontera,126,335,5 script Arthail 51,{
next;
mes "[???]";
mes "...";
//soundeffectall "se_littlewaves02.wav",0;
soundeffectall "se_littlewaves02.wav",0;
next;
mes "["+strcharinfo(0)+"]";
mes "Huh?";

View File

@ -7197,7 +7197,7 @@ int atcommand_clearweather(const int fd, struct map_session_data* sd, const char
}
/*===============================================================
* Sound Command - plays a sound for everyone! [Codemaster]
* Sound Command - plays a sound for everyone around! [Codemaster]
*---------------------------------------------------------------*/
int atcommand_sound(const int fd, struct map_session_data *sd, const char *command, const char *message)
{
@ -7213,7 +7213,7 @@ int atcommand_sound(const int fd, struct map_session_data *sd, const char *comma
if(strstr(sound_file, ".wav") == NULL)
strcat(sound_file, ".wav");
clif_soundeffectall(&sd->bl, sound_file,0,2);
clif_soundeffectall(&sd->bl, sound_file, 0, AREA);
return 0;
}

View File

@ -7347,42 +7347,36 @@ int clif_wisall(struct map_session_data *sd,int type,int flag)
/*==========================================
*
*------------------------------------------*/
void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,const char *name,int type)
void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type)
{
int fd;
nullpo_retv(sd);
nullpo_retv(bl);
fd=sd->fd;
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x1d3));
WFIFOW(fd,0)=0x1d3;
memcpy(WFIFOP(fd,2),name,NAME_LENGTH);
WFIFOB(fd,26)=type;
WFIFOL(fd,27)=0;
WFIFOL(fd,31)=bl->id;
WFIFOW(fd,0) = 0x1d3;
safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH);
WFIFOB(fd,26) = type;
WFIFOL(fd,27) = 0;
WFIFOL(fd,31) = bl->id;
WFIFOSET(fd,packet_len(0x1d3));
return;
}
int clif_soundeffectall(struct block_list *bl, const char *name, int type, int coverage)
int clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage)
{
unsigned char buf[40];
memset(buf, 0, packet_len(0x1d3));
if(coverage < 0 || coverage > 22){
ShowError("clif_soundeffectall: undefined coverage.\n");
return 0;
}
nullpo_retr(0, bl);
WBUFW(buf,0)=0x1d3;
memcpy(WBUFP(buf,2), name, NAME_LENGTH);
WBUFB(buf,26)=type;
WBUFL(buf,27)=0;
WBUFL(buf,31)=bl->id;
WBUFW(buf,0) = 0x1d3;
safestrncpy((char*)WBUFP(buf,2), name, NAME_LENGTH);
WBUFB(buf,26) = type;
WBUFL(buf,27) = 0;
WBUFL(buf,31) = bl->id;
clif_send(buf, packet_len(0x1d3), bl, coverage);
return 0;

View File

@ -134,8 +134,8 @@ void clif_wedding_effect(struct block_list *bl);
void clif_divorced(struct map_session_data* sd, const char* name);
//void clif_callpartner(struct map_session_data *sd);
void clif_adopt_process(struct map_session_data *sd);
void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,const char *name,int type);
int clif_soundeffectall(struct block_list *bl, const char *name, int type, int coverage);
void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type);
int clif_soundeffectall(struct block_list* bl, const char *name, int type, enum send_target coverage);
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick);
void clif_parse_LoadEndAck(int fd,struct map_session_data *sd);

View File

@ -608,7 +608,7 @@ struct skill_unit *map_find_skill_unit_oncell(struct block_list *target,int x,in
/*==========================================
* Adapted from foreachinarea for an easier invocation. [Skotlex]
*------------------------------------------*/
int map_foreachinrange(int (*func)(struct block_list*,va_list),struct block_list *center, int range,int type,...)
int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...)
{
va_list ap;
int bx,by,m;
@ -682,7 +682,7 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list),struct block_list
/*==========================================
* Same as foreachinrange, but there must be a shoot-able range between center and target to be counted in. [Skotlex]
*------------------------------------------*/
int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list *center, int range,int type,...)
int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list* center, int range, int type,...)
{
va_list ap;
int bx,by,m;
@ -762,7 +762,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block
* funcを呼ぶ
* type!=0
*------------------------------------------*/
int map_foreachinarea(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int type,...)
int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...)
{
va_list ap;
int bx,by;
@ -838,7 +838,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list),int m,int x0,int y
*
* dx,dyは-1,0,1
*------------------------------------------*/
int map_foreachinmovearea(int (*func)(struct block_list*,va_list),struct block_list *center,int range, int dx,int dy,int type,...)
int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int dx, int dy, int type, ...)
{
int bx,by,m;
int returnCount =0; //total sum of returned values of func() [Skotlex]
@ -977,7 +977,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list),struct block_l
// which only checks the exact single x/y passed to it rather than an
// area radius - may be more useful in some instances)
//
int map_foreachincell(int (*func)(struct block_list*,va_list),int m,int x,int y,int type,...)
int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int y, int type, ...)
{
int bx,by;
int returnCount =0; //total sum of returned values of func() [Skotlex]
@ -1215,7 +1215,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y
}
// Copy of map_foreachincell, but applied to the whole map. [Skotlex]
int map_foreachinmap(int (*func)(struct block_list*,va_list),int m,int type,...)
int map_foreachinmap(int (*func)(struct block_list*,va_list), int m, int type,...)
{
int b, bsize;
int returnCount =0; //total sum of returned values of func() [Skotlex]

View File

@ -1300,14 +1300,13 @@ int map_delblock_sub(struct block_list *, int);
#define map_addblock(bl) map_addblock_sub(bl,1)
#define map_delblock(bl) map_delblock_sub(bl,1)
int map_moveblock(struct block_list *, int, int, unsigned int);
int map_foreachinrange(int (*)(struct block_list*,va_list),struct block_list *,int,int,...);
int map_foreachinshootrange(int (*)(struct block_list*,va_list),struct block_list *,int,int,...);
int map_foreachinarea(int (*)(struct block_list*,va_list),int,int,int,int,int,int,...);
// -- moonsoul (added map_foreachincell)
int map_foreachincell(int (*)(struct block_list*,va_list),int,int,int,int,...);
int map_foreachinmovearea(int (*)(struct block_list*,va_list),struct block_list*,int,int,int,int,...);
int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int range,int type,...); // Celest
int map_foreachinmap(int (*)(struct block_list*,va_list),int,int,...);
int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...);
int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...);
int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...);
int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int dx, int dy, int type, ...);
int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int y, int type, ...);
int map_foreachinpath(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int range, int type, ...);
int map_foreachinmap(int (*func)(struct block_list*,va_list), int m, int type, ...);
int map_countnearpc(int,int,int);
//block関連に追加
int map_count_oncell(int m,int x,int y,int type);

View File

@ -10845,73 +10845,74 @@ BUILDIN_FUNC(misceffect)
*------------------------------------------*/
BUILDIN_FUNC(soundeffect)
{
TBL_PC* sd = script_rid2sd(st);
const char* name = script_getstr(st,2);
int type = script_getnum(st,3);
// Redundn
TBL_PC *sd=script_rid2sd(st);
const char *name;
int type=0;
name=script_getstr(st,2);
type=script_getnum(st,3);
if(sd){
if(sd)
{
if(!st->rid)
clif_soundeffect(sd,map_id2bl(st->oid),name,type);
else{
else
clif_soundeffect(sd,&sd->bl,name,type);
}
}
return 0;
}
int soundeffect_sub(struct block_list* bl,va_list ap)
{
char *name;
int type;
nullpo_retr(0, bl);
nullpo_retr(0, ap);
name = va_arg(ap,char *);
type = va_arg(ap,int);
char* name = va_arg(ap,char*);
int type = va_arg(ap,int);
clif_soundeffect((TBL_PC *)bl, bl, name, type);
return 0;
}
/*==========================================
* Play a sound effect (.wav) on multiple clients
* soundeffectall "<filepath>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
*------------------------------------------*/
BUILDIN_FUNC(soundeffectall)
{
// [Lance] - Improved.
const char *name, *map = NULL;
struct block_list *bl;
int type, coverage, x0, y0, x1, y1;
struct block_list* bl;
const char* name;
int type;
name=script_getstr(st,2);
type=script_getnum(st,3);
coverage=script_getnum(st,4);
bl = (st->rid) ? &(script_rid2sd(st)->bl) : map_id2bl(st->oid);
if (!bl)
return 0;
if(!st->rid)
bl = map_id2bl(st->oid);
else
bl = &(script_rid2sd(st)->bl);
name = script_getstr(st,2);
type = script_getnum(st,3);
if(bl){
if(coverage < 23){
clif_soundeffectall(bl,name,type,coverage);
}else {
if(script_hasdata(st,9)){
map= script_getstr(st,5);
x0 = script_getnum(st,6);
y0 = script_getnum(st,7);
x1 = script_getnum(st,8);
y1 = script_getnum(st,9);
map_foreachinarea(soundeffect_sub,map_mapname2mapid(map),x0,y0,x1,y1,BL_PC,name,type);
} else {
ShowError("buildin_soundeffectall: insufficient arguments for specific area broadcast.\n");
}
}
//FIXME: enumerating map squares (map_foreach) is slower than enumerating the list of online players (map_foreachpc?)
if(!script_hasdata(st,4))
{ // area around
clif_soundeffectall(bl, name, type, AREA);
}
else
if(!script_hasdata(st,5))
{ // entire map
const char* map = script_getstr(st,4);
map_foreachinmap(soundeffect_sub, map_mapname2mapid(map), BL_PC, name, type);
}
else
if(script_hasdata(st,9))
{ // specified part of map
const char* map = script_getstr(st,5);
int x0 = script_getnum(st,6);
int y0 = script_getnum(st,7);
int x1 = script_getnum(st,8);
int y1 = script_getnum(st,9);
map_foreachinarea(soundeffect_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name, type);
}
else
{
ShowError("buildin_soundeffectall: insufficient arguments for specific area broadcast.\n");
}
return 0;
}
/*==========================================