use CLIP template for clipping, made an array static const and renamed MAX_OBJECTDATA to MAX_VAR

svn-id: r29853
This commit is contained in:
Gregory Montoir 2007-12-13 19:07:10 +00:00
parent ee56120fcf
commit e1b73e47f8
5 changed files with 13 additions and 26 deletions

View File

@ -136,7 +136,7 @@ void CineEngine::initialize() {
objectTable[i].name[0] = 0;
}
for (i = 0; i < NUM_MAX_OBJECTDATA; i++) {
for (i = 0; i < NUM_MAX_VAR; i++) {
globalVars[i] = 0;
}
@ -170,7 +170,7 @@ void CineEngine::initialize() {
objScriptList.next = NULL;
objScriptList.scriptPtr = NULL;
globalScriptsHead.next = NULL;
globalScriptsHead.scriptPtr = NULL;

View File

@ -133,19 +133,10 @@ void setMouseCursor(int cursor) {
}
}
int8 clipColor(int8 color) {
if (color < 0)
color = 0;
else if (color > 7)
color = 7;
return color;
}
static uint16 transformColor(uint16 baseColor, int8 r, int8 g, int8 b) {
int8 oriR = clipColor((baseColor & 0x7) + r);
int8 oriG = clipColor(((baseColor & 0x70) >> 4) + g);
int8 oriB = clipColor(((baseColor & 0x700) >> 8) + b);
int8 oriR = CLIP( (baseColor & 0x007) + r, 0, 7);
int8 oriG = CLIP(((baseColor & 0x070) >> 4) + g, 0, 7);
int8 oriB = CLIP(((baseColor & 0x700) >> 8) + b, 0, 7);
return oriR | (oriG << 4) | (oriB << 8);
}

View File

@ -36,7 +36,7 @@
namespace Cine {
objectStruct objectTable[NUM_MAX_OBJECT];
uint16 globalVars[NUM_MAX_OBJECTDATA + 1];
uint16 globalVars[NUM_MAX_VAR];
overlayHeadElement overlayHead;
void unloadAllMasks(void) {

View File

@ -50,10 +50,10 @@ struct overlayHeadElement {
};
#define NUM_MAX_OBJECT 255
#define NUM_MAX_OBJECTDATA 255
#define NUM_MAX_VAR 256
extern objectStruct objectTable[NUM_MAX_OBJECT];
extern uint16 globalVars[NUM_MAX_OBJECTDATA + 1];
extern uint16 globalVars[NUM_MAX_VAR];
extern overlayHeadElement overlayHead;

View File

@ -304,21 +304,17 @@ void AdlibSoundDriver::initCard() {
OPLWriteReg(_opl, 0xBD, _vibrato);
OPLWriteReg(_opl, 0x08, 0x40);
int i, j;
int oplRegs[] = { 0x60, 0x80, 0x20, 0xE0 };
static const int oplRegs[] = { 0x40, 0x60, 0x80, 0x20, 0xE0 };
for (i = 0; i < 18; ++i) {
OPLWriteReg(_opl, 0x40 | _operatorsTable[i], 0);
}
for (i = 0; i < 9; ++i) {
for (int i = 0; i < 9; ++i) {
OPLWriteReg(_opl, 0xB0 | i, 0);
}
for (i = 0; i < 9; ++i) {
for (int i = 0; i < 9; ++i) {
OPLWriteReg(_opl, 0xC0 | i, 0);
}
for (j = 0; j < 4; j++) {
for (i = 0; i < 18; ++i) {
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 18; ++i) {
OPLWriteReg(_opl, oplRegs[j] | _operatorsTable[i], 0);
}
}