- Removed the unused hay_sb variable (originally, it was meant to check if the sound is active or not)

- mesa -> volumeControls
- Cleanup of volumeControls()
- fliplay -> playFLI, and removed openSSN() and EndSSN()
- Some translations:
button_izq -> leftMouseButton
button_dch -> rightMouseButton
animation_rayo -> animation_ray
hueso -> bone
vuela -> fly

svn-id: r32552
This commit is contained in:
Filippos Karapetis 2008-06-05 08:25:29 +00:00
parent 5acc34fb77
commit fe2fcbf2d5
4 changed files with 97 additions and 137 deletions

View file

@ -58,7 +58,7 @@ void DrasculaEngine::animation_1_1() {
while (term_int == 0) {
playMusic(29);
fliplay("logoddm.bin", 9);
playFLI("logoddm.bin", 9);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
delay(600);
@ -72,7 +72,7 @@ void DrasculaEngine::animation_1_1() {
delay(500);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
fliplay("logoalc.bin", 8);
playFLI("logoalc.bin", 8);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
clearRoom();
@ -97,7 +97,7 @@ void DrasculaEngine::animation_1_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
fliplay("scrollb.bin", 9);
playFLI("scrollb.bin", 9);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
@ -373,7 +373,7 @@ void DrasculaEngine::animation_1_1() {
playMusic(2);
pause(5);
fliplay("intro.bin", 12);
playFLI("intro.bin", 12);
term_int = 1;
}
clearRoom();
@ -1419,7 +1419,7 @@ void DrasculaEngine::animation_6_3() {
updateScreen();
}
void DrasculaEngine::animation_rayo() {
void DrasculaEngine::animation_ray() {
loadPic("anr_1.alg", frontSurface, HALF_PAL);
loadPic("anr_2.alg", extraSurface);
loadPic("anr_3.alg", backSurface);
@ -1556,9 +1556,9 @@ void DrasculaEngine::animation_4_5() {
void DrasculaEngine::animation_5_5(){
int h;
int frame = 0;
int hueso_x[] = {1, 99, 197, 1, 99, 197, 1, 99, 197};
int hueso_y[] = {1, 1, 1, 66, 66, 66, 131, 131, 131};
int vuela_x[] = {1, 63, 125, 187, 249};
int boneX[] = {1, 99, 197, 1, 99, 197, 1, 99, 197};
int boneY[] = {1, 1, 1, 66, 66, 66, 131, 131, 131};
int flyX[] = {1, 63, 125, 187, 249};
int pixelX = curX - 53, pixelY = curY - 9;
withoutVerb();
@ -1575,7 +1575,7 @@ void DrasculaEngine::animation_5_5(){
for (frame = 0; frame < 9; frame++) {
pause(3);
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
copyRect(hueso_x[frame], hueso_y[frame], pixelX, pixelY, 97, 64, backSurface, screenSurface);
copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, backSurface, screenSurface);
updateScreen(pixelX, pixelY, pixelX,pixelY, 97,64, screenSurface);
}
@ -1585,7 +1585,7 @@ void DrasculaEngine::animation_5_5(){
for (frame = 0; frame < 9; frame++) {
pause(3);
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
copyRect(hueso_x[frame], hueso_y[frame], pixelX, pixelY, 97, 64, frontSurface, screenSurface);
copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, frontSurface, screenSurface);
updateScreen(pixelX, pixelY, pixelX,pixelY, 97, 64, screenSurface);
}
@ -1607,12 +1607,12 @@ void DrasculaEngine::animation_5_5(){
pause(9);
for (frame = 0; frame < 5; frame++) {
pause(3);
copyBackground(vuela_x[frame], 1, 174, 79, 61, 109, backSurface, screenSurface);
copyBackground(flyX[frame], 1, 174, 79, 61, 109, backSurface, screenSurface);
updateScreen(174, 79, 174, 79, 61, 109, screenSurface);
}
for (frame = 0; frame < 5; frame++) {
pause(3);
copyBackground(vuela_x[frame], 1, 174, 79, 61, 109, extraSurface, screenSurface);
copyBackground(flyX[frame], 1, 174, 79, 61, 109, extraSurface, screenSurface);
updateScreen(174, 79, 174, 79, 61, 109, screenSurface);
}
updateScreen(0, 0, 0, 0, 320, 200, drawSurface1);
@ -1682,7 +1682,6 @@ void DrasculaEngine::animation_12_5() {
const int rayX[] = {1, 46, 91, 136, 181, 226, 271, 181};
const int frusky_x[] = {100, 139, 178, 217, 100, 178, 217, 139, 100, 139};
const int elfrusky_x[] = {1, 68, 135, 1, 68, 135, 1, 68, 135, 68, 1, 135, 68, 135, 68};
//const int humo_x[] = {1, 29, 57, 85, 113, 141, 169, 197, 225};
int color, component;
char fade;
@ -2076,13 +2075,13 @@ void DrasculaEngine::animation_9_6() {
playMusic(17);
fadeToBlack(1);
clearRoom();
fliplay("qpc.bin", 1);
playFLI("qpc.bin", 1);
MusicFadeout();
stopMusic();
clearRoom();
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, v_cd * 16);
playMusic(3);
fliplay("crd.bin", 1);
playFLI("crd.bin", 1);
stopMusic();
}

View file

@ -147,7 +147,6 @@ int DrasculaEngine::go() {
allocMemory();
hay_sb = 1;
withVoices = 0;
selectionMade = 0;
@ -169,7 +168,7 @@ int DrasculaEngine::go() {
} else if (currentChapter == 4) {
loadPic(96, frontSurface, COMPLETE_PAL);
if (hay_que_load == 0)
animation_rayo();
animation_ray();
loadPic(96, frontSurface);
clearRoom();
loadPic(99, backSurface);
@ -212,7 +211,6 @@ int DrasculaEngine::go() {
}
void DrasculaEngine::quitGame() {
if (hay_sb == 1)
stopSound();
clearRoom();
black();
@ -569,7 +567,7 @@ bool DrasculaEngine::escoba() {
if (menuScreen == 0 && takeObject == 1)
checkObjects();
if (button_dch == 1 && menuScreen == 1) {
if (rightMouseButton == 1 && menuScreen == 1) {
delay(100);
if (currentChapter == 2)
loadPic(menuBackground, backSurface);
@ -581,7 +579,7 @@ bool DrasculaEngine::escoba() {
if (currentChapter != 3)
cont_sv = 0;
}
if (button_dch == 1 && menuScreen == 0) {
if (rightMouseButton == 1 && menuScreen == 0) {
delay(100);
characterMoved = 0;
if (trackProtagonist == 2)
@ -601,18 +599,18 @@ bool DrasculaEngine::escoba() {
cont_sv = 0;
}
if (button_izq == 1 && menuBar == 1) {
if (leftMouseButton == 1 && menuBar == 1) {
delay(100);
selectVerbFromBar();
if (currentChapter != 3)
cont_sv = 0;
} else if (button_izq == 1 && takeObject == 0) {
} else if (leftMouseButton == 1 && takeObject == 0) {
delay(100);
if (verify1())
return true;
if (currentChapter != 3)
cont_sv = 0;
} else if (button_izq == 1 && takeObject == 1) {
} else if (leftMouseButton == 1 && takeObject == 1) {
if (verify2())
return true;
if (currentChapter != 3)
@ -646,7 +644,7 @@ bool DrasculaEngine::escoba() {
if (currentChapter != 3)
cont_sv = 0;
} else if (key == Common::KEYCODE_F9) {
mesa();
volumeControls();
if (currentChapter != 3)
cont_sv = 0;
} else if (key == Common::KEYCODE_F10) {
@ -1092,16 +1090,9 @@ void DrasculaEngine::checkObjects() {
}
}
if (currentChapter == 2) {
if (mouseX > curX + 2 && mouseY > curY + 2
&& mouseX < curX + curWidth - 2 && mouseY < curY + curHeight - 2) {
strcpy(textName, "hacker");
hasName = 1;
veo = 1;
}
} else {
if (mouseX > curX + 2 && mouseY > curY + 2
&& mouseX < curX + curWidth - 2 && mouseY < curY + curHeight - 2 && veo == 0) {
if (currentChapter == 2 || veo == 0) {
strcpy(textName, "hacker");
hasName = 1;
veo = 1;
@ -1221,16 +1212,16 @@ void DrasculaEngine::updateEvents() {
mouseY = event.mouse.y;
break;
case Common::EVENT_LBUTTONDOWN:
button_izq = 1;
leftMouseButton = 1;
break;
case Common::EVENT_LBUTTONUP:
button_izq = 0;
leftMouseButton = 0;
break;
case Common::EVENT_RBUTTONDOWN:
button_dch = 1;
rightMouseButton = 1;
break;
case Common::EVENT_RBUTTONUP:
button_dch = 0;
rightMouseButton = 0;
break;
case Common::EVENT_QUIT:
// TODO
@ -1244,10 +1235,8 @@ void DrasculaEngine::updateEvents() {
}
void DrasculaEngine::selectVerb(int verbo) {
int c = 171;
int c = (menuScreen == 1) ? 0 : 171;
if (menuScreen == 1)
c = 0;
if (currentChapter == 5) {
if (takeObject == 1 && pickedObject != 16)
addObject(pickedObject);
@ -1262,24 +1251,33 @@ void DrasculaEngine::selectVerb(int verbo) {
pickedObject = verbo;
}
void DrasculaEngine::mesa() {
int nivel_master, nivel_voc, nivel_cd;
void DrasculaEngine::updateVolume(Audio::Mixer::SoundType soundType, int prevVolume) {
int vol = _mixer->getVolumeForSoundType(soundType) / 16;
if (mouseY < prevVolume && vol < 15)
vol++;
if (mouseY > prevVolume && vol > 0)
vol--;
_mixer->setVolumeForSoundType(soundType, vol * 16);
}
void DrasculaEngine::volumeControls() {
int masterVolume, voiceVolume, musicVolume;
copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface);
updateScreen(73, 63, 73, 63, 177, 97, screenSurface);
for (;;) {
nivel_master = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4);
nivel_voc = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4);
nivel_cd = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4);
masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4);
voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4);
musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4);
for (;;) {
updateRoom();
copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface);
copyBackground(183, 56, 82, nivel_master, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4), tableSurface, screenSurface);
copyBackground(183, 56, 138, nivel_voc, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4), tableSurface, screenSurface);
copyBackground(183, 56, 194, nivel_cd, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4), tableSurface, screenSurface);
copyBackground(183, 56, 82, masterVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4), tableSurface, screenSurface);
copyBackground(183, 56, 138, voiceVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4), tableSurface, screenSurface);
copyBackground(183, 56, 194, musicVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4), tableSurface, screenSurface);
setCursorTable();
@ -1287,37 +1285,25 @@ void DrasculaEngine::mesa() {
updateEvents();
if (button_dch == 1) {
if (rightMouseButton == 1) {
delay(100);
break;
}
if (button_izq == 1) {
if (leftMouseButton == 1) {
delay(100);
if (mouseX > 80 && mouseX < 121) {
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16;
if (mouseY < nivel_master && vol < 15)
vol++;
if (mouseY > nivel_master && vol > 0)
vol--;
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol * 16);
updateVolume(Audio::Mixer::kPlainSoundType, mouseY);
masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4);
}
if (mouseX > 136 && mouseX < 178) {
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16;
if (mouseY < nivel_voc && vol < 15)
vol++;
if (mouseY > nivel_voc && vol > 0)
vol--;
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol * 16);
updateVolume(Audio::Mixer::kSFXSoundType, mouseY);
voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4);
}
if (mouseX > 192 && mouseX < 233) {
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16;
if (mouseY < nivel_cd && vol < 15)
vol++;
if (mouseY > nivel_cd && vol > 0)
vol--;
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol * 16);
updateVolume(Audio::Mixer::kMusicSoundType, mouseY);
musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4);
}
}
@ -1372,7 +1358,7 @@ bool DrasculaEngine::saveLoadScreen() {
updateEvents();
if (button_izq == 1) {
if (leftMouseButton == 1) {
delay(50);
for (n = 0; n < NUM_SAVES; n++) {
if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) {
@ -1662,7 +1648,7 @@ void DrasculaEngine::screenSaver() {
// end of efecto()
updateEvents();
if (button_dch == 1 || button_izq == 1)
if (rightMouseButton == 1 || leftMouseButton == 1)
break;
if (mouseX != xr)
break;
@ -1676,13 +1662,28 @@ void DrasculaEngine::screenSaver() {
loadPic(roomNumber, drawSurface1, HALF_PAL);
}
void DrasculaEngine::fliplay(const char *filefli, int vel) {
openSSN(filefli, vel);
void DrasculaEngine::playFLI(const char *filefli, int vel) {
// Open file
MiVideoSSN = (byte *)malloc(64256);
globalSpeed = 1000 / vel;
FrameSSN = 0;
UsingMem = 0;
if (MiVideoSSN == NULL)
return;
_arj.open(filefli);
mSession = TryInMem();
LastFrame = _system->getMillis();
while (playFrameSSN() && (!term_int)) {
if (getScan() == Common::KEYCODE_ESCAPE)
term_int = 1;
}
EndSSN();
free(MiVideoSSN);
if (UsingMem)
free(pointer);
else
_arj.close();
}
void DrasculaEngine::fadeFromBlack(int fadeSpeed) {
@ -1797,7 +1798,6 @@ void DrasculaEngine::playSound(int soundNum) {
char file[20];
sprintf(file, "s%i.als", soundNum);
if (hay_sb == 1)
playFile(file);
}
@ -1974,11 +1974,9 @@ void DrasculaEngine::hiccup(int counter) {
void DrasculaEngine::finishSound() {
delay(1);
if (hay_sb == 1) {
while (soundIsActive())
_system->delayMillis(10);
}
}
void DrasculaEngine::playMusic(int p) {
AudioCD.stop();
@ -2636,18 +2634,6 @@ void DrasculaEngine::enterName() {
}
}
void DrasculaEngine::openSSN(const char *Name, int Pause) {
MiVideoSSN = (byte *)malloc(64256);
globalSpeed = 1000 / Pause;
FrameSSN = 0;
UsingMem = 0;
if (MiVideoSSN == NULL)
return;
_arj.open(Name);
mSession = TryInMem();
LastFrame = _system->getMillis();
}
int DrasculaEngine::playFrameSSN() {
int Exit = 0;
uint32 Lengt;
@ -2742,15 +2728,6 @@ int DrasculaEngine::playFrameSSN() {
return (!Exit);
}
void DrasculaEngine::EndSSN() {
free(MiVideoSSN);
if (UsingMem)
free(pointer);
else {
_arj.close();
}
}
byte *DrasculaEngine::TryInMem() {
int Lengt;
@ -3201,7 +3178,7 @@ void DrasculaEngine::converse(const char *fileName) {
updateScreen();
if ((button_izq == 1) && (game1 == 2)) {
if ((leftMouseButton == 1) && (game1 == 2)) {
delay(100);
used1 = 1;
talk(phrase1, sound1);
@ -3209,7 +3186,7 @@ void DrasculaEngine::converse(const char *fileName) {
grr();
else
response(answer1);
} else if ((button_izq == 1) && (game2 == 2)) {
} else if ((leftMouseButton == 1) && (game2 == 2)) {
delay(100);
used2 = 1;
talk(phrase2, sound2);
@ -3217,7 +3194,7 @@ void DrasculaEngine::converse(const char *fileName) {
grr();
else
response(answer2);
} else if ((button_izq == 1) && (game3 == 2)) {
} else if ((leftMouseButton == 1) && (game3 == 2)) {
delay(100);
used3 = 1;
talk(phrase3, sound3);
@ -3225,13 +3202,13 @@ void DrasculaEngine::converse(const char *fileName) {
grr();
else
response(answer3);
} else if ((button_izq == 1) && (game4 == 2)) {
} else if ((leftMouseButton == 1) && (game4 == 2)) {
delay(100);
talk(phrase4, sound4);
breakOut = 1;
}
if (button_izq == 1) {
if (leftMouseButton == 1) {
delay(100);
color_abc(kColorLightGreen);
}
@ -3252,12 +3229,8 @@ void DrasculaEngine::converse(const char *fileName) {
void DrasculaEngine::response(int function) {
if (currentChapter == 1) {
if (function == 10)
talk_drunk(1);
else if (function == 11)
talk_drunk(2);
else if (function == 12)
talk_drunk(3);
if (function >= 10 && function <= 12)
talk_drunk(function - 9);
} else if (currentChapter == 2) {
if (function == 8)
animation_8_2();
@ -3351,10 +3324,8 @@ void DrasculaEngine::addObject(int osj) {
}
void DrasculaEngine::stopSound() {
if (hay_sb == 1) {
_mixer->stopHandle(_soundHandle);
}
}
void DrasculaEngine::MusicFadeout() {
int org_vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
@ -3615,7 +3586,6 @@ void DrasculaEngine::grr() {
color_abc(kColorDarkGreen);
if (hay_sb == 1)
playFile("s10.als");
updateRoom();

View file

@ -234,7 +234,6 @@ public:
Common::ArjFile _arj;
int hay_sb;
int previousMusic, roomMusic;
int roomNumber;
char roomDisk[20];
@ -302,8 +301,8 @@ public:
int mouseX;
int mouseY;
int mouseY_ant;
int button_izq;
int button_dch;
int leftMouseButton;
int rightMouseButton;
bool escoba();
void black();
@ -329,7 +328,8 @@ public:
bool verify2();
Common::KeyCode getScan();
void selectVerb(int);
void mesa();
void updateVolume(Audio::Mixer::SoundType soundType, int prevVolume);
void volumeControls();
bool saveLoadScreen();
void print_abc(const char *, int, int);
void delay(int ms);
@ -338,7 +338,7 @@ public:
void chooseObject(int objeto);
void addObject(int);
int removeObject(int osj);
void fliplay(const char *filefli, int vel);
void playFLI(const char *filefli, int vel);
void fadeFromBlack(int fadeSpeed);
char adjustToVGA(char value);
void color_abc(int cl);
@ -404,13 +404,11 @@ public:
void setCursorTable();
void enterName();
bool soundIsActive();
void openSSN(const char *Name, int Pause);
void WaitFrameSSN();
void MixVideo(byte *OldScreen, byte *NewScreen);
void Des_RLE(byte *BufferRLE, byte *MiVideoRLE);
void Des_OFF(byte *BufferOFF, byte *MiVideoOFF, int Lenght);
byte *TryInMem();
void EndSSN();
int playFrameSSN();
byte *AuxBuffOrg;
@ -553,7 +551,7 @@ public:
void animation_4_3();
void animation_5_3();
void animation_6_3();
void animation_rayo();
void animation_ray();
//
void animation_1_4();
void animation_2_4();

View file

@ -33,7 +33,6 @@ int x_talk_izq[6] = {145, 169, 193, 217, 241, 265};
void DrasculaEngine::talkInit(const char *filename) {
_rnd->setSeed((unsigned int)_system->getMillis() / 2);
if (hay_sb == 1)
playFile(filename);
}
@ -41,14 +40,8 @@ bool DrasculaEngine::isTalkFinished(int* length) {
byte key = getScan();
if (key != 0)
stopSound();
if (hay_sb == 1) {
if (soundIsActive())
return false;
} else {
length -= 2;
if (length > 0)
return false;
}
return true;
}