Normalized types for several variables. Formatting

svn-id: r40521
This commit is contained in:
Eugene Sandulenko 2009-05-13 11:59:49 +00:00
parent 57caa94081
commit d116a94e2b
7 changed files with 71 additions and 55 deletions

View file

@ -186,24 +186,40 @@ Common::Error DrasculaEngine::run() {
memset(VGA, 0, 64000);
takeObject = 0;
menuBar = 0; menuScreen = 0; hasName = 0;
_menuBar = false;
_menuScreen = false;
_hasName = false;
frame_y = 0;
curX = -1; characterMoved = 0; trackProtagonist = 3; num_frame = 0; hare_se_ve = 1;
curX = -1;
characterMoved = 0;
trackProtagonist = 3;
num_frame = 0;
hare_se_ve = 1;
checkFlags = 1;
doBreak = 0;
walkToObject = 0;
stepX = STEP_X; stepY = STEP_Y;
curHeight = CHARACTER_HEIGHT; curWidth = CHARACTER_WIDTH; feetHeight = FEET_HEIGHT;
talkHeight = TALK_HEIGHT; talkWidth = TALK_WIDTH;
stepX = STEP_X;
stepY = STEP_Y;
curHeight = CHARACTER_HEIGHT;
curWidth = CHARACTER_WIDTH;
feetHeight = FEET_HEIGHT;
talkHeight = TALK_HEIGHT;
talkWidth = TALK_WIDTH;
hasAnswer = 0;
savedTime = 0;
breakOut = 0;
vonBraunX = 120; trackVonBraun = 1; vonBraunHasMoved = 0;
vonBraunX = 120;
trackVonBraun = 1;
vonBraunHasMoved = 0;
framesWithoutAction = 0;
term_int = 0;
musicStopped = 0;
selectionMade = 0;
UsingMem = 0;
_useMemForArj = false;
globalSpeed = 0;
curExcuseLook = 0;
curExcuseAction = 0;
@ -467,14 +483,14 @@ bool DrasculaEngine::runCurrentChapter() {
updateEvents();
#endif
if (menuScreen == 0 && takeObject == 1)
if (!_menuScreen && takeObject == 1)
checkObjects();
#ifdef _WIN32_WCE
if (rightMouseButton)
if (menuScreen) {
if (_menuScreen) {
#else
if (rightMouseButton == 1 && menuScreen == 1) {
if (rightMouseButton == 1 && _menuScreen) {
#endif
delay(100);
if (currentChapter == 2)
@ -482,7 +498,7 @@ bool DrasculaEngine::runCurrentChapter() {
else
loadPic(99, backSurface);
setPalette((byte *)&gamePalette);
menuScreen = 0;
_menuScreen = false;
#ifndef _WIN32_WCE
// FIXME: This call here is in hope that it will catch the rightmouseup event so the
// next if block won't be executed. This too is not a good coding practice. I've recoded it
@ -498,7 +514,7 @@ bool DrasculaEngine::runCurrentChapter() {
// Do not show the inventory screen in chapter 5, if the right mouse button is clicked
// while the plug (object 16) is held
// Fixes bug #2059621 - "DRASCULA: Plug bug"
if (rightMouseButton == 1 && menuScreen == 0 &&
if (rightMouseButton == 1 && !_menuScreen &&
!(currentChapter == 5 && pickedObject == 16)) {
#endif
delay(100);
@ -513,14 +529,14 @@ bool DrasculaEngine::runCurrentChapter() {
loadPic("iconsp.alg", backSurface);
else
loadPic("icons.alg", backSurface);
menuScreen = 1;
_menuScreen = true;
#ifndef _WIN32_WCE
updateEvents();
#endif
selectVerb(kVerbNone);
}
if (leftMouseButton == 1 && menuBar == 1) {
if (leftMouseButton == 1 && _menuBar) {
delay(100);
selectVerbFromBar();
} else if (leftMouseButton == 1 && takeObject == 0) {
@ -532,20 +548,20 @@ bool DrasculaEngine::runCurrentChapter() {
return true;
}
menuBar = (mouseY < 24 && menuScreen == 0) ? 1 : 0;
_menuBar = (mouseY < 24 && !_menuScreen) ? true : false;
Common::KeyCode key = getScan();
if (key == Common::KEYCODE_F1 && menuScreen == 0) {
if (key == Common::KEYCODE_F1 && !_menuScreen) {
selectVerb(kVerbLook);
} else if (key == Common::KEYCODE_F2 && menuScreen == 0) {
} else if (key == Common::KEYCODE_F2 && !_menuScreen) {
selectVerb(kVerbPick);
} else if (key == Common::KEYCODE_F3 && menuScreen == 0) {
} else if (key == Common::KEYCODE_F3 && !_menuScreen) {
selectVerb(kVerbOpen);
} else if (key == Common::KEYCODE_F4 && menuScreen == 0) {
} else if (key == Common::KEYCODE_F4 && !_menuScreen) {
selectVerb(kVerbClose);
} else if (key == Common::KEYCODE_F5 && menuScreen == 0) {
} else if (key == Common::KEYCODE_F5 && !_menuScreen) {
selectVerb(kVerbTalk);
} else if (key == Common::KEYCODE_F6 && menuScreen == 0) {
} else if (key == Common::KEYCODE_F6 && !_menuScreen) {
selectVerb(kVerbMove);
} else if (key == Common::KEYCODE_F9) {
volumeControls();
@ -629,7 +645,7 @@ void DrasculaEngine::getStringFromLine(char *buf, int len, char* result) {
bool DrasculaEngine::verify1() {
int l;
if (menuScreen == 1)
if (_menuScreen)
removeObject();
else {
for (l = 0; l < numRoomObjs; l++) {
@ -672,11 +688,11 @@ bool DrasculaEngine::verify1() {
bool DrasculaEngine::verify2() {
int l;
if (menuScreen == 1) {
if (_menuScreen) {
if (pickupObject())
return true;
} else {
if (!strcmp(textName, "hacker") && hasName == 1) {
if (!strcmp(textName, "hacker") && _hasName) {
if (checkAction(50))
return true;
} else {

View file

@ -381,7 +381,7 @@ public:
int x1[40], y1[40], x2[40], y2[40];
int takeObject, pickedObject;
bool _subtitlesDisabled;
int menuBar, menuScreen, hasName;
bool _menuBar, _menuScreen, _hasName;
char textName[20];
int curExcuseLook;
int curExcuseAction;
@ -538,7 +538,7 @@ public:
byte *TryInMem();
int playFrameSSN();
int UsingMem;
bool _useMemForArj;
byte CHUNK;
byte CMP, dacSSN[768];
int FrameSSN;

View file

@ -73,16 +73,16 @@ void DrasculaEngine::moveCursor() {
moveCharacters();
updateRefresh();
if (!strcmp(textName, "hacker") && hasName == 1) {
if (_color != kColorRed && menuScreen == 0)
if (!strcmp(textName, "hacker") && _hasName) {
if (_color != kColorRed && !_menuScreen)
color_abc(kColorRed);
} else if (menuScreen == 0 && _color != kColorLightGreen)
} else if (!_menuScreen && _color != kColorLightGreen)
color_abc(kColorLightGreen);
if (hasName == 1 && menuScreen == 0)
if (_hasName && !_menuScreen)
centerText(textName, mouseX, mouseY);
if (menuScreen == 1)
if (_menuScreen)
showMenu();
else if (menuBar == 1)
else if (_menuBar)
clearMenu();
}
@ -449,7 +449,7 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) {
// Open file
globalSpeed = 1000 / vel;
FrameSSN = 0;
UsingMem = 0;
_useMemForArj = false;
_arj.open(filefli);
mSession = TryInMem();
LastFrame = _system->getMillis();
@ -459,7 +459,7 @@ void DrasculaEngine::playFLI(const char *filefli, int vel) {
term_int = 1;
}
if (UsingMem)
if (_useMemForArj)
free(memPtr);
else
_arj.close();
@ -470,7 +470,7 @@ int DrasculaEngine::playFrameSSN() {
uint32 length;
byte *BufferSSN;
if (!UsingMem)
if (!_useMemForArj)
CHUNK = _arj.readByte();
else {
memcpy(&CHUNK, mSession, 1);
@ -479,7 +479,7 @@ int DrasculaEngine::playFrameSSN() {
switch (CHUNK) {
case kFrameSetPal:
if (!UsingMem) {
if (!_useMemForArj) {
for (int i = 0; i < 256; i++) {
dacSSN[i * 3 + 0] = _arj.readByte();
dacSSN[i * 3 + 1] = _arj.readByte();
@ -495,7 +495,7 @@ int DrasculaEngine::playFrameSSN() {
waitFrameSSN();
break;
case kFrameInit:
if (!UsingMem) {
if (!_useMemForArj) {
CMP = _arj.readByte();
length = _arj.readUint32LE();
} else {
@ -506,7 +506,7 @@ int DrasculaEngine::playFrameSSN() {
}
if (CMP == kFrameCmpRle) {
BufferSSN = (byte *)malloc(length);
if (!UsingMem) {
if (!_useMemForArj) {
_arj.read(BufferSSN, length);
} else {
memcpy(BufferSSN, mSession, length);
@ -525,7 +525,7 @@ int DrasculaEngine::playFrameSSN() {
} else {
if (CMP == kFrameCmpOff) {
BufferSSN = (byte *)malloc(length);
if (!UsingMem) {
if (!_useMemForArj) {
_arj.read(BufferSSN, length);
} else {
memcpy(BufferSSN, mSession, length);
@ -565,7 +565,7 @@ byte *DrasculaEngine::TryInMem() {
if (memPtr == NULL)
return NULL;
_arj.read(memPtr, length);
UsingMem = 1;
_useMemForArj = true;
_arj.close();
return memPtr;

View file

@ -65,7 +65,7 @@ void DrasculaEngine::selectVerbFromBar() {
}
void DrasculaEngine::selectVerb(int verb) {
int c = (menuScreen == 1) ? 0 : 171;
int c = _menuScreen ? 0 : 171;
if (currentChapter == 5) {
if (takeObject == 1 && pickedObject != 16)
@ -84,7 +84,7 @@ void DrasculaEngine::selectVerb(int verb) {
pickedObject = verb;
} else {
takeObject = 0;
hasName = 0;
_hasName = false;
}
}
@ -203,14 +203,14 @@ bool DrasculaEngine::checkMenuFlags() {
}
void DrasculaEngine::showMap() {
hasName = 0;
_hasName = false;
for (int l = 0; l < numRoomObjs; l++) {
if (mouseX > x1[l] && mouseY > y1[l]
&& mouseX < x2[l] && mouseY < y2[l]
&& visible[l] == 1) {
strcpy(textName, objName[l]);
hasName = 1;
_hasName = true;
}
}
}

View file

@ -45,10 +45,10 @@ void DrasculaEngine::pickObject(int object) {
void DrasculaEngine::chooseObject(int object) {
if (currentChapter == 5) {
if (takeObject == 1 && menuScreen == 0 && pickedObject != 16)
if (takeObject == 1 && !_menuScreen && pickedObject != 16)
addObject(pickedObject);
} else {
if (takeObject == 1 && menuScreen == 0)
if (takeObject == 1 && !_menuScreen)
addObject(pickedObject);
}
for (int i = 0; i < OBJHEIGHT; i++)
@ -115,7 +115,7 @@ void DrasculaEngine::checkObjects() {
&& mouseX < x2[l] && mouseY < y2[l]
&& visible[l] == 1 && isDoor[l] == 0) {
strcpy(textName, objName[l]);
hasName = 1;
_hasName = true;
veo = 1;
}
}
@ -124,13 +124,13 @@ void DrasculaEngine::checkObjects() {
&& mouseX < curX + curWidth - 2 && mouseY < curY + curHeight - 2) {
if (currentChapter == 2 || veo == 0) {
strcpy(textName, "hacker");
hasName = 1;
_hasName = true;
veo = 1;
}
}
if (veo == 0)
hasName = 0;
_hasName = false;
}
void DrasculaEngine::removeObject() {

View file

@ -1502,11 +1502,11 @@ bool DrasculaEngine::checkAction(int fl) {
hasAnswer = 1;
if (menuScreen == 1 && roomParse(200, fl)) {
if (_menuScreen && roomParse(200, fl)) {
;
} else if (menuScreen != 1 && roomParse(201, fl)) {
} else if (!_menuScreen && roomParse(201, fl)) {
;
} else if (menuScreen == 1) {
} else if (_menuScreen) {
if (currentChapter == 1) {
hasAnswer = 0;
} else if (currentChapter == 2) {
@ -1607,7 +1607,7 @@ bool DrasculaEngine::checkAction(int fl) {
room(roomNumber, fl);
}
if (hasAnswer == 0 && (hasName == 1 || menuScreen == 1))
if (hasAnswer == 0 && (_hasName || _menuScreen))
room(0, -1);
showCursor();
@ -1646,7 +1646,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
char buffer[256];
int palLevel = 0;
hasName = 0;
_hasName = false;
strcpy(currentData, fileName);

View file

@ -190,7 +190,7 @@ bool DrasculaEngine::loadGame(const char *gameName) {
Common::InSaveFile *sav;
previousMusic = roomMusic;
menuScreen = 0;
_menuScreen = false;
if (currentChapter != 1)
clearRoom();