int LoLEngine::deleteMonstersFromBlock(int block) { int i = _levelBlockProperties[block].assignedObjects; int cnt = 0; uint16 next = 0; while (i) { next = findObject(i)->nextAssignedObject; if (!(i & 0x8000)) { i = next; continue; } LoLMonster *m = &_monsters[i & 0x7fff]; cnt++; setMonsterMode(m, 14); checkSceneUpdateNeed(m->block); placeMonster(m, 0, 0); i = next; } return cnt; }
void EoBCoreEngine::useWand(int charIndex, int weaponSlot) { int v = _items[_characters[charIndex].inventory[weaponSlot]].value; if (!v) { _txt->printMessage(_wandStrings[0]); return; } if (v != 5) useMagicScroll(charIndex, _wandTypes[v], weaponSlot); else if (_flags.gameID == GI_EOB2) useMagicScroll(charIndex, 64, weaponSlot); else { uint16 bl1 = calcNewBlockPosition(_currentBlock, _currentDirection); uint16 bl2 = calcNewBlockPosition(bl1, _currentDirection); snd_playSoundEffect(98); sparkEffectOffensive(); if ((_wllWallFlags[_levelBlockProperties[bl2].walls[_currentDirection ^ 2]] & 4) && !(_levelBlockProperties[bl2].flags & 7) && (_levelBlockProperties[bl1].flags & 7)) { for (int i = 0; i < 30; i++) { if (_monsters[i].block != bl1) continue; placeMonster(&_monsters[i], bl2, -1); _sceneUpdateRequired = true; } } else { _txt->printMessage(_wandStrings[1]); } } }
int entityPopulate (char entityArray[MAP_SIZE][MAP_SIZE], entity entityInfo[], char mapArray[MAP_SIZE][MAP_SIZE], int playerLevel, int roomWidth, int roomHeight) { placePlayer(entityArray, entityInfo, mapArray, roomWidth, roomHeight); int monNumber = 1; int monMax = randint(5)+1; //has to be at least one monster while (monNumber <= monMax) { generateMonster(entityArray, entityInfo, playerLevel, monNumber); placeMonster (entityArray, entityInfo, mapArray, roomWidth, roomHeight, monNumber); monNumber++; } return monMax; }
void LoLEngine::restoreMonsterTempData(LevelTempData *tmp) { memcpy(_monsters, tmp->monsters, sizeof(LoLMonster) * 30); for (int i = 0; i < 30; i++) { if (_monsters[i].block) { _monsters[i].block = 0; _monsters[i].properties = &_monsterProperties[_monsters[i].type]; placeMonster(&_monsters[i], _monsters[i].x, _monsters[i].y); } } }
void LoLEngine::setMonsterMode(LoLMonster *monster, int mode) { if (monster->mode == 13 && mode != 14) return; if (mode == 7) { monster->destX = _partyPosX; monster->destY = _partyPosY; } if (monster->mode == 1 && mode == 7) { for (int i = 0; i < 30; i++) { if (monster->mode != 1) continue; monster->mode = mode; monster->fightCurTick = 0; monster->destX = _partyPosX; monster->destY = _partyPosY; setMonsterDirection(monster, calcMonsterDirection(monster->x, monster->y, monster->destX, monster->destY)); } } else { monster->mode = mode; monster->fightCurTick = 0; if (mode == 14) monster->hitPoints = 0; if (mode == 13 && (monster->flags & 0x20)) { monster->mode = 0; monsterDropItems(monster); if (_currentLevel != 29) setMonsterMode(monster, 14); runLevelScriptCustom(0x404, -1, monster->id, monster->id, 0, 0); checkSceneUpdateNeed(monster->block); if (monster->mode == 14) placeMonster(monster, 0, 0); } } }