File: strack.c

package info (click to toggle)
heroes 0.21-8.4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,740 kB
  • sloc: ansic: 27,964; sh: 4,188; makefile: 694; yacc: 318; sed: 51; lisp: 10; perl: 9
file content (79 lines) | stat: -rw-r--r-- 2,721 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*------------------------------------------------------------------------.
| Copyright 1997, 1998, 2000  Alexandre Duret-Lutz <duret_g@epita.fr>     |
|                                                                         |
| This file is part of Heroes.                                            |
|                                                                         |
| Heroes is free software; you can redistribute it and/or modify it under |
| the terms of the GNU General Public License version 2 as published by   |
| the Free Software Foundation.                                           |
|                                                                         |
| Heroes is distributed in the hope that it will be useful, but WITHOUT   |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or   |
| FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   |
| for more details.                                                       |
|                                                                         |
| You should have received a copy of the GNU General Public License along |
| with this program; if not, write to the Free Software Foundation, Inc., |
| 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                   |
`------------------------------------------------------------------------*/

#include "system.h"
#include "strack.h"
#include "prefs.h"
#include "argv.h"
#include "musicfiles.h"
#include "debugmsg.h"
#include "errors.h"

char *soundtrack_author = 0;
char *soundtrack_title = 0;
a_sprite *soundtrack_author_sprite = 0;
a_sprite *soundtrack_title_sprite = 0;

unsigned last_rank = 0;

static void
load_and_setup_sound_track (a_sound_track* st)
{
  if (st) {
    load_soundtrack (st->filename);
    soundtrack_title = st->title;
    soundtrack_author = st->author;
    last_rank = st->rank;
  } else {
    soundtrack_title = 0;
    soundtrack_author = 0;
  }
  FREE_SPRITE0 (soundtrack_title_sprite);
  FREE_SPRITE0 (soundtrack_author_sprite);
}

void
load_soundtrack_from_alias (const char* alias)
{
  if (!nosound) {
    a_sound_track *st = get_sound_track_from_alias (alias);
    dmsg (D_SOUND_TRACK, "loading sound track from alias %s", alias);
    load_and_setup_sound_track (st);
  }
}

void
load_next_soundtrack (void)
{
  if (!nosound) {
    a_sound_track *st = get_sound_track_from_rank (last_rank + 1);
    dmsg (D_SOUND_TRACK, "loading next sound track");
    load_and_setup_sound_track (st);
  }
}

void
load_prev_soundtrack (void)
{
  if (!nosound) {
    a_sound_track *st = get_sound_track_from_rank (last_rank - 1);
    dmsg (D_SOUND_TRACK, "loading previous sound track");
    load_and_setup_sound_track (st);
  }
}