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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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