Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » AFK 1.75 overland.c sound fix...
Forum Rules | Mark all | Recent Posts

AFK 1.75 overland.c sound fixes
< Newer Topic :: Older Topic > if you use MSP that is

Pages:<< prev 1 next >>
* #1 Aug 30, 2005, 10:16 am   Last edited Aug 31, 2005, 11:28 am by Moonwolf
Go to the top of the page
Go to the bottom of the page

Moonwolf

GroupMembers
Posts43
JoinedAug 25, 2005

Edited, SEE BELOW
       
Post is unread #2 Aug 31, 2005, 9:29 am   Last edited Aug 31, 2005, 11:24 am by Moonwolf
Go to the top of the page
Go to the bottom of the page

Moonwolf

GroupMembers
Posts43
JoinedAug 25, 2005

OK, this is going to get ugly, but it works, and fixes the problems spotted so far. it also has the bonus that it adds the MSP check to overland music, which I forgot to do.

So, this patch basically will

a) play music when the player leaves an area to the overland if they are set for MSP
b) stop playing music when they leave the overland into an area
c) not play overland music if they enter via a watchtower
d) not play music (or have to stop it) if they are looking from an area into the overland.

in overland.c

FIND
void enter_map( CHAR_DATA * ch, EXIT_DATA * pexit, int x, int y, int continent )

Replace the entire enter_map() function with this:
/* How one gets from a normal zone onto the overland, via an exit flagged as EX_OVERLAND */
void enter_map( CHAR_DATA * ch, EXIT_DATA * pexit, int x, int y, int continent )
{   
   ROOM_INDEX_DATA *maproom = NULL, *original;
      
   if( continent < 0 )  /* -1 means you came in from a regular area exit */
      maproom = find_continent( ch, ch->in_room );
   
   else  /* Means you are either an immortal using the goto command, or a mortal who teleported */
   {
      switch ( continent )
      {
         case ACON_ALSHEROK:
            maproom = get_room_index( OVERLAND_ALSHEROK );
            ch->map = MAP_ALSHEROK;
            break;
         case ACON_ELETAR:
            maproom = get_room_index( OVERLAND_ELETAR );
            ch->map = MAP_ELETAR;
            break;
         case ACON_ALATIA:
            maproom = get_room_index( OVERLAND_ALATIA );
            ch->map = MAP_ALATIA;
            break;
         default:
            bug( "Invalid target map specified: %d", continent );
            return;
      }
   }
            
   /*
    * Hopefully this hack works
    */
   if( pexit && IS_ROOM_FLAG( pexit->to_room, ROOM_WATCHTOWER ) )
      maproom = pexit->to_room;
            
   if( !maproom )  
   {   
      bug( "%s", "enter_map: Overland map room is missing!" );
      send_to_char( "Woops. Something is majorly wrong here - inform the immortals.\n\r", ch );
      return;
   }
      
   if( !IS_NPC( ch ) )
      SET_PLR_FLAG( ch, PLR_ONMAP );
   else     
   {
      SET_ACT_FLAG( ch, ACT_ONMAP );
      if( ch->sector == -1 && get_terrain( ch->map, x, y ) == ch->in_room->sector_type )
         ch->sector = get_terrain( ch->map, x, y );
      else   
         ch->sector = -2;
   }  
   
   ch->x = x;
   ch->y = y;
    
   original = ch->in_room;
   char_from_room( ch );
   if( !char_to_room( ch, maproom ) )
      log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );
         
   /* 
    * Turn on the overland music
    */
   if( !IS_ROOM_FLAG( maproom, ROOM_WATCHTOWER ) && IS_PLR_FLAG( ch, PLR_MSP ) )
      music_to_char( "wilderness*.mid", 100, ch, FALSE );
   
   collect_followers( ch, original, ch->in_room );
   interpret( ch, "look" );
   return;
}


in leave_map()

FIND:
      REMOVE_PLR_FLAG( ch, PLR_MAPEDIT ); /* Just in case they were editing */


Add after:
      if( IS_PLR_FLAG( ch, PLR_MSP ) )
         reset_music( ch );


find
      if( !IS_PLR_FLAG( ch, PLR_ONMAP ) )
         reset_music( ch );  


and comment it out. (it should be right at the end of leave_map() )

that will fix the music turning off when players exit the overland. the stock version of it being at the end of leave_map doesn't work, for whatever reason !!MUSIC(Off) has to be sent earlier in the function. I have a feeling that it might be related to the way MXP/MSP is tagged in the room descriptions, and the place !!MUSIC(Off) is being sent in the whole process, but it's not being parsed as an MSP command in it's current location, it has to be sooner.

in act_info.c

in do_look()
FIND:
   int number, cnt;

REPLACE WITH:
   int number, cnt, tmp_msp;

FIND:
                  if( IS_EXIT_FLAG( pexit, EX_OVERLAND ) )
                  {
                     original = ch->in_room;
                     enter_map( ch, pexit, pexit->x, pexit->y, -1 );
                     leave_map( ch, NULL, original );
                  }

REPLACE WITH:
                  if( IS_EXIT_FLAG( pexit, EX_OVERLAND ) )
                  {
                     if( IS_PLR_FLAG( ch, PLR_MSP ) ) {
                        REMOVE_PLR_FLAG( ch, PLR_MSP );
                        tmp_msp = 1;
                     }
                     original = ch->in_room;
                     enter_map( ch, pexit, pexit->x, pexit->y, -1 );
                     leave_map( ch, NULL, original );
                     if( (tmp_msp = 1) )
                        SET_PLR_FLAG( ch, PLR_MSP );
                  }

FIND:
/*
         if( IS_EXIT_FLAG( pexit, EX_OVERLAND ) )
         {
            original = ch->in_room;
            enter_map( ch, pexit, pexit->x, pexit->y, -1 );
                     
            char_from_room( ch );
            if( !char_to_room( ch, original ) )
               log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );
                      
            leave_map( ch, NULL, original );
         }

REPLACE WITH:
                  if( IS_EXIT_FLAG( pexit, EX_OVERLAND ) )
                  {
                     if( IS_PLR_FLAG( ch, PLR_MSP ) )
                     {
                        REMOVE_PLR_FLAG( ch, PLR_MSP );
                        tmp_msp = 1;
                     }
                     original = ch->in_room;
                     enter_map( ch, pexit, pexit->x, pexit->y, -1 );
                     leave_map( ch, NULL, original );
                     if( (tmp_msp = 1) )
                        SET_PLR_FLAG( ch, PLR_MSP );
                  }


That -should- have this problem licked, although not very gracefully. note that the parts to find in act_info.c in do_look() imply samson's fix to leave_map() was applied.

do this, and you should have overland background music all sorted. I also changed the syntax of the filename to be played on entry, from wilderness.mid to wilderness*.mid ... MSP will select randomly from wilderness1.mid, wilderness2.mid, wilderness3.mid, etc using this, allowing admins to add more music files, just rename them wildernessX.mid ... this also works for the other sound effects in MSP.

apologies for the mess of posts while I figured this one.

~miika
       
Pages:<< prev 1 next >>