aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2007-12-13 12:33:31 +0000
committerFilippos Karapetis2007-12-13 12:33:31 +0000
commit8b7f3fae3511893499f71fd4b20007ccf9b04e56 (patch)
treed9c78d652407fe58771f5e2ef0edd953d0393de7
parent2f7539e8659d186a9291973ee661335e0d4395c9 (diff)
downloadscummvm-rg350-8b7f3fae3511893499f71fd4b20007ccf9b04e56.tar.gz
scummvm-rg350-8b7f3fae3511893499f71fd4b20007ccf9b04e56.tar.bz2
scummvm-rg350-8b7f3fae3511893499f71fd4b20007ccf9b04e56.zip
Cleanup
svn-id: r29844
-rw-r--r--engines/cine/bg.cpp6
-rw-r--r--engines/cine/bg_list.cpp32
-rw-r--r--engines/cine/cine.cpp15
-rw-r--r--engines/cine/object.cpp15
-rw-r--r--engines/cine/sound.cpp20
5 files changed, 27 insertions, 61 deletions
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp
index c2ccf4c687..f5b64573af 100644
--- a/engines/cine/bg.cpp
+++ b/engines/cine/bg.cpp
@@ -33,6 +33,8 @@
namespace Cine {
uint16 bgVar0;
+byte *additionalBgTable[9];
+byte currentAdditionalBgIdx = 0, currentAdditionalBgIdx2 = 0;
void loadCtHigh(byte * currentPtr) {
memcpy(page3Raw, currentPtr, 320 * 200);
@@ -115,10 +117,6 @@ byte loadBg(const char *bgName) {
return 0;
}
-byte *additionalBgTable[9];
-byte currentAdditionalBgIdx = 0;
-byte currentAdditionalBgIdx2 = 0;
-
void addBackground(const char *bgName, uint16 bgIdx) {
byte *ptr, *dataPtr;
diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp
index 837744c594..5e4db13911 100644
--- a/engines/cine/bg_list.cpp
+++ b/engines/cine/bg_list.cpp
@@ -39,19 +39,11 @@ uint32 var8;
BGIncrustList *bgIncrustList;
void addToBGList(int16 objIdx, bool addList) {
- int16 x;
- int16 y;
- int16 width;
- int16 height;
- int16 part;
-
- x = objectTable[objIdx].x;
- y = objectTable[objIdx].y;
-
- width = animDataTable[objectTable[objIdx].frame].var1;
- height = animDataTable[objectTable[objIdx].frame].height;
-
- part = objectTable[objIdx].part;
+ int16 x = objectTable[objIdx].x;
+ int16 y = objectTable[objIdx].y;
+ int16 width = animDataTable[objectTable[objIdx].frame].var1;
+ int16 height = animDataTable[objectTable[objIdx].frame].height;
+ int16 part = objectTable[objIdx].part;
if (g_cine->getGameType() == GType_OS) {
drawSpriteRaw2(animDataTable[objectTable[objIdx].frame].ptr1, objectTable[objIdx].part, width, height, page2Raw, x, y);
@@ -64,16 +56,10 @@ void addToBGList(int16 objIdx, bool addList) {
}
void addSpriteFilledToBGList(int16 objIdx, bool addList) {
- int16 x;
- int16 y;
- int16 width;
- int16 height;
-
- x = objectTable[objIdx].x;
- y = objectTable[objIdx].y;
-
- width = animDataTable[objectTable[objIdx].frame].width;
- height = animDataTable[objectTable[objIdx].frame].height;
+ int16 x = objectTable[objIdx].x;
+ int16 y = objectTable[objIdx].y;
+ int16 width = animDataTable[objectTable[objIdx].frame].width;
+ int16 height = animDataTable[objectTable[objIdx].frame].height;
if (animDataTable[objectTable[objIdx].frame].ptr1) {
gfxFillSprite(animDataTable[objectTable[objIdx].frame].ptr1, width / 2, height, page2Raw, x, y);
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index a10c0328ef..287de88378 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -160,26 +160,21 @@ void CineEngine::initialize() {
}
for (i = 0; i < NUM_MAX_ANIMDATA; i++) {
- animDataTable[i].ptr1 = NULL;
- animDataTable[i].ptr2 = NULL;
+ animDataTable[i].ptr1 = animDataTable[i].ptr2 = NULL;
}
- overlayHead.next = NULL;
- overlayHead.previous = NULL;
+ overlayHead.next = overlayHead.previous = NULL;
var8 = 0;
bgIncrustList = NULL;
objScriptList.next = NULL;
- globalScriptsHead.next = NULL;
-
objScriptList.scriptPtr = NULL;
+
+ globalScriptsHead.next = NULL;
globalScriptsHead.scriptPtr = NULL;
- var2 = 0;
- var3 = 0;
- var4 = 0;
- var5 = 0;
+ var2 = var3 = var4 = var5 = 0;
freePrcLinkedList();
diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp
index 23a3697d3c..2c68c214f0 100644
--- a/engines/cine/object.cpp
+++ b/engines/cine/object.cpp
@@ -112,16 +112,11 @@ int8 removeOverlayElement(uint16 objIdx, uint16 param) {
currentHeadPtr = tempHead->next;
}
- if (!currentHeadPtr) {
- return -1;
- }
-
- if (objIdx != currentHeadPtr->objIdx || param != currentHeadPtr->type) {
+ if (!currentHeadPtr || objIdx != currentHeadPtr->objIdx || param != currentHeadPtr->type) {
return -1;
}
- tempHead->next = currentHeadPtr->next;
- tempPtr2 = currentHeadPtr->next;
+ tempHead->next = tempPtr2 = currentHeadPtr->next;
if (!tempPtr2) {
tempPtr2 = &overlayHead;
@@ -143,11 +138,7 @@ int16 freeOverlay(uint16 objIdx, uint16 param) {
currentHeadPtr = previousPtr->next;
}
- if (!currentHeadPtr) {
- return -1;
- }
-
- if (!((currentHeadPtr->objIdx == objIdx) && (currentHeadPtr->type == param))) {
+ if (!currentHeadPtr || !((currentHeadPtr->objIdx == objIdx) && (currentHeadPtr->type == param))) {
return -1;
}
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index e94e9cb1e1..479960a1be 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -304,7 +304,9 @@ void AdlibSoundDriver::initCard() {
OPLWriteReg(_opl, 0xBD, _vibrato);
OPLWriteReg(_opl, 0x08, 0x40);
- int i;
+ int i, j;
+ int oplRegs[] = { 0x60, 0x80, 0x20, 0xE0 };
+
for (i = 0; i < 18; ++i) {
OPLWriteReg(_opl, 0x40 | _operatorsTable[i], 0);
}
@@ -314,17 +316,11 @@ void AdlibSoundDriver::initCard() {
for (i = 0; i < 9; ++i) {
OPLWriteReg(_opl, 0xC0 | i, 0);
}
- for (i = 0; i < 18; ++i) {
- OPLWriteReg(_opl, 0x60 | _operatorsTable[i], 0);
- }
- for (i = 0; i < 18; ++i) {
- OPLWriteReg(_opl, 0x80 | _operatorsTable[i], 0);
- }
- for (i = 0; i < 18; ++i) {
- OPLWriteReg(_opl, 0x20 | _operatorsTable[i], 0);
- }
- for (i = 0; i < 18; ++i) {
- OPLWriteReg(_opl, 0xE0 | _operatorsTable[i], 0);
+
+ for (j = 0; j < 4; j++) {
+ for (i = 0; i < 18; ++i) {
+ OPLWriteReg(_opl, oplRegs[j] | _operatorsTable[i], 0);
+ }
}
OPLWriteReg(_opl, 1, 0x20);