Skip to content

Commit

Permalink
KYRA: (EOB) - add some spells
Browse files Browse the repository at this point in the history
(shocking grasp, flame blade, vampiric touch etc.)
  • Loading branch information
athrxx authored and Johannes Schickel committed Dec 26, 2011
1 parent fc5b29f commit 359f3ef
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 116 deletions.
12 changes: 6 additions & 6 deletions devtools/create_kyradat/create_kyradat.cpp
Expand Up @@ -413,8 +413,8 @@ const ExtractFilename extractFilenames[] = {
{ kEob1MonsterProperties, kTypeRawData, false },
{ kEob1EnemyMageSpellList, kTypeRawData, false },
{ kEob1EnemyMageSfx, kTypeRawData, false },
{ kEob1MonsterDistAttType17, kTypeRawData, false },
{ kEob1MonsterDistAttSfx17, kTypeRawData, false },
{ kEob1BeholderSpellList, kTypeRawData, false },
{ kEob1BeholderSfx, kTypeRawData, false },
{ kEob1TurnUndeadString, kTypeStringList, true },

{ kEob1NpcShpData, kTypeRawData, false },
Expand Down Expand Up @@ -1656,10 +1656,10 @@ const char *getIdString(const int id) {
return "kEob1EnemyMageSpellList";
case kEob1EnemyMageSfx:
return "kEob1EnemyMageSfx";
case kEob1MonsterDistAttType17:
return "kEob1MonsterDistAttType17";
case kEob1MonsterDistAttSfx17:
return "kEob1MonsterDistAttSfx17";
case kEob1BeholderSpellList:
return "kEob1BeholderSpellList";
case kEob1BeholderSfx:
return "kEob1BeholderSfx";
case kEob1TurnUndeadString:
return "kEob1TurnUndeadString";
case kEob1NpcShpData:
Expand Down
4 changes: 2 additions & 2 deletions devtools/create_kyradat/create_kyradat.h
Expand Up @@ -414,8 +414,8 @@ enum kExtractID {

kEob1EnemyMageSpellList,
kEob1EnemyMageSfx,
kEob1MonsterDistAttType17,
kEob1MonsterDistAttSfx17,
kEob1BeholderSpellList,
kEob1BeholderSfx,
kEob1TurnUndeadString,

kEob1NpcShpData,
Expand Down
4 changes: 2 additions & 2 deletions devtools/create_kyradat/games.cpp
Expand Up @@ -1061,8 +1061,8 @@ const int eob1FloppyNeed[] = {
kEob1MonsterProperties,
kEob1EnemyMageSpellList,
kEob1EnemyMageSfx,
kEob1MonsterDistAttType17,
kEob1MonsterDistAttSfx17,
kEob1BeholderSpellList,
kEob1BeholderSfx,
kEob1TurnUndeadString,

kEob1NpcShpData,
Expand Down
8 changes: 4 additions & 4 deletions devtools/create_kyradat/tables.cpp
Expand Up @@ -2398,12 +2398,12 @@ const ExtractEntrySearchData kEob1EnemyMageSfxProvider[] = {
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob1MonsterDistAttType17Provider[] = {
const ExtractEntrySearchData kEob1BeholderSpellListProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000004, 0x00000079, { { 0x8E, 0x13, 0x54, 0x9D, 0x54, 0xF6, 0xC9, 0x6E, 0x10, 0xF1, 0xC0, 0xE9, 0x66, 0xDD, 0x95, 0xED } } } },
EXTRACT_END_ENTRY
};

const ExtractEntrySearchData kEob1MonsterDistAttSfx17Provider[] = {
const ExtractEntrySearchData kEob1BeholderSfxProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x00000004, 0x000000F5, { { 0xA9, 0x90, 0x41, 0x0D, 0xB5, 0xE0, 0x28, 0xFD, 0x0A, 0xC3, 0xF9, 0xEC, 0xC8, 0x47, 0xC1, 0x57 } } } },
EXTRACT_END_ENTRY
};
Expand Down Expand Up @@ -3872,8 +3872,8 @@ const ExtractEntry extractProviders[] = {

{ kEob1EnemyMageSpellList, kEob1EnemyMageSpellListProvider },
{ kEob1EnemyMageSfx, kEob1EnemyMageSfxProvider },
{ kEob1MonsterDistAttType17, kEob1MonsterDistAttType17Provider },
{ kEob1MonsterDistAttSfx17, kEob1MonsterDistAttSfx17Provider },
{ kEob1BeholderSpellList, kEob1BeholderSpellListProvider },
{ kEob1BeholderSfx, kEob1BeholderSfxProvider },
{ kEob1TurnUndeadString, kEob1TurnUndeadStringProvider },

{ kEob1NpcShpData, kEob1NpcShpDataProvider },
Expand Down
8 changes: 5 additions & 3 deletions engines/kyra/eob1.cpp
Expand Up @@ -78,7 +78,7 @@ Common::Error EobEngine::init() {

_scriptTimersCount = 1;

//_wllWallFlags[132] = 0x1f;
_wllWallFlags[132] = 1;
_wllWallFlags[133] = 1;

return Common::kNoError;
Expand Down Expand Up @@ -222,7 +222,9 @@ void EobEngine::runNpcDialogue(int npcIndex) {

if (!checkScriptFlag(0x100000)) {
if (deletePartyItems(6, -1)) {
TXT(28);
//_npcSequenceSub = 0;
//drawNpcScene(npcIndex);
TXT(28);
createItemOnCurrentBlock(32);
setScriptFlag(0x100000);
r = 1;
Expand Down Expand Up @@ -423,7 +425,7 @@ void EobEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
case 7:
case 8:
case 9:
y = _dscDoorY7[mDim] - _doorShapes[shapeIndex + 3][1];
y = _dscDoorY3[mDim] - _doorShapes[shapeIndex + 3][1];
d1 = x - (_doorShapes[shapeIndex + 3][2] << 2);
x -= (shp[2] << 2);
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], d1, y, 5);
Expand Down
18 changes: 11 additions & 7 deletions engines/kyra/eobcommon.cpp
Expand Up @@ -57,8 +57,8 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa
_monsterDustStrings = 0;
_enemyMageSpellList = 0;
_enemyMageSfx = 0;
_monsterDistAttType17 = 0;
_monsterDistAttSfx17 = 0;
_beholderSpellList = 0;
_beholderSfx = 0;

_faceShapes = 0;
_characters = 0;
Expand Down Expand Up @@ -853,8 +853,8 @@ void EobCoreEngine::recalcArmorClass(int index) {
if (c->effectFlags & 0x4000) {
int8 m1 = 5;

if (getCharacterClericPaladinLevel(index) > 5)
m1 += ((getCharacterClericPaladinLevel(index) - 5) / 3);
if (getClericPaladinLevel(index) > 5)
m1 += ((getClericPaladinLevel(index) - 5) / 3);

if (c->armorClass > m1)
c->armorClass = m1;
Expand Down Expand Up @@ -893,7 +893,7 @@ int EobCoreEngine::validateWeaponSlotItem(int index, int slot) {
return r;
}

int EobCoreEngine::getCharacterClericPaladinLevel(int index) {
int EobCoreEngine::getClericPaladinLevel(int index) {
if (_castScrollSlot)
return 9;

Expand All @@ -913,7 +913,7 @@ int EobCoreEngine::getCharacterClericPaladinLevel(int index) {
return 1;
}

int EobCoreEngine::getCharacterMageLevel(int index) {
int EobCoreEngine::getMageLevel(int index) {
if (_castScrollSlot)
return 9;

Expand Down Expand Up @@ -1682,7 +1682,7 @@ int EobCoreEngine::closeDistanceAttack(int charIndex, Item item) {

uint16 flg = 0x100;

if ((_flags.gameID == GI_EOB1 && _items[item].type > 51 && _items[item].type < 57) || (_flags.gameID == GI_EOB2 && isMagicWeapon(item)))
if (isMagicEffectItem(item))
flg |= 1;

_dstMonsterIndex = r;
Expand Down Expand Up @@ -1966,6 +1966,10 @@ void EobCoreEngine::monsterCloseAttack(EobMonsterInPlay *m) {
if (!monsterAttackHitTest(m, c))
continue;
dmg += rollDice(_monsterProps[m->type].dmgDc[ii].times, _monsterProps[m->type].dmgDc[ii].pips, _monsterProps[m->type].dmgDc[ii].base);
if (_characters[c].effectsRemainder[1]) {
if (--_characters[c].effectsRemainder[1])
dmg = 0;
}
}

if (dmg > 0) {
Expand Down
67 changes: 37 additions & 30 deletions engines/kyra/eobcommon.h
Expand Up @@ -367,8 +367,9 @@ friend class CharacterGenerator;

void recalcArmorClass(int index);
int validateWeaponSlotItem(int index, int slot);
int getCharacterClericPaladinLevel(int index);
int getCharacterMageLevel(int index);

int getClericPaladinLevel(int index);
int getMageLevel(int index);
int getCharacterLevelIndex(int type, int cClass);

int countCharactersWithSpecificItems(int16 itemType, int16 itemValue);
Expand Down Expand Up @@ -429,7 +430,7 @@ friend class CharacterGenerator;
void printFullItemName(Item item);
void identifyQueuedItems(Item itemQueue);
void drawItemIconShape(int pageNum, Item itemId, int x, int y);
bool isMagicWeapon(Item itemIndex);
bool isMagicEffectItem(Item itemIndex);
bool checkInventoryForRings(int charIndex, int itemValue);
void eatItemInHand(int charIndex);

Expand Down Expand Up @@ -549,8 +550,8 @@ friend class CharacterGenerator;

const uint8 *_enemyMageSpellList;
const uint8 *_enemyMageSfx;
const uint8 *_monsterDistAttType17;
const uint8 *_monsterDistAttSfx17;
const uint8 *_beholderSpellList;
const uint8 *_beholderSfx;
const char *const *_monsterSpecAttStrings;

const int8 *_monsterFrmOffsTable1;
Expand Down Expand Up @@ -912,57 +913,63 @@ friend class CharacterGenerator;
bool magicObjectStatusHit(EobMonsterInPlay *m, int type, bool tryEvade, int mod);
bool turnUndeadHit(EobMonsterInPlay *m, int hitChance, int casterLevel);

int getMagicWeaponSlot(int charIndex);
int createMagicWeaponType(int invFlags, int handFlags, int armorClass, int allowedClasses, int dmgNum, int dmgPips, int dmgInc, int extraProps);
Item createMagicWeaponItem(int flags, int icon, int value, int type);
void removeMagicWeaponItem(Item item);

int findSingleSpellTarget(int dist);

void printWarning(const char *str);
void printNoEffectWarning();

void spellCallback_start_empty() {}
bool spellCallback_end_empty(EobFlyingObject *fo) { return true; }
bool spellCallback_end_empty(void*) { return true; }
void spellCallback_start_armor();
void spellCallback_start_burningHands();
void spellCallback_start_detectMagic();
bool spellCallback_end_detectMagic(EobFlyingObject *fo);
bool spellCallback_end_detectMagic(void*);
void spellCallback_start_magicMissile();
bool spellCallback_end_magicMissile(EobFlyingObject *fo);
bool spellCallback_end_magicMissile(void *obj);
void spellCallback_start_shockingGrasp();
bool spellCallback_end_shockingGraspFlameBlade(EobFlyingObject *fo);
bool spellCallback_end_shockingGraspFlameBlade(void *obj);
void spellCallback_start_improvedIdentify();
void spellCallback_start_melfsAcidArrow();
bool spellCallback_end_melfsAcidArrow(EobFlyingObject *fo);
bool spellCallback_end_melfsAcidArrow(void *obj);
void spellCallback_start_dispelMagic();
void spellCallback_start_fireball();
bool spellCallback_end_fireball(EobFlyingObject *fo);
bool spellCallback_end_fireball(void *obj);
void spellCallback_start_flameArrow();
bool spellCallback_end_flameArrow(EobFlyingObject *fo);
bool spellCallback_end_flameArrow(void *obj);
void spellCallback_start_holdPerson();
bool spellCallback_end_holdPerson(EobFlyingObject *fo);
bool spellCallback_end_holdPerson(void *obj);
void spellCallback_start_lightningBolt();
bool spellCallback_end_lightningBolt(EobFlyingObject *fo);
bool spellCallback_end_lightningBolt(void *obj);
void spellCallback_start_vampiricTouch();
bool spellCallback_end_vampiricTouch(EobFlyingObject *fo);
bool spellCallback_end_vampiricTouch(void *obj);
void spellCallback_start_fear();
void spellCallback_start_iceStorm();
bool spellCallback_end_iceStorm(EobFlyingObject *fo);
bool spellCallback_end_iceStorm(void *obj);
void spellCallback_start_stoneSkin();
void spellCallback_start_removeCurse();
void spellCallback_start_coneOfCold();
void spellCallback_start_holdMonster();
bool spellCallback_end_holdMonster(EobFlyingObject *fo);
bool spellCallback_end_holdMonster(void *obj);
void spellCallback_start_wallOfForce();
void spellCallback_start_disintegrate();
void spellCallback_start_fleshToStone();
void spellCallback_start_stoneToFlesh();
void spellCallback_start_trueSeeing();
bool spellCallback_end_trueSeeing(EobFlyingObject *fo);
bool spellCallback_end_trueSeeing(void*);
void spellCallback_start_slayLiving();
void spellCallback_start_powerWordStun();
void spellCallback_start_causeLightWounds();
void spellCallback_start_cureLightWounds();
void spellCallback_start_aid();
bool spellCallback_end_aid(EobFlyingObject *fo);
bool spellCallback_end_aid(void *obj);
void spellCallback_start_flameBlade();
void spellCallback_start_slowPoison();
bool spellCallback_end_slowPoison(EobFlyingObject *fo);
bool spellCallback_end_slowPoison(void *obj);
void spellCallback_start_createFood();
void spellCallback_start_removeParalysis();
void spellCallback_start_causeSeriousWounds();
Expand All @@ -971,19 +978,19 @@ friend class CharacterGenerator;
void spellCallback_start_causeCriticalWounds();
void spellCallback_start_cureCriticalWounds();
void spellCallback_start_flameStrike();
bool spellCallback_end_flameStrike(EobFlyingObject *fo);
bool spellCallback_end_flameStrike(void *obj);
void spellCallback_start_raiseDead();
void spellCallback_start_harm();
void spellCallback_start_heal();
void spellCallback_start_layOnHands();
void spellCallback_start_turnUndead();
bool spellCallback_end_kuotoaAttack(EobFlyingObject *fo);
bool spellCallback_end_unk1Passive(EobFlyingObject *fo);
bool spellCallback_end_unk2Passive(EobFlyingObject *fo);
bool spellCallback_end_deathSpellPassive(EobFlyingObject *fo);
bool spellCallback_end_disintegratePassive(EobFlyingObject *fo);
bool spellCallback_end_causeCriticalWoundsPassive(EobFlyingObject *fo);
bool spellCallback_end_fleshToStonePassive(EobFlyingObject *fo);
bool spellCallback_end_lightningBoltPassive(void *obj);
bool spellCallback_end_unk1Passive(void *obj);
bool spellCallback_end_unk2Passive(void *obj);
bool spellCallback_end_deathSpellPassive(void*);
bool spellCallback_end_disintegratePassive(void*);
bool spellCallback_end_causeCriticalWoundsPassive(void*);
bool spellCallback_end_fleshToStonePassive(void*);

int8 _openBookSpellLevel;
int8 _openBookSpellSelectedItem;
Expand All @@ -997,11 +1004,11 @@ friend class CharacterGenerator;
int8 *_openBookAvailableSpells;
uint8 _activeSpellCharId;
uint8 _activeSpellCharacterPos;
uint8 _activeSpell;
int _activeSpell;
bool _returnAfterSpellCallback;

typedef void (EobCoreEngine::*SpellStartCallback)();
typedef bool (EobCoreEngine::*SpellEndCallback)(EobFlyingObject *fo);
typedef bool (EobCoreEngine::*SpellEndCallback)(void *obj);

struct EobSpell {
const char *name;
Expand Down
6 changes: 3 additions & 3 deletions engines/kyra/items_eob.cpp
Expand Up @@ -208,7 +208,7 @@ int EobCoreEngine::validateInventorySlotForItem(Item item, int charIndex, int sl
int itm = _characters[charIndex].inventory[slot];
int ex = _itemTypes[_items[itm].type].extraProperties & 0x7f;

if (slot < 2 && _items[itm].flags & 0x20 && ex > 0 && ex < 4) {
if (slot < 2 && (_items[itm].flags & 0x20) && ex > 0 && ex < 4) {
if (_flags.gameID == GI_EOB2)
_txt->printMessage(_validateCursedString[0], -1, _characters[charIndex].name);
return 0;
Expand Down Expand Up @@ -474,8 +474,8 @@ void EobCoreEngine::drawItemIconShape(int pageNum, Item itemId, int x, int y) {
}
}

bool EobCoreEngine::isMagicWeapon(Item itemIndex) {
return (_items[itemIndex].type > 10 && _items[itemIndex].type < 18);
bool EobCoreEngine::isMagicEffectItem(Item itemIndex) {
return (itemIndex > 10 && itemIndex < 18);
}

bool EobCoreEngine::checkInventoryForRings(int charIndex, int itemValue) {
Expand Down

0 comments on commit 359f3ef

Please sign in to comment.