diff options
author | Strangerke | 2016-08-07 23:14:39 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | c57929d3da42fd490911de67c3d4f58f38c08755 (patch) | |
tree | 829c97e353c2fdb68d38414aff356f3f9bff5bcc /engines/dm | |
parent | 0009c223ea862d28293d5fe692567572a3f4b3b1 (diff) | |
download | scummvm-rg350-c57929d3da42fd490911de67c3d4f58f38c08755.tar.gz scummvm-rg350-c57929d3da42fd490911de67c3d4f58f38c08755.tar.bz2 scummvm-rg350-c57929d3da42fd490911de67c3d4f58f38c08755.zip |
DM: Refactor f144_getCreatureAttributes, f146_setGroupCells and f139_isCreatureAllowedOnMap
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/dungeonman.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 5142281fd5..87bd66fe6c 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -1488,43 +1488,31 @@ Thing DungeonMan::f165_getDiscardThing(uint16 thingType) { } uint16 DungeonMan::f144_getCreatureAttributes(Thing thing) { - Group* L0245_ps_Group; - - L0245_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(thing); - return g243_CreatureInfo[L0245_ps_Group->_type]._attributes; + Group *currGroup = (Group *)_vm->_dungeonMan->f156_getThingData(thing); + return g243_CreatureInfo[currGroup->_type]._attributes; } void DungeonMan::f146_setGroupCells(Group* group, uint16 cells, uint16 mapIndex) { - if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) { + if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._cells = cells; - } else { + else group->_cells = cells; - } } void DungeonMan::f148_setGroupDirections(Group* group, int16 dir, uint16 mapIndex) { - if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) { + if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._directions = (Direction)dir; - } else { + else group->setDir(M21_normalizeModulo4(dir)); - } } bool DungeonMan::f139_isCreatureAllowedOnMap(Thing thing, uint16 mapIndex) { - int16 L0234_i_Counter; - int16 L0235_i_CreatureType; - byte* L0236_puc_Multiple; -#define AL0236_puc_Group L0236_puc_Multiple -#define AL0236_puc_AllowedCreatureType L0236_puc_Multiple - Map* L0237_ps_Map; - - L0235_i_CreatureType = ((Group*)_vm->_dungeonMan->f156_getThingData(thing))->_type; - L0237_ps_Map = &_vm->_dungeonMan->_g277_dungeonMaps[mapIndex]; - AL0236_puc_AllowedCreatureType = _vm->_dungeonMan->_g279_dungeonMapData[mapIndex][L0237_ps_Map->_width] + L0237_ps_Map->_height + 1; - for (L0234_i_Counter = L0237_ps_Map->_creatureTypeCount; L0234_i_Counter > 0; L0234_i_Counter--) { - if (*AL0236_puc_AllowedCreatureType++ == L0235_i_CreatureType) { + int16 creatureType = ((Group*)_vm->_dungeonMan->f156_getThingData(thing))->_type; + Map *map = &_vm->_dungeonMan->_g277_dungeonMaps[mapIndex]; + byte *allowedCreatureType = _vm->_dungeonMan->_g279_dungeonMapData[mapIndex][map->_width] + map->_height + 1; + for (int16 L0234_i_Counter = map->_creatureTypeCount; L0234_i_Counter > 0; L0234_i_Counter--) { + if (*allowedCreatureType++ == creatureType) return true; - } } return false; } |