aboutsummaryrefslogtreecommitdiff
path: root/sound.cpp
blob: cfee9440a00834da11b26520956e3ca5503a28e8 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program 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.
 *
 * Change Log:
 * $Log$
 * Revision 1.2  2001/10/16 10:01:48  strigeus
 * preliminary DOTT support
 *
 * Revision 1.1.1.1  2001/10/09 14:30:13  strigeus
 *
 * initial revision
 *
 *
 */

#include "stdafx.h"
#include "scumm.h"

void Scumm::addSoundToQueue(int sound) {
	_vars[VAR_LAST_SOUND] = sound;
	ensureResourceLoaded(4, sound);
	addSoundToQueue2(sound);
}

void Scumm::addSoundToQueue2(int sound) {
	if (_soundQue2Pos < 10) {
		_soundQue2[_soundQue2Pos++] = sound;
	}
}

void Scumm::unkSoundProc22() {
	byte d;
	int i,j;
	int num;
	int16 data[16];

	while (_soundQue2Pos){
		d=_soundQue2[--_soundQue2Pos];
		if (d)
			playSound(d);
	}

#if 0
	for (i=0; i<_soundQuePos; ) {
		num = _soundQue[i++];
		for (j=0; j<16; j++)
			data[j] = 0;
		if (num>0) {
			for (j=0; j<num; j++)
				_soundQue[i+j] = data[j];
			i += num;
			/* XXX: not implemented */
			warning("unkSoundProc22: not implemented");
//			vm.vars[VAR_SOUNDRESULT] = soundProcPtr1(...);
		}
	}
	#endif
	_soundQuePos = 0;
}

void Scumm::playSound(int sound) {
	getResourceAddress(4, sound);
	/* XXX: not implemented */
//	warning("stub playSound(%d)", sound);
}

int Scumm::unkSoundProc23(int a) {
	/* TODO: implement this */
//	warning("unkSoundProc23: not implemented");
	return 0;
}

void Scumm::unkSoundProc1(int a) {
	/* TODO: implement this */
//	warning("unkSoundProc: not implemented");
}

void Scumm::soundKludge(int16 *list) {
	int16 *ptr;
	int i;

	if (list[0]==-1) {
		unkSoundProc22();
		return;
	}
	_soundQue[_soundQuePos++] = 8;

	ptr = _soundQue + _soundQuePos;
	_soundQuePos += 8;

	for (i=0; i<8; i++)
		*ptr++ = list[i];
	if (_soundQuePos > 0x100)
		error("Sound que buffer overflow");
}