diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-12 13:10:08 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-12 13:10:08 +0000 |
commit | 64324150783c2b822e5263e0e0a9ae0cc23d7ff1 (patch) | |
tree | b8458adc43fbbe83862fc3d14fd1b5c1d5904388 | |
parent | 664d34d836c774fde315d28b2b96db816573b357 (diff) | |
download | hercules-64324150783c2b822e5263e0e0a9ae0cc23d7ff1.tar.gz hercules-64324150783c2b822e5263e0e0a9ae0cc23d7ff1.tar.bz2 hercules-64324150783c2b822e5263e0e0a9ae0cc23d7ff1.tar.xz hercules-64324150783c2b822e5263e0e0a9ae0cc23d7ff1.zip |
* Updates to the playBGM functionality (since r14335).
- Removed impossible condition in playBGM script command (from soundeffect).
- Removed unused code (retrieving of a bl) in playBGMall (from soundeffectall).
- Made playBGMall default to 'entire server' when both map name and coordinates are omitted instead of printing an error.
- Updated documentation for playBGM and playBGMall to match actual behavior.
- Removed unused parameter 'bl' in clif_playBGM.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14582 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 7 | ||||
-rw-r--r-- | doc/script_commands.txt | 20 | ||||
-rw-r--r-- | src/map/clif.c | 5 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 49 |
5 files changed, 45 insertions, 38 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 6f4f42cf1..c2681fecc 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,12 @@ Date Added +2010/12/12 + * Updates to the playBGM functionality (since r14335). [Ai4rei] + - Removed impossible condition in playBGM script command (from soundeffect). + - Removed unused code (retrieving of a bl) in playBGMall (from soundeffectall). + - Made playBGMall default to 'entire server' when both map name and coordinates are omitted instead of printing an error. + - Updated documentation for playBGM and playBGMall to match actual behavior. + - Removed unused parameter 'bl' in clif_playBGM. 2010/12/11 * Fixed script command setd always assuming value parameter to be a string, which causes hexadecimal and octal numbers not being handled properly (topic:261833, followup to r14577 and r14578). [Ai4rei] * Updates to dynamic server information `ragsrvinfo` on SQL. [Ai4rei] diff --git a/doc/script_commands.txt b/doc/script_commands.txt index b3a4ff35d..bc3da5e10 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4,7 +4,7 @@ //= A reference manual for the eAthena scripting language. //= Commands are sorted depending on their functionality. //===== Version =========================================== -//= 3.32.20101208 +//= 3.33.20101212 //========================================================= //= 1.0 - First release, filled will as much info as I could //= remember or figure out, most likely there are errors, @@ -138,8 +138,8 @@ //= 3.29.20101123 //= Added 'pushpc' command. [Ai4rei] //= 3.30.20101126 -//= Added 'setfont', 'mercenary_create', 'mercenary_heal', 'mercenary_sc_start', -//= 'mercenary_create', 'mercenary_get_calls', 'mercenary_set_calls', +//= Added 'setfont', 'mercenary_create', 'mercenary_heal', +//= 'mercenary_sc_start', 'mercenary_get_calls', 'mercenary_set_calls', //= 'mercenary_get_faith' and 'mercenary_set_faith' commands. [Ai4rei] //= 3.31.20101130 //= Added 'progressbar' command. [Ai4rei] @@ -148,6 +148,9 @@ //= 'detachrid', 'itemskill', 'openstorage', 'skilleffect', 'donpcevent', //= 'day', 'night', 'atoi', 'axtoi', 'jump_zero', 'getelementofarray', //= 'changebase', 'kickwaitingroomall', 'cutin' and 'charcommand'. [Ai4rei] +//= 3.33.20101212 +//= Updated description of 'playBGM' and 'playBGMall' to reflect the actual +//= behavior. [Ai4rei] //========================================================= This document is a reference manual for all the scripting commands and functions @@ -6170,19 +6173,16 @@ You can add your own effects this way, naturally. --------------------------------------- *playBGM "<BGM filename>" -*playBGMall "<BGM filename>",{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>} +*playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}} These two commands will play a Background Music to either the invoking character -only ('playBGM') or multiple characters ('playBGMall'). 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) +only ('playBGM') or multiple characters ('playBGMall'). BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension. It's not required to specify the extension inside the script. -If coordinates are omitted, BGM will be broadcasted on the entire map. +If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name +is omitted as well the BGM will be played for the entire server. You can add your own BGMs this way, naturally. diff --git a/src/map/clif.c b/src/map/clif.c index 0e4fa9104..ad8e5782c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7465,20 +7465,17 @@ int clif_wisall(struct map_session_data *sd,int type,int flag) /*========================================== * Play a BGM! [Rikter/Yommy] *------------------------------------------*/ -void clif_playBGM(struct map_session_data* sd, struct block_list* bl, const char* name) +void clif_playBGM(struct map_session_data* sd, const char* name) { int fd; nullpo_retv(sd); - nullpo_retv(bl); fd = sd->fd; WFIFOHEAD(fd,packet_len(0x7fe)); WFIFOW(fd,0) = 0x7fe; safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH); WFIFOSET(fd,packet_len(0x7fe)); - - return; } /*========================================== diff --git a/src/map/clif.h b/src/map/clif.h index 1af527d1e..ded8ece30 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -252,7 +252,7 @@ void clif_talkiebox(struct block_list* bl, const char* talkie); 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_playBGM(struct map_session_data* sd, struct block_list* bl, const char* name); +void clif_playBGM(struct map_session_data* sd, const char* name); 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); diff --git a/src/map/script.c b/src/map/script.c index c408846a3..8989aa37e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10802,27 +10802,34 @@ BUILDIN_FUNC(misceffect) *------------------------------------------*/ BUILDIN_FUNC(playBGM) { - TBL_PC* sd = script_rid2sd(st); - const char* name = script_getstr(st,2); + const char* name; + struct map_session_data* sd; - if(sd) + if( ( sd = script_rid2sd(st) ) != NULL ) { - if(!st->rid) - clif_playBGM(sd,map_id2bl(st->oid),name); - else - clif_playBGM(sd,&sd->bl,name); + name = script_getstr(st,2); + + clif_playBGM(sd, name); } return 0; } -int playBGM_sub(struct block_list* bl,va_list ap) +static int playBGM_sub(struct block_list* bl,va_list ap) { - char* name = va_arg(ap,char*); + const char* name = va_arg(ap,const char*); - clif_playBGM((TBL_PC *)bl, bl, name); + clif_playBGM(BL_CAST(BL_PC, bl), name); - return 0; + return 0; +} + +static int playBGM_foreachpc_sub(struct map_session_data* sd, va_list args) +{ + const char* name = va_arg(args, const char*); + + clif_playBGM(sd, name); + return 0; } /*========================================== @@ -10830,33 +10837,29 @@ int playBGM_sub(struct block_list* bl,va_list ap) *------------------------------------------*/ BUILDIN_FUNC(playBGMall) { - struct block_list* bl; const char* name; - bl = (st->rid) ? &(script_rid2sd(st)->bl) : map_id2bl(st->oid); - if (!bl) - return 0; - name = script_getstr(st,2); - if(script_hasdata(st,7)) - { // specified part of map + if( script_hasdata(st,7) ) + {// specified part of map const char* map = script_getstr(st,3); int x0 = script_getnum(st,4); int y0 = script_getnum(st,5); int x1 = script_getnum(st,6); int y1 = script_getnum(st,7); + map_foreachinarea(playBGM_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name); } - else - if(!script_hasdata(st,7)) - { // entire map + else if( script_hasdata(st,3) ) + {// entire map const char* map = script_getstr(st,3); + map_foreachinmap(playBGM_sub, map_mapname2mapid(map), BL_PC, name); } else - { - ShowError("buildin_playBGMall: insufficient arguments for specific area broadcast.\n"); + {// entire server + map_foreachpc(&playBGM_foreachpc_sub, name); } return 0; |