aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2011-11-22 16:16:55 +0100
committerBertrand Augereau2011-11-22 17:00:22 +0100
commite51bcdbb53169474c8b5f6ce51271fd2f14c14d2 (patch)
tree68cb14cb1085680f3ebce94fb11859518f247385
parentab41e41b0f5aed647cc7b4fc9727711b260e978f (diff)
downloadscummvm-rg350-e51bcdbb53169474c8b5f6ce51271fd2f14c14d2.tar.gz
scummvm-rg350-e51bcdbb53169474c8b5f6ce51271fd2f14c14d2.tar.bz2
scummvm-rg350-e51bcdbb53169474c8b5f6ce51271fd2f14c14d2.zip
DREAMWEB: Sound structure
-rw-r--r--engines/dreamweb/structs.h13
-rw-r--r--engines/dreamweb/stubs.cpp34
2 files changed, 27 insertions, 20 deletions
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index beab862aaf..5b73118a31 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -247,3 +247,16 @@ struct RoomPaths {
PathSegment segments[24];
};
+struct Sound {
+ uint8 emmPage;
+ uint8 w1_lo;
+ uint8 w1_hi;
+ uint16 offset() const { return READ_LE_UINT16(&w1_lo); }
+ void setOffset(uint16 v) { WRITE_LE_UINT16(&w1_lo, v); }
+ uint8 w3_lo;
+ uint8 w3_hi;
+ uint16 blockCount() const { return READ_LE_UINT16(&w3_lo); }
+ void setBlockCount(uint16 v) { WRITE_LE_UINT16(&w3_lo, v); }
+ uint8 b5;
+};
+
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 668e388453..094b4bb438 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -2206,27 +2206,24 @@ Frame * DreamGenContext::tempGraphics3() {
void DreamGenContext::playchannel0(uint8 index, uint8 repeat) {
if (data.byte(kSoundint) == 255)
return;
- push(es);
- push(bx);
+
data.byte(kCh0playing) = index;
+ Sound *soundBank;
if (index >= 12) {
- es = data.word(kSounddata2);
+ soundBank = (Sound *)segRef(data.word(kSounddata2)).ptr(0, 0);
index -= 12;
} else
- es = data.word(kSounddata);
+ soundBank = (Sound *)segRef(data.word(kSounddata)).ptr(0, 0);
data.byte(kCh0repeat) = repeat;
- bx = index * 6;
- data.word(kCh0emmpage) = es.byte(bx);
- data.word(kCh0offset) = es.word(bx+1);
- data.word(kCh0blockstocopy) = es.word(bx+3);
+ data.word(kCh0emmpage) = soundBank[index].emmPage;
+ data.word(kCh0offset) = soundBank[index].offset();
+ data.word(kCh0blockstocopy) = soundBank[index].blockCount();
if (repeat) {
data.word(kCh0oldemmpage) = data.word(kCh0emmpage);
data.word(kCh0oldoffset) = data.word(kCh0offset);
data.word(kCh0oldblockstocopy) = data.word(kCh0blockstocopy);
}
- bx = pop();
- es = pop();
}
void DreamGenContext::playchannel0() {
@@ -2238,21 +2235,18 @@ void DreamGenContext::playchannel1(uint8 index) {
return;
if (data.byte(kCh1playing) == 7)
return;
- push(es);
- push(bx);
+
data.byte(kCh1playing) = index;
+ Sound *soundBank;
if (index >= 12) {
- es = data.word(kSounddata2);
+ soundBank = (Sound *)segRef(data.word(kSounddata2)).ptr(0, 0);
index -= 12;
} else
- es = data.word(kSounddata);
+ soundBank = (Sound *)segRef(data.word(kSounddata)).ptr(0, 0);
- bx = index * 6;
- data.word(kCh1emmpage) = es.byte(bx);
- data.word(kCh1offset) = es.word(bx+1);
- data.word(kCh1blockstocopy) = es.word(bx+3);
- bx = pop();
- es = pop();
+ data.word(kCh1emmpage) = soundBank[index].emmPage;
+ data.word(kCh1offset) = soundBank[index].offset();
+ data.word(kCh1blockstocopy) = soundBank[index].blockCount();
}
void DreamGenContext::playchannel1() {