EFH: Some renaming and comments

This commit is contained in:
Strangerke 2023-02-05 11:13:14 +01:00 committed by Eugene Sandulenko
parent 9c02a5b55f
commit a24acf909d
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
8 changed files with 71 additions and 69 deletions

View File

@ -2055,35 +2055,35 @@ bool EfhEngine::handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId
if (imageSetId != -1 && *_imp2PtrArray[imageSetId] != 0x30) if (imageSetId != -1 && *_imp2PtrArray[imageSetId] != 0x30)
displayMiddleLeftTempText(_imp2PtrArray[imageSetId], true); displayMiddleLeftTempText(_imp2PtrArray[imageSetId], true);
} else if (arg8 == 0) { } else if (arg8 == 0) {
if (_mapSpecialTiles[_techId][tileId]._field3 == 0xFF) { if (_mapSpecialTiles[_techId][tileId]._triggerType == 0xFF) {
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId);
return true; return true;
} }
if (_mapSpecialTiles[_techId][tileId]._field3 == 0xFE) { if (_mapSpecialTiles[_techId][tileId]._triggerType == 0xFE) {
for (int counter = 0; counter < _teamSize; ++counter) { for (int counter = 0; counter < _teamSize; ++counter) {
if (_teamChar[counter]._id == -1) if (_teamChar[counter]._id == -1)
continue; continue;
if (_teamChar[counter]._id == _mapSpecialTiles[_techId][tileId]._triggerId) { if (_teamChar[counter]._id == _mapSpecialTiles[_techId][tileId]._triggerValue) {
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId);
return true; return true;
} }
} }
} else if (_mapSpecialTiles[_techId][tileId]._field3 == 0xFD) { } else if (_mapSpecialTiles[_techId][tileId]._triggerType == 0xFD) {
for (int counter = 0; counter < _teamSize; ++counter) { for (int counter = 0; counter < _teamSize; ++counter) {
if (_teamChar[counter]._id == -1) if (_teamChar[counter]._id == -1)
continue; continue;
for (uint var2 = 0; var2 < 10; ++var2) { for (uint var2 = 0; var2 < 10; ++var2) {
if (_npcBuf[_teamChar[counter]._id]._inventory[var2]._ref == _mapSpecialTiles[_techId][tileId]._triggerId) { if (_npcBuf[_teamChar[counter]._id]._inventory[var2]._ref == _mapSpecialTiles[_techId][tileId]._triggerValue) {
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId);
return true; return true;
} }
} }
} }
// original makes a useless check on (_mapSpecialTile[tileId]._field3 > 0x7F) // original makes a useless check on (_mapSpecialTile[tileId]._triggerType > 0x7F)
} else if (_mapSpecialTiles[_techId][tileId]._field3 <= 0x77) { } else if (_mapSpecialTiles[_techId][tileId]._triggerType <= 0x77) {
int16 scoreId = _mapSpecialTiles[_techId][tileId]._field3; int16 scoreId = _mapSpecialTiles[_techId][tileId]._triggerType;
for (int counter = 0; counter < _teamSize; ++counter) { for (int counter = 0; counter < _teamSize; ++counter) {
if (_teamChar[counter]._id == -1) if (_teamChar[counter]._id == -1)
continue; continue;
@ -2092,25 +2092,26 @@ bool EfhEngine::handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId
// CHECKME : the whole loop doesn't make much sense as it's using scoreId instead of var2, plus _activeScore is an array of 15 bytes, not 0x77... // CHECKME : the whole loop doesn't make much sense as it's using scoreId instead of var2, plus _activeScore is an array of 15 bytes, not 0x77...
// Also, 39 correspond to the size of activeScore + passiveScore + infoScore + the 2 remaining bytes of the struct // Also, 39 correspond to the size of activeScore + passiveScore + infoScore + the 2 remaining bytes of the struct
warning("handleInteractionText - _activeScore[%d]", scoreId); warning("handleInteractionText - _activeScore[%d]", scoreId);
if (_npcBuf[_teamChar[counter]._id]._activeScore[scoreId] >= _mapSpecialTiles[_techId][tileId]._triggerId) { if (_npcBuf[_teamChar[counter]._id]._activeScore[scoreId] >= _mapSpecialTiles[_techId][tileId]._triggerValue) {
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId);
return true; return true;
} }
} }
} }
} }
} else if ((_mapSpecialTiles[_techId][tileId]._field3 == 0xFA && arg8 == 1) || (_mapSpecialTiles[_techId][tileId]._field3 == 0xFC && arg8 == 2) || (_mapSpecialTiles[_techId][tileId]._field3 == 0xFB && arg8 == 3)) { } else if ((_mapSpecialTiles[_techId][tileId]._triggerType == 0xFA && arg8 == 1) || (_mapSpecialTiles[_techId][tileId]._triggerType == 0xFC && arg8 == 2) || (_mapSpecialTiles[_techId][tileId]._triggerType == 0xFB && arg8 == 3)) {
if (_mapSpecialTiles[_techId][tileId]._triggerId == itemId) { if (_mapSpecialTiles[_techId][tileId]._triggerValue == itemId) {
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId);
return true; return true;
} }
} else if (arg8 == 4) { } else if (arg8 == 4) {
int16 var6 = _mapSpecialTiles[_techId][tileId]._field3; int16 var6 = _mapSpecialTiles[_techId][tileId]._triggerType;
if (var6 >= 0x78 && var6 <= 0xEF) { if (var6 >= 0x78 && var6 <= 0xEF) {
var6 -= 0x78; var6 -= 0x78;
warning("handleInteractionText - _activeScore[%d]", var6); warning("handleInteractionText - _activeScore[%d]", var6);
// The 2 checks on var6 are useless, as [0x78..0xEF] - 0x78 => [0x00..0x77] // Note: The 2 checks on var6 are useless, as [0x78..0xEF] - 0x78 => [0x00..0x77]
if (var6 >= 0 && var6 <= 0x8B && var6 == itemId && _mapSpecialTiles[_techId][tileId]._triggerId <= _npcBuf[charId]._activeScore[itemId]) { // Note: In the data,all resulting values are between 2 and 14, so it's working
if (var6 >= 0 && var6 <= 0x8B && var6 == itemId && _mapSpecialTiles[_techId][tileId]._triggerValue <= _npcBuf[charId]._activeScore[itemId]) {
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field5_textId);
return true; return true;
} }
@ -2123,7 +2124,7 @@ bool EfhEngine::handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId
} }
// CHECKME: there's suspiciously no check on tileId // CHECKME: there's suspiciously no check on tileId
if ((arg8 == 4 && _mapSpecialTiles[_techId][tileId]._field3 < 0xFA) || arg8 != 4) { if ((arg8 == 4 && _mapSpecialTiles[_techId][tileId]._triggerType < 0xFA) || arg8 != 4) {
if (_mapSpecialTiles[_techId][tileId]._field7_textId > 0xFE) if (_mapSpecialTiles[_techId][tileId]._field7_textId > 0xFE)
return false; return false;
displayImp1Text(_mapSpecialTiles[_techId][tileId]._field7_textId); displayImp1Text(_mapSpecialTiles[_techId][tileId]._field7_textId);

View File

@ -94,23 +94,23 @@ struct MapSpecialTileStruct {
uint8 _placeId; uint8 _placeId;
uint8 _posX; uint8 _posX;
uint8 _posY; uint8 _posY;
uint8 _field3; uint8 _triggerType; // 0xFD = Check inventory 0xFE = Check Character in team 0xFF Display description <= 0x77 = check score (all values in this case in data are <= 0xF)
uint8 _triggerId; uint8 _triggerValue;
uint16 _field5_textId; uint16 _field5_textId;
uint16 _field7_textId; uint16 _field7_textId;
void init(); void init();
}; };
struct UnkAnimStruct { struct FrameList {
int8 _field[4]; int8 _subFileId[4];
void init(); void init();
}; };
struct AnimInfo { struct AnimInfo {
UnkAnimStruct _unkAnimArray[15]; uint16 _posX[10];
uint8 _field3C_startY[10]; uint8 _posY[10];
uint16 _field46_startX[10]; FrameList _frameList[15];
void init(); void init();
}; };
@ -121,11 +121,11 @@ struct ItemStruct {
uint8 _defense; uint8 _defense;
uint8 _attacks; uint8 _attacks;
uint8 _uses; uint8 _uses;
int8 field_13; // data contains values from -8 to +8 int8 _agilityModifier; // data contains values from -8 to +8
uint8 _range; uint8 _range;
uint8 _attackType; uint8 _attackType;
uint8 _specialEffect; uint8 _specialEffect;
uint8 _field17_attackTypeDefense; uint8 _defenseType;
uint8 _exclusiveType; uint8 _exclusiveType;
uint8 _field19_mapPosX_or_maxDeltaPoints; uint8 _field19_mapPosX_or_maxDeltaPoints;
uint8 _mapPosY; uint8 _mapPosY;

View File

@ -504,7 +504,7 @@ void EfhEngine::handleFight_MobstersAttack(int groupId) {
int16 enemyPronoun = kEncounters[_mapMonsters[_techId][_teamMonster[groupId]._id]._monsterRef]._nameArticle; int16 enemyPronoun = kEncounters[_mapMonsters[_techId][_teamMonster[groupId]._id]._monsterRef]._nameArticle;
int16 characterPronoun = _npcBuf[_teamChar[targetId]._id].getPronoun(); int16 characterPronoun = _npcBuf[_teamChar[targetId]._id].getPronoun();
_teamChar[targetId]._pctDodgeMiss += (_items[monsterWeaponItemId].field_13 * 5); _teamChar[targetId]._pctDodgeMiss += (_items[monsterWeaponItemId]._agilityModifier * 5);
int16 hitCount = 0; int16 hitCount = 0;
int16 originalDamage = 0; int16 originalDamage = 0;
int16 damagePointsAbsorbed = 0; int16 damagePointsAbsorbed = 0;
@ -1480,7 +1480,7 @@ int16 EfhEngine::getCharacterScore(int16 charId, int16 itemId) {
break; break;
} }
extraScore += _items[itemId].field_13; extraScore += _items[itemId]._agilityModifier;
int16 grandTotalScore = CLIP(totalScore + extraScore + 30, 5, 90); int16 grandTotalScore = CLIP(totalScore + extraScore + 30, 5, 90);
@ -1513,7 +1513,7 @@ bool EfhEngine::hasAdequateDefense(int16 monsterId, uint8 attackType) {
if (_items[itemId]._specialEffect != 0) if (_items[itemId]._specialEffect != 0)
return false; return false;
return _items[itemId]._field17_attackTypeDefense == attackType; return _items[itemId]._defenseType == attackType;
} }
bool EfhEngine::hasAdequateDefenseNPC(int16 charId, uint8 attackType) { bool EfhEngine::hasAdequateDefenseNPC(int16 charId, uint8 attackType) {
@ -1521,7 +1521,7 @@ bool EfhEngine::hasAdequateDefenseNPC(int16 charId, uint8 attackType) {
int16 itemId = _npcBuf[charId]._defaultDefenseItemId; int16 itemId = _npcBuf[charId]._defaultDefenseItemId;
if (_items[itemId]._specialEffect == 0 && _items[itemId]._field17_attackTypeDefense == attackType) if (_items[itemId]._specialEffect == 0 && _items[itemId]._defenseType == attackType)
return true; return true;
for (uint counter = 0; counter < 10; ++counter) { for (uint counter = 0; counter < 10; ++counter) {
@ -1529,7 +1529,7 @@ bool EfhEngine::hasAdequateDefenseNPC(int16 charId, uint8 attackType) {
continue; continue;
itemId = _npcBuf[charId]._inventory[counter]._ref; itemId = _npcBuf[charId]._inventory[counter]._ref;
if (_items[itemId]._specialEffect == 0 && _items[itemId]._field17_attackTypeDefense == attackType) if (_items[itemId]._specialEffect == 0 && _items[itemId]._defenseType == attackType)
return true; return true;
} }
return false; return false;

View File

@ -45,27 +45,28 @@ void EfhEngine::readAnimInfo() {
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 100; ++i) {
for (int id = 0; id < 15; ++id) { for (int id = 0; id < 15; ++id) {
_animInfo[i]._unkAnimArray[id]._field[0] = f.readByte(); Common::String txtBuffer = "->";
_animInfo[i]._unkAnimArray[id]._field[1] = f.readByte(); for (int frameId = 0; frameId < 4; ++frameId) {
_animInfo[i]._unkAnimArray[id]._field[2] = f.readByte(); _animInfo[i]._frameList[id]._subFileId[frameId] = f.readByte();
_animInfo[i]._unkAnimArray[id]._field[3] = f.readByte(); txtBuffer += Common::String::format(" %d", _animInfo[i]._frameList[id]._subFileId[frameId]);
}
debugC(6, kDebugEngine, "%d %d %d %d", _animInfo[i]._unkAnimArray[id]._field[0], _animInfo[i]._unkAnimArray[id]._field[1], _animInfo[i]._unkAnimArray[id]._field[2], _animInfo[i]._unkAnimArray[id]._field[3]); debugC(6, kDebugEngine, txtBuffer.c_str());
} }
Common::String debugStr = ""; Common::String debugStr = "";
for (int id = 0; id < 10; ++id) { for (int id = 0; id < 10; ++id) {
_animInfo[i]._field3C_startY[id] = f.readByte(); _animInfo[i]._posY[id] = f.readByte();
debugStr += Common::String::format("%d ", _animInfo[i]._field3C_startY[id]); debugStr += Common::String::format("%d ", _animInfo[i]._posY[id]);
} }
debugC(6, kDebugEngine, "%s", debugStr.c_str()); debugC(6, kDebugEngine, debugStr.c_str());
debugStr = ""; debugStr = "";
for (int id = 0; id < 10; ++id) { for (int id = 0; id < 10; ++id) {
_animInfo[i]._field46_startX[id] = f.readUint16LE(); _animInfo[i]._posX[id] = f.readUint16LE();
debugStr += Common::String::format("%d ", _animInfo[i]._field46_startX[id]); debugStr += Common::String::format("%d ", _animInfo[i]._posX[id]);
} }
debugC(6, kDebugEngine, "%s", debugStr.c_str()); debugC(6, kDebugEngine, debugStr.c_str());
debugC(6, kDebugEngine, "---------"); debugC(6, kDebugEngine, "---------");
} }
} }
@ -144,16 +145,16 @@ void EfhEngine::readItems() {
_items[i]._defense = f.readByte(); _items[i]._defense = f.readByte();
_items[i]._attacks = f.readByte(); _items[i]._attacks = f.readByte();
_items[i]._uses = f.readByte(); _items[i]._uses = f.readByte();
_items[i].field_13 = f.readByte(); _items[i]._agilityModifier = f.readByte();
_items[i]._range = f.readByte(); _items[i]._range = f.readByte();
_items[i]._attackType = f.readByte(); _items[i]._attackType = f.readByte();
_items[i]._specialEffect = f.readByte(); _items[i]._specialEffect = f.readByte();
_items[i]._field17_attackTypeDefense = f.readByte(); _items[i]._defenseType = f.readByte();
_items[i]._exclusiveType = f.readByte(); _items[i]._exclusiveType = f.readByte();
_items[i]._field19_mapPosX_or_maxDeltaPoints = f.readByte(); _items[i]._field19_mapPosX_or_maxDeltaPoints = f.readByte();
_items[i]._mapPosY = f.readByte(); _items[i]._mapPosY = f.readByte();
debugC(7, kDebugEngine, "%s\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x", _items[i]._name, _items[i]._damage, _items[i]._defense, _items[i]._attacks, _items[i]._uses, _items[i].field_13, _items[i]._range, _items[i]._attackType, _items[i]._specialEffect, _items[i]._field17_attackTypeDefense, _items[i]._exclusiveType, _items[i]._field19_mapPosX_or_maxDeltaPoints, _items[i]._mapPosY); debugC(7, kDebugEngine, "%s\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x", _items[i]._name, _items[i]._damage, _items[i]._defense, _items[i]._attacks, _items[i]._uses, _items[i]._agilityModifier, _items[i]._range, _items[i]._attackType, _items[i]._specialEffect, _items[i]._defenseType, _items[i]._exclusiveType, _items[i]._field19_mapPosX_or_maxDeltaPoints, _items[i]._mapPosY);
} }
} }
@ -323,9 +324,8 @@ void EfhEngine::loadNPCS() {
*/ */
void EfhEngine::preLoadMaps() { void EfhEngine::preLoadMaps() {
Common::DumpFile dump; Common::DumpFile dump;
if (ConfMan.getBool("dump_scripts")) { if (ConfMan.getBool("dump_scripts"))
dump.open("efhMaps.dump"); dump.open("efhMaps.dump");
}
for (int idx = 0; idx < 19; ++idx) { for (int idx = 0; idx < 19; ++idx) {
Common::String fileName = Common::String::format("tech.%d", idx); Common::String fileName = Common::String::format("tech.%d", idx);
@ -345,16 +345,16 @@ void EfhEngine::preLoadMaps() {
_mapSpecialTiles[idx][i]._placeId = mapSpecialTilePtr[9 * i]; _mapSpecialTiles[idx][i]._placeId = mapSpecialTilePtr[9 * i];
_mapSpecialTiles[idx][i]._posX = mapSpecialTilePtr[9 * i + 1]; _mapSpecialTiles[idx][i]._posX = mapSpecialTilePtr[9 * i + 1];
_mapSpecialTiles[idx][i]._posY = mapSpecialTilePtr[9 * i + 2]; _mapSpecialTiles[idx][i]._posY = mapSpecialTilePtr[9 * i + 2];
_mapSpecialTiles[idx][i]._field3 = mapSpecialTilePtr[9 * i + 3]; _mapSpecialTiles[idx][i]._triggerType = mapSpecialTilePtr[9 * i + 3];
_mapSpecialTiles[idx][i]._triggerId = mapSpecialTilePtr[9 * i + 4]; _mapSpecialTiles[idx][i]._triggerValue = mapSpecialTilePtr[9 * i + 4];
_mapSpecialTiles[idx][i]._field5_textId = READ_LE_UINT16(&mapSpecialTilePtr[9 * i + 5]); _mapSpecialTiles[idx][i]._field5_textId = READ_LE_UINT16(&mapSpecialTilePtr[9 * i + 5]);
_mapSpecialTiles[idx][i]._field7_textId = READ_LE_UINT16(&mapSpecialTilePtr[9 * i + 7]); _mapSpecialTiles[idx][i]._field7_textId = READ_LE_UINT16(&mapSpecialTilePtr[9 * i + 7]);
if (ConfMan.getBool("dump_scripts") && _mapSpecialTiles[idx][i]._placeId != 0xFF) { if (ConfMan.getBool("dump_scripts") && _mapSpecialTiles[idx][i]._placeId != 0xFF) {
// dump a decoded version of the maps // dump a decoded version of the maps
Common::String buffer = Common::String::format("[%d][%d] _ placeId: 0x%02X _pos: %d, %d _field3: 0x%02X (%d), triggerId: %d, _field5/7: %d %d\n" Common::String buffer = Common::String::format("[%d][%d] _ placeId: 0x%02X _pos: %d, %d _triggerType: 0x%02X (%d), triggerId: %d, _field5/7: %d %d\n"
, idx, i, _mapSpecialTiles[idx][i]._placeId, _mapSpecialTiles[idx][i]._posX, _mapSpecialTiles[idx][i]._posX, _mapSpecialTiles[idx][i]._field3 , idx, i, _mapSpecialTiles[idx][i]._placeId, _mapSpecialTiles[idx][i]._posX, _mapSpecialTiles[idx][i]._posX, _mapSpecialTiles[idx][i]._triggerType
, _mapSpecialTiles[idx][i]._field3, _mapSpecialTiles[idx][i]._triggerId, _mapSpecialTiles[idx][i]._field5_textId, _mapSpecialTiles[idx][i]._field7_textId); , _mapSpecialTiles[idx][i]._triggerType, _mapSpecialTiles[idx][i]._triggerValue, _mapSpecialTiles[idx][i]._field5_textId, _mapSpecialTiles[idx][i]._field7_textId);
dump.write(buffer.c_str(), buffer.size()); dump.write(buffer.c_str(), buffer.size());
} }
} }

View File

@ -79,10 +79,10 @@ void EfhEngine::displayAnimFrame() {
displayRawDataAtPos(_portraitSubFilesArray[0], 16, 8); displayRawDataAtPos(_portraitSubFilesArray[0], 16, 8);
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
int8 var2 = _animInfo[_animImageSetId]._unkAnimArray[_unkAnimRelatedIndex]._field[i]; int8 var2 = _animInfo[_animImageSetId]._frameList[_unkAnimRelatedIndex]._subFileId[i];
if (var2 == -1) if (var2 == -1)
continue; continue;
displayRawDataAtPos(_portraitSubFilesArray[var2 + 1], _animInfo[_animImageSetId]._field46_startX[var2] + 16, _animInfo[_animImageSetId]._field3C_startY[var2] + 8); displayRawDataAtPos(_portraitSubFilesArray[var2 + 1], _animInfo[_animImageSetId]._posX[var2] + 16, _animInfo[_animImageSetId]._posY[var2] + 8);
} }
} }

View File

@ -45,22 +45,23 @@ void InvObject::init() {
} }
void MapSpecialTileStruct::init() { void MapSpecialTileStruct::init() {
_placeId = _posX = _posY = _field3 = _triggerId = 0; _placeId = _posX = _posY = _triggerType = _triggerValue = 0;
_field5_textId = _field7_textId = 0; _field5_textId = _field7_textId = 0;
} }
void UnkAnimStruct::init() { void FrameList::init() {
memset(_field, 0, 4); for (int i = 0; i < 4; ++i)
_subFileId[i] = -1;
} }
void AnimInfo::init() { void AnimInfo::init() {
for (int i = 0; i < 15; ++i)
_unkAnimArray[i].init();
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
_field3C_startY[i] = 0; _posX[i] = 0;
_field46_startX[i] = 0; _posY[i] = 0;
} }
for (int i = 0; i < 15; ++i)
_frameList[i].init();
} }
void ItemStruct::init() { void ItemStruct::init() {
@ -71,11 +72,11 @@ void ItemStruct::init() {
_defense = 0; _defense = 0;
_attacks = 0; _attacks = 0;
_uses = 0; _uses = 0;
field_13 = 0; _agilityModifier = 0;
_range = 0; _range = 0;
_attackType = 0; _attackType = 0;
_specialEffect = 0; _specialEffect = 0;
_field17_attackTypeDefense = 0; _defenseType = 0;
_exclusiveType = 0; _exclusiveType = 0;
_field19_mapPosX_or_maxDeltaPoints = 0; _field19_mapPosX_or_maxDeltaPoints = 0;
_mapPosY = 0; _mapPosY = 0;

View File

@ -1038,7 +1038,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
displayStringInSmallWindowWithBorder("There is no apparent affect!", false, charId, teamMonsterId, menuId, curMenuLine); displayStringInSmallWindowWithBorder("There is no apparent affect!", false, charId, teamMonsterId, menuId, curMenuLine);
} else { } else {
_messageToBePrinted += " The magic sparkles brilliant hues in the air!"; _messageToBePrinted += " The magic sparkles brilliant hues in the air!";
setMapMonsterAggressivenessAndMovementType(teamMonsterId, _items[itemId]._field17_attackTypeDefense); setMapMonsterAggressivenessAndMovementType(teamMonsterId, _items[itemId]._defenseType);
} }
objectUsedFl = true; objectUsedFl = true;
break; break;
@ -1236,7 +1236,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
teamCharId = teamMonsterId; teamCharId = teamMonsterId;
if (teamCharId != 0x1B) { if (teamCharId != 0x1B) {
uint8 varAE = _items[itemId]._field17_attackTypeDefense; uint8 varAE = _items[itemId]._defenseType;
uint8 effectPoints = getRandom(_items[itemId]._field19_mapPosX_or_maxDeltaPoints); uint8 effectPoints = getRandom(_items[itemId]._field19_mapPosX_or_maxDeltaPoints);
_npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] += effectPoints; _npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] += effectPoints;
if (_npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] > 20) { if (_npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] > 20) {
@ -1266,7 +1266,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
teamCharId = teamMonsterId; teamCharId = teamMonsterId;
if (teamCharId != 0x1B) { if (teamCharId != 0x1B) {
uint8 varAE = _items[itemId]._field17_attackTypeDefense; uint8 varAE = _items[itemId]._defenseType;
uint8 effectPoints = getRandom(_items[itemId]._field19_mapPosX_or_maxDeltaPoints); uint8 effectPoints = getRandom(_items[itemId]._field19_mapPosX_or_maxDeltaPoints);
_npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] -= effectPoints; _npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] -= effectPoints;
if (_npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] > 20 || _npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] < 0) { if (_npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] > 20 || _npcBuf[_teamChar[teamCharId]._id]._activeScore[varAE] < 0) {
@ -1348,7 +1348,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
} }
if (teamCharId != 0x1B) { if (teamCharId != 0x1B) {
int16 effectPoints = getRandom(_items[itemId]._field17_attackTypeDefense); int16 effectPoints = getRandom(_items[itemId]._defenseType);
_npcBuf[_teamChar[teamCharId]._id]._hitPoints += effectPoints; _npcBuf[_teamChar[teamCharId]._id]._hitPoints += effectPoints;
if (_npcBuf[_teamChar[teamCharId]._id]._hitPoints > _npcBuf[_teamChar[teamCharId]._id]._maxHP) if (_npcBuf[_teamChar[teamCharId]._id]._hitPoints > _npcBuf[_teamChar[teamCharId]._id]._maxHP)
_npcBuf[_teamChar[teamCharId]._id]._hitPoints = _npcBuf[_teamChar[teamCharId]._id]._maxHP; _npcBuf[_teamChar[teamCharId]._id]._hitPoints = _npcBuf[_teamChar[teamCharId]._id]._maxHP;
@ -1378,7 +1378,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
} }
if (teamCharId != 0x1B) { if (teamCharId != 0x1B) {
int16 effectPoints = getRandom(_items[itemId]._field17_attackTypeDefense); int16 effectPoints = getRandom(_items[itemId]._defenseType);
_npcBuf[_teamChar[teamCharId]._id]._hitPoints -= effectPoints; _npcBuf[_teamChar[teamCharId]._id]._hitPoints -= effectPoints;
if (_npcBuf[_teamChar[teamCharId]._id]._hitPoints < 0) if (_npcBuf[_teamChar[teamCharId]._id]._hitPoints < 0)
_npcBuf[_teamChar[teamCharId]._id]._hitPoints = 0; _npcBuf[_teamChar[teamCharId]._id]._hitPoints = 0;

View File

@ -157,8 +157,8 @@ void EfhEngine::synchronize(Common::Serializer &s) {
s.syncAsByte(_mapSpecialTiles[i][idx]._placeId); s.syncAsByte(_mapSpecialTiles[i][idx]._placeId);
s.syncAsByte(_mapSpecialTiles[i][idx]._posX); s.syncAsByte(_mapSpecialTiles[i][idx]._posX);
s.syncAsByte(_mapSpecialTiles[i][idx]._posY); s.syncAsByte(_mapSpecialTiles[i][idx]._posY);
s.syncAsByte(_mapSpecialTiles[i][idx]._field3); s.syncAsByte(_mapSpecialTiles[i][idx]._triggerType);
s.syncAsByte(_mapSpecialTiles[i][idx]._triggerId); s.syncAsByte(_mapSpecialTiles[i][idx]._triggerValue);
s.syncAsUint16LE(_mapSpecialTiles[i][idx]._field5_textId); s.syncAsUint16LE(_mapSpecialTiles[i][idx]._field5_textId);
s.syncAsUint16LE(_mapSpecialTiles[i][idx]._field7_textId); s.syncAsUint16LE(_mapSpecialTiles[i][idx]._field7_textId);
} }