[Scummvm-cvs-logs] scummvm master -> e51bcdbb53169474c8b5f6ce51271fd2f14c14d2

tramboi bertrand_augereau at yahoo.fr
Tue Nov 22 17:14:06 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e51bcdbb53 DREAMWEB: Sound structure


Commit: e51bcdbb53169474c8b5f6ce51271fd2f14c14d2
    https://github.com/scummvm/scummvm/commit/e51bcdbb53169474c8b5f6ce51271fd2f14c14d2
Author: Bertrand Augereau (bertrand_augereau at yahoo.fr)
Date: 2011-11-22T08:00:22-08:00

Commit Message:
DREAMWEB: Sound structure

Changed paths:
    engines/dreamweb/structs.h
    engines/dreamweb/stubs.cpp



diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index beab862..5b73118 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 668e388..094b4bb 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() {






More information about the Scummvm-git-logs mailing list