Skip to content

Commit

Permalink
KYRA: (EOB) - fix minor bug (wrongly initialized value) and some rena…
Browse files Browse the repository at this point in the history
…ming
  • Loading branch information
athrxx committed Feb 21, 2012
1 parent 70cfbcd commit 47005de
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions engines/kyra/eobcommon.cpp
Expand Up @@ -201,6 +201,7 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_coneOfColdDest1 = _coneOfColdDest2 = _coneOfColdDest3 = _coneOfColdDest4 = 0;
_coneOfColdGfxTblSize = 0;
_menuButtonDefs = 0;
_updateCharNum = 0;
_menuStringsMain = _menuStringsSaveLoad = _menuStringsOnOff = _menuStringsSpells = 0;
_menuStringsRest = _menuStringsDrop = _menuStringsExit = _menuStringsStarve = 0;
_menuStringsScribe = _menuStringsDrop2 = _menuStringsHead = _menuStringsPoison = 0;
Expand Down
9 changes: 4 additions & 5 deletions engines/kyra/items_eob.cpp
Expand Up @@ -531,7 +531,7 @@ bool EoBCoreEngine::launchObject(int charIndex, Item item, uint16 startBlock, in
setItemPosition((Item *)&_levelBlockProperties[startBlock].drawObjects, startBlock, item, startPos | 4);

t->enable = 1;
t->u2 = 1;
t->starting = 1;
t->flags = 0;
t->direction = dir;
t->distance = 12;
Expand Down Expand Up @@ -559,7 +559,7 @@ void EoBCoreEngine::launchMagicObject(int charIndex, int type, uint16 startBlock
return;

t->enable = 2;
t->u2 = 1;
t->starting = 1;
t->flags = _magicFlightObjectProperties[(type << 2) + 2];
t->direction = dir;
t->distance = _magicFlightObjectProperties[(type << 2) + 1];
Expand All @@ -568,15 +568,14 @@ void EoBCoreEngine::launchMagicObject(int charIndex, int type, uint16 startBlock
t->item = type;
t->objectType = _magicFlightObjectProperties[(type << 2) + 3];
t->attackerId = charIndex;
t->u2 = 1;
t->callBackIndex = _magicFlightObjectProperties[type << 2];
_sceneUpdateRequired = true;
}

bool EoBCoreEngine::updateObjectFlight(EoBFlyingObject *fo, int block, int pos) {
uint8 wallFlags = _wllWallFlags[_levelBlockProperties[block].walls[fo->direction ^ 2]];
if (fo->enable == 1) {
if ((wallFlags & 1) || (fo->u2) || ((wallFlags & 2) && (_dscItemShapeMap[_items[fo->item].icon] >= 15))) {
if ((wallFlags & 1) || (fo->starting) || ((wallFlags & 2) && (_dscItemShapeMap[_items[fo->item].icon] >= 15))) {
getQueuedItem((Item *)&_levelBlockProperties[fo->curBlock].drawObjects, 0, fo->item);
setItemPosition((Item *)&_levelBlockProperties[block].drawObjects, block, fo->item, pos | 4);
fo->curBlock = block;
Expand All @@ -602,7 +601,7 @@ bool EoBCoreEngine::updateObjectFlight(EoBFlyingObject *fo, int block, int pos)
}

bool EoBCoreEngine::updateFlyingObjectHitTest(EoBFlyingObject *fo, int block, int pos) {
if (fo->u2 && (fo->curBlock != _currentBlock || fo->attackerId >= 0) && (!blockHasMonsters(block) || fo->attackerId < 0))
if (fo->starting && (fo->curBlock != _currentBlock || fo->attackerId >= 0) && (!blockHasMonsters(fo->curBlock) || fo->attackerId < 0))
return false;

if (fo->enable == 2) {
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/kyra_rpg.h
Expand Up @@ -70,7 +70,7 @@ struct EoBFlyingObject {
int16 attackerId;
Item item;
uint16 curBlock;
uint16 u2;
uint16 starting;
uint8 u1;
uint8 direction;
uint8 distance;
Expand Down
4 changes: 2 additions & 2 deletions engines/kyra/saveload_eob.cpp
Expand Up @@ -255,7 +255,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
m->attackerId = in.readSint16BE();
m->item = in.readSint16BE();
m->curBlock = in.readUint16BE();
m->u2 = in.readUint16BE();
m->starting = in.readUint16BE();
m->u1 = in.readByte();
m->direction = in.readByte();
m->distance = in.readByte();
Expand Down Expand Up @@ -494,7 +494,7 @@ Common::Error EoBCoreEngine::saveGameStateIntern(int slot, const char *saveName,
out->writeSint16BE(m->attackerId);
out->writeSint16BE(m->item);
out->writeUint16BE(m->curBlock);
out->writeUint16BE(m->u2);
out->writeUint16BE(m->starting);
out->writeByte(m->u1);
out->writeByte(m->direction);
out->writeByte(m->distance);
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/timer_eob.cpp
Expand Up @@ -195,7 +195,7 @@ void EoBCoreEngine::timerProcessFlyingObjects(int timerNum) {
if (newBl) {
bl = calcNewBlockPosition(fo->curBlock, fo->direction);
pos &= 3;
fo->u2 = 0;
fo->starting = 0;
}

if (updateObjectFlight(fo, bl, pos)) {
Expand Down

0 comments on commit 47005de

Please sign in to comment.