msp.c

demise/src/msp.c · 5.8 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Dystopia Mud improvements copyright (C) 2000, 2001 by Brian Graversen  *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/

/*
 * A quick hack to get support for the mud sound protocol by Jobo.
 */
//Fixed to work with Acrania by Malstar.

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

/* Point to the location on the net where the sound files
 * are located. If no location are given, the players will
 * have to download the sound files before they use the
 * sound protocol.
 */
#define SOUND_URL  "http://mud.acrania.net/msp/"
#define DEF_DAY    "Default.mid"
#define DEF_FIGHT  "Fight.mid"

void
do_msp (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (IS_SET (ch->evenmore, EM_MUSIC))
    {
      REMOVE_BIT (ch->evenmore, EM_MUSIC);
      send_to_char ("Mud Sound Protocol disabled.\n\r", ch);
      send_to_char ("!!MUSIC(Off)", ch);
    }
  else
    {
      SET_BIT (ch->evenmore, EM_MUSIC);
      send_to_char ("Mud Sound Protocol enabled.\n\r", ch);
      update_msp (ch);
//    ch->msptimer = 120;
    }
  return;
}

void
do_sound (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (IS_SET (ch->evenmore, EM_SOUND))
    {
      REMOVE_BIT (ch->evenmore, EM_SOUND);
      send_to_char ("Sound disabled.\n\r", ch);
    }
  else
    {
      SET_BIT (ch->evenmore, EM_SOUND);
      send_to_char ("Sound enabled.\n\r", ch);
    }
  return;
}

void
send_portal (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(portal.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_redspell (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(red.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_purplespell (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(purple.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_greenspell (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(green.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_yellowspell (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(yellow.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_bluespell (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(blue.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_howl (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(howl.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_detonate (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(detonate.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_eagle (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(eagle.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_thunder (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(thunder.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_teleport (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(teleport.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_decap (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(decap.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
send_losthead (CHAR_DATA * ch)
{
  char buf[200];

  if (!IS_SET (ch->evenmore, EM_SOUND))
    return;
  sprintf (buf, "!!SOUND(losthead.wav U=%s)", SOUND_URL);
  send_to_char (buf, ch);
  return;
}

void
update_music (CHAR_DATA * ch)
{
  char buf[200];
  if (!ch->in_room || !ch->in_room->area)
    return;
  if (!IS_SET (ch->evenmore, EM_MUSIC))
    return;
  /*ch->msptimer--;
     if(ch->msptimer < 0)
     {
     update_msp(ch);
     ch->msptimer = 120;
     } */
  update_msp (ch);
  return;
}

void
update_msp (CHAR_DATA * ch)
{
  char buf[200];
  if (ch->fighting == NULL)
    sprintf (buf, "!!MUSIC(%s L=-1 U=%s%s)", DEF_DAY, SOUND_URL, DEF_DAY);
  else
    sprintf (buf, "!!MUSIC(%s L=-1 U=%s%s)", DEF_FIGHT, SOUND_URL, DEF_FIGHT);
  send_to_char (buf, ch);
}

Site Stats

Snippets: 1791
Codebases: 571