Skip to content

Commit

Permalink
KYRA: (EOB) - add turn undead spell, add some screen fades, fix some …
Browse files Browse the repository at this point in the history
…bugs
  • Loading branch information
athrxx authored and Johannes Schickel committed Dec 26, 2011
1 parent 0e4c184 commit 84900e8
Show file tree
Hide file tree
Showing 20 changed files with 189 additions and 37 deletions.
6 changes: 6 additions & 0 deletions devtools/create_kyradat/create_kyradat.cpp
Expand Up @@ -395,6 +395,7 @@ const ExtractFilename extractFilenames[] = {
{ kEobBaseSparkOfY, kTypeRawData, false },
{ kEobBaseSpellProperties, kTypeRawData, false },
{ kEobBaseMagicFlightProps, kTypeRawData, false },
{ kEobBaseTurnUndeadEffect, kTypeRawData, false },

// EYE OF THE BEHOLDER I
{ kEob1MainMenuStrings, kTypeStringList, true },
Expand All @@ -406,6 +407,7 @@ const ExtractFilename extractFilenames[] = {
{ kEob1MonsterDistAttSfx10, kTypeRawData, false },
{ kEob1MonsterDistAttType17, kTypeRawData, false },
{ kEob1MonsterDistAttSfx17, kTypeRawData, false },
{ kEob1TurnUndeadString, kTypeStringList, true },

// EYE OF THE BEHOLDER II
{ kEob2MainMenuStrings, kTypeStringList, true },
Expand Down Expand Up @@ -1602,6 +1604,8 @@ const char *getIdString(const int id) {
return "kEobBaseSpellProperties";
case kEobBaseMagicFlightProps:
return "kEobBaseMagicFlightProps";
case kEobBaseTurnUndeadEffect:
return "kEobBaseTurnUndeadEffect";
case kEob1MainMenuStrings:
return "kEob1MainMenuStrings";
case kEob1DoorShapeDefs:
Expand All @@ -1618,6 +1622,8 @@ const char *getIdString(const int id) {
return "kEob1MonsterDistAttType17";
case kEob1MonsterDistAttSfx17:
return "kEob1MonsterDistAttSfx17";
case kEob1TurnUndeadString:
return "kEob1TurnUndeadString";
case kEob2MainMenuStrings:
return "kEob2MainMenuStrings";
case kEob2IntroStrings:
Expand Down
2 changes: 2 additions & 0 deletions devtools/create_kyradat/create_kyradat.h
Expand Up @@ -396,6 +396,7 @@ enum kExtractID {

kEobBaseSpellProperties,
kEobBaseMagicFlightProps,
kEobBaseTurnUndeadEffect,

kEob1MainMenuStrings,
kEob1DoorShapeDefs,
Expand All @@ -407,6 +408,7 @@ enum kExtractID {
kEob1MonsterDistAttSfx10,
kEob1MonsterDistAttType17,
kEob1MonsterDistAttSfx17,
kEob1TurnUndeadString,

kEob2MainMenuStrings,
kEob2IntroStrings,
Expand Down
5 changes: 5 additions & 0 deletions devtools/create_kyradat/games.cpp
Expand Up @@ -1063,6 +1063,7 @@ const int eob1FloppyNeed[] = {
kEob1MonsterDistAttSfx10,
kEob1MonsterDistAttType17,
kEob1MonsterDistAttSfx17,
kEob1TurnUndeadString,

kEobBasePryDoorStrings,
kEobBaseWarningStrings,
Expand All @@ -1077,6 +1078,8 @@ const int eob1FloppyNeed[] = {
kEobBaseMagicObjectStrings,
kEobBaseMagicObject5String,
kEobBasePatternSuffix,
kEobBasePatternGrFix1,
kEobBasePatternGrFix2,
kEobBaseValidateArmorString,
kEobBaseValidateNoDropString,
kEobBasePotionStrings,
Expand Down Expand Up @@ -1169,6 +1172,7 @@ const int eob1FloppyNeed[] = {

kEobBaseSpellProperties,
kEobBaseMagicFlightProps,
kEobBaseTurnUndeadEffect,

kLolEobCommonDscDoorShapeIndex,
kEobBaseWllFlagPreset,
Expand Down Expand Up @@ -1382,6 +1386,7 @@ const int eob2FloppyNeed[] = {

kEobBaseSpellProperties,
kEobBaseMagicFlightProps,
kEobBaseTurnUndeadEffect,

kLolEobCommonDscDoorShapeIndex,
kEobBaseWllFlagPreset,
Expand Down
19 changes: 17 additions & 2 deletions devtools/create_kyradat/tables.cpp
Expand Up @@ -2089,8 +2089,7 @@ const ExtractEntrySearchData kEobBaseSlotValidationFlagsProvider[] = {
};

const ExtractEntrySearchData kEobBaseProjectileWeaponTypesProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x0000000D, 0x0000063E, { { 0xA6, 0x75, 0x6C, 0x39, 0x96, 0xCB, 0xA7, 0xC2, 0x31, 0xE0, 0x2A, 0x75, 0x30, 0x96, 0x58, 0x05 } } } }, // EOB 1
{ UNK_LANG, kPlatformPC, { 0x0000000C, 0x0000063E, { { 0x3E, 0x99, 0x6D, 0xE4, 0x6B, 0xC8, 0x49, 0x1B, 0x17, 0xD2, 0xBE, 0x9B, 0xE0, 0xCD, 0xA1, 0xC2 } } } }, // EOB 1
{ UNK_LANG, kPlatformPC, { 0x00000008, 0x0000061C, { { 0x05, 0x55, 0xA6, 0xD1, 0x3C, 0x12, 0x84, 0xDA, 0xA9, 0x33, 0xCF, 0x07, 0x05, 0x2A, 0xB2, 0x29 } } } }, // EOB 1
{ UNK_LANG, kPlatformPC, { 0x0000000F, 0x00000829, { { 0x9F, 0x6A, 0x13, 0x8A, 0xA7, 0x40, 0xE8, 0x40, 0x2E, 0x87, 0x49, 0x6B, 0x67, 0xED, 0xE8, 0xCE } } } }, // EOB 2
EXTRACT_END_ENTRY
};
Expand Down Expand Up @@ -2310,6 +2309,12 @@ const ExtractEntrySearchData kEobBaseMagicFlightPropsProvider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEobBaseTurnUndeadEffectProvider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000008C, 0x00002E8B, { { 0x96, 0x15, 0x61, 0x12, 0x43, 0xCF, 0x3A, 0x84, 0x1A, 0x89, 0xB5, 0x32, 0x0D, 0xB3, 0x20, 0x67 } } } },

EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob1MainMenuStringsProvider[] = {
{ EN_ANY, kPlatformUnknown, { 0x00000037, 0x00000D79, { { 0x1D, 0x72, 0x7F, 0x8F, 0xEB, 0x4A, 0xBF, 0x82, 0xB7, 0xB5, 0x9D, 0xB0, 0x7B, 0xDA, 0xEC, 0xEE } } } },
{ DE_DEU, kPlatformUnknown, { 0x00000034, 0x00000C6F, { { 0xF2, 0x5F, 0xBE, 0xFB, 0x27, 0x1C, 0x91, 0x33, 0x25, 0x09, 0xC1, 0xA0, 0x27, 0x89, 0xD7, 0xD5 } } } },
Expand Down Expand Up @@ -2356,6 +2361,14 @@ const ExtractEntrySearchData kEob1MonsterDistAttSfx17Provider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob1TurnUndeadStringProvider[] = {
{ EN_ANY, kPlatformUnknown, { 0x00000027, 0x00000BF2, { { 0x43, 0x0A, 0x1E, 0xEE, 0x84, 0xD6, 0xD6, 0x87, 0x20, 0x9F, 0x15, 0x22, 0x9B, 0x65, 0x24, 0xDB } } } },
{ DE_DEU, kPlatformUnknown, { 0x00000030, 0x00000F48, { { 0xDA, 0x59, 0xEC, 0xC1, 0x9B, 0xCF, 0x90, 0x4A, 0x93, 0x3E, 0xE5, 0x26, 0x20, 0x8B, 0x74, 0x92 } } } },

EXTRACT_END_ENTRY
};


const ExtractEntrySearchData kEob2MainMenuStringsProvider[] = {
{ EN_ANY, kPlatformUnknown, { 0x0000005F, 0x000017BE, { { 0x77, 0x8A, 0x50, 0x9F, 0x42, 0xD8, 0x00, 0x05, 0x60, 0x2A, 0x80, 0x25, 0x00, 0xDC, 0x7C, 0x92 } } } },
{ DE_DEU, kPlatformUnknown, { 0x0000005E, 0x000017F3, { { 0xD0, 0x93, 0x2E, 0x5F, 0x9D, 0xDB, 0xC4, 0xFB, 0x9E, 0x9F, 0x14, 0xD6, 0xB4, 0xBE, 0x3D, 0x0C } } } },
Expand Down Expand Up @@ -3698,6 +3711,7 @@ const ExtractEntry extractProviders[] = {

{ kEobBaseSpellProperties, kEobBaseSpellPropertiesProvider },
{ kEobBaseMagicFlightProps, kEobBaseMagicFlightPropsProvider },
{ kEobBaseTurnUndeadEffect, kEobBaseTurnUndeadEffectProvider },

{ kEob1MainMenuStrings, kEob1MainMenuStringsProvider },
{ kEob1DoorShapeDefs, kEob1DoorShapeDefsProvider },
Expand All @@ -3709,6 +3723,7 @@ const ExtractEntry extractProviders[] = {
{ kEob1MonsterDistAttSfx10, kEob1MonsterDistAttSfx10Provider },
{ kEob1MonsterDistAttType17, kEob1MonsterDistAttType17Provider },
{ kEob1MonsterDistAttSfx17, kEob1MonsterDistAttSfx17Provider },
{ kEob1TurnUndeadString, kEob1TurnUndeadStringProvider },

{ kEob2MainMenuStrings, kEob2MainMenuStringsProvider },
{ kEob2IntroStrings, kEob2IntroStringsProvider },
Expand Down
Binary file modified dists/engine-data/kyra.dat
Binary file not shown.
51 changes: 48 additions & 3 deletions engines/kyra/eob1.cpp
Expand Up @@ -83,7 +83,7 @@ void EobEngine::startupLoad() {
}

void EobEngine::npcSequence(int npcIndex) {

error("EobEngine::npcSequence(): unimplemented");

}

Expand Down Expand Up @@ -210,17 +210,62 @@ void EobEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
}
}

void EobEngine::turnUndeadAuto() {
if (_currentLevel != 2 && _currentLevel != 7)
return;

int oc = _openBookChar;

for (int i = 0; i < 6; i++) {
if (!testCharacter(i, 0x0d))
continue;

EobCharacter *c = &_characters[i];

if (_itemTypes[_items[c->inventory[0]].type].extraProperties != 6 && _itemTypes[_items[c->inventory[1]].type].extraProperties != 6)
continue;

int l = getCharacterLevelIndex(2, c->cClass);
if (l > -1) {
if (c->level[l] > _openBookCasterLevel) {
_openBookCasterLevel = c->level[l];
_openBookChar = i;
}
} else {
l = getCharacterLevelIndex(4, c->cClass);
if (l > -1) {
if ((c->level[l] - 2) > _openBookCasterLevel) {
_openBookCasterLevel = (c->level[l] - 2);
_openBookChar = i;
}
}
}
}

if (_openBookCasterLevel)
spellCallback_start_turnUndead();

_openBookChar = oc;
_openBookCasterLevel = 0;
}

void EobEngine::turnUndeadAutoHit() {
_txt->printMessage(_turnUndeadString[0], -1, _characters[_openBookChar].name);
sparkEffectOffensive();
}

bool EobEngine::checkPartyStatusExtra() {
_screen->copyPage(0, 10);
gui_drawBox(0, 121, 319, 200, _color2_1, _color1_1, _bkgColor_1);
_screen->setScreenDim(9);
gui_drawBox(0, 121, 320, 80, _color1_1, _color2_1, _bkgColor_1);
_txt->setupField(9, false);
_txt->printMessage(_menuStringsDefeat[0]);
while (!shouldQuit()) {
removeInputTop();
if (checkInput(0, false, 0) & 0xff)
break;
}
_screen->copyPage(10, 0);
_eventList.clear();
return true;
}

Expand Down
6 changes: 6 additions & 0 deletions engines/kyra/eob1.h
Expand Up @@ -84,6 +84,12 @@ friend class GUI_Eob;
const uint8 *_doorSwitchShapeEncodeDefs;
const uint8 *_doorSwitchCoords;

// Magic
void turnUndeadAuto();
void turnUndeadAutoHit();

const char * const *_turnUndeadString;

// Misc
bool checkPartyStatusExtra();
uint32 convertSpellFlagToEob2Format(uint32 flag, int ignoreInvisibility);
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/eob2.cpp
Expand Up @@ -338,7 +338,7 @@ void DarkMoonEngine::drawDoorIntern(int type, int, int x, int y, int w, int wall
}

void DarkMoonEngine::restParty_npc() {

warning("DarkMoonEngine::restParty_npc(): implement!");
}

bool DarkMoonEngine::restParty_extraAbortCondition() {
Expand Down
18 changes: 11 additions & 7 deletions engines/kyra/eobcommon.cpp
Expand Up @@ -46,6 +46,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_playFinale = false;
_runFlag = true;
_configMouse = true;
_loading = false;

_largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = _itemIconShapes =
_wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
Expand Down Expand Up @@ -82,7 +83,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_monsterOvl1 = _monsterOvl2 = 0;
_monsters = 0;
_dstMonsterIndex = 0;
_inflictMonsterDamageUnk = 0;
_preventMonsterFlash = false;

_teleporterPulse = 0;

Expand Down Expand Up @@ -124,7 +125,7 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_openBookSpellLevel = 0;
_openBookSpellSelectedItem = 0;
_openBookSpellListOffset = 0;
_openBookChar = _openBookCharBackup = 0;
_openBookChar = _openBookCharBackup = _openBookCasterLevel = 0;
_openBookType = _openBookTypeBackup = 0;
_openBookSpellList = 0;
_openBookAvailableSpells = 0;
Expand Down Expand Up @@ -415,7 +416,7 @@ void EobCoreEngine::writeSettings() {
void EobCoreEngine::startupNew() {
gui_setPlayFieldButtons();
_screen->_curPage = 0;
gui_drawPlayField(0);
gui_drawPlayField(false);
_screen->_curPage = 0;
gui_drawAllCharPortraitsWithStats();
drawScene(1);
Expand Down Expand Up @@ -452,8 +453,7 @@ void EobCoreEngine::runLoop() {
_envAudioTimer = _system->getMillis() + (rollDice(1, 10, 3) * 18 * _tickLength);
snd_processEnvironmentalSoundEffect(_flags.gameID == GI_EOB1 ? 30 : (rollDice(1, 2, -1) ? 27 : 28), _currentBlock + rollDice(1, 12, -1));
updateEnvironmentalSfx(0);
//TODO
//EOB1__level_2_7__turnUndead();
turnUndeadAuto();
}
}

Expand Down Expand Up @@ -1540,7 +1540,11 @@ int EobCoreEngine::thrownAttack(int charIndex, int slotIndex, Item item) {

int EobCoreEngine::projectileWeaponAttack(int charIndex, Item item) {
int tp = _items[item].type;
int t = _projectileWeaponAmmoTypes[_flags.gameID == GI_EOB1 ? tp - 2 : tp];

if (_flags.gameID == GI_EOB1)
assert(tp >= 7);

int t = _projectileWeaponAmmoTypes[_flags.gameID == GI_EOB1 ? tp - 7 : tp];
Item ammoItem = 0;

if (t == 16) {
Expand Down Expand Up @@ -1588,7 +1592,7 @@ void EobCoreEngine::inflictMonsterDamage(EobMonsterInPlay *m, int damage, bool g
} else {
if (checkSceneUpdateNeed(m->block)) {
m->flags |= 2;
if (_inflictMonsterDamageUnk)
if (_preventMonsterFlash)
return;
flashMonsterShape(m);
}
Expand Down
11 changes: 9 additions & 2 deletions engines/kyra/eobcommon.h
Expand Up @@ -406,6 +406,7 @@ friend class CharacterGenerator;

const EobCharacter *_npcPreset;
bool _partyResting;
bool _loading;

// Items
void loadItemDefs();
Expand Down Expand Up @@ -634,7 +635,7 @@ friend class CharacterGenerator;
uint8 _scriptTimersMode;

// Gui
void gui_drawPlayField(int pageNum);
void gui_drawPlayField(bool refresh);
void gui_restorePlayField();
void gui_drawAllCharPortraitsWithStats();
void gui_drawCharPortraitWithStats(int index);
Expand Down Expand Up @@ -858,7 +859,7 @@ friend class CharacterGenerator;
void explodeMonster(EobMonsterInPlay *m);

int _dstMonsterIndex;
int _inflictMonsterDamageUnk;
bool _preventMonsterFlash;
int16 _foundMonstersArray[5];

// magic
Expand All @@ -867,6 +868,9 @@ friend class CharacterGenerator;
void usePotion(int charIndex, int weaponSlot);
void useWand(int charIndex, int weaponSlot);

virtual void turnUndeadAuto() {};
virtual void turnUndeadAutoHit() {};

void castSpell(int spell, int weaponSlot);
void removeCharacterEffect(int spell, int charIndex, int showWarning);
void removeAllCharacterEffects(int charIndex);
Expand All @@ -880,6 +884,7 @@ friend class CharacterGenerator;

bool magicObjectDamageHit(EobFlyingObject *fo, int dcTimes, int dcPips, int dcOffs, int level);
bool magicObjectStatusHit(EobMonsterInPlay *m, int type, bool tryEvade, int mod);
bool turnUndeadHit(EobMonsterInPlay *m, int hitChance, int casterLevel);

void printWarning(const char* str);
void printNoEffectWarning();
Expand Down Expand Up @@ -958,6 +963,7 @@ friend class CharacterGenerator;
uint8 _openBookType;
uint8 _openBookCharBackup;
uint8 _openBookTypeBackup;
uint8 _openBookCasterLevel;
const char *const *_openBookSpellList;
int8 *_openBookAvailableSpells;
uint8 _activeSpellCaster;
Expand Down Expand Up @@ -1011,6 +1017,7 @@ friend class CharacterGenerator;
const uint8 *_sparkEffectOfY;

const uint8 *_magicFlightObjectProperties;
const uint8 *_turnUndeadEffect;

// Menu
EobMenuDef *_menuDefs;
Expand Down

0 comments on commit 84900e8

Please sign in to comment.