diff options
author | Bendegúz Nagy | 2016-06-27 21:46:05 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 398b309a0373c647ad9cd9c553ad626784d2b459 (patch) | |
tree | c81ab5e517dc4903045d6fef92eead3846c51c68 /engines/dm | |
parent | 84a91022052bfcdf42f89823e3c24322ef147d26 (diff) | |
download | scummvm-rg350-398b309a0373c647ad9cd9c553ad626784d2b459.tar.gz scummvm-rg350-398b309a0373c647ad9cd9c553ad626784d2b459.tar.bz2 scummvm-rg350-398b309a0373c647ad9cd9c553ad626784d2b459.zip |
DM: Add F0163_DUNGEON_LinkThingToList
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/TODOs/methodtree.txt | 17 | ||||
-rw-r--r-- | engines/dm/TODOs/todo.txt | 4 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 45 | ||||
-rw-r--r-- | engines/dm/dungeonman.h | 1 |
4 files changed, 60 insertions, 7 deletions
diff --git a/engines/dm/TODOs/methodtree.txt b/engines/dm/TODOs/methodtree.txt index 088796602e..15e01ee8ee 100644 --- a/engines/dm/TODOs/methodtree.txt +++ b/engines/dm/TODOs/methodtree.txt @@ -6,13 +6,13 @@ F0380_COMMAND_ProcessQueue_CPSC // in progress F0280_CHAMPION_AddCandidateChampionToParty // done, so-so -F0378_COMMAND_ProcessType81_ClickInPanel +F0378_COMMAND_ProcessType81_ClickInPanel // done so-so F0282_CHAMPION_ProcessCommands160To162_ClickInResurrectReincarnatePanel // done F0368_COMMAND_SetLeader // done - F0457_START_DrawEnabledMenus_CPSF // wat skip - F0281_CHAMPION_Rename // skip - F0394_MENUS_SetMagicCasterAndDrawSpellArea // post skip - F0393_MENUS_DrawSpellAreaControls // post skip + F0457_START_DrawEnabledMenus_CPSF // can't yet see it's purpose + F0281_CHAMPION_Rename // stub + F0394_MENUS_SetMagicCasterAndDrawSpellArea // done + F0393_MENUS_DrawSpellAreaControls // done F0051_TEXT_MESSAGEAREA_PrintLineFeed // post skip F0047_TEXT_MESSAGEAREA_PrintMessage // post skip F0067_MOUSE_SetPointerToNormal // skip @@ -104,7 +104,12 @@ F0280_CHAMPION_AddCandidateChampionToParty // done, so-so G0407_s_Party F0355_INVENTORY_Toggle_CPSE // done F0292_CHAMPION_DrawState // done - F0334_INVENTORY_CloseChest // skip + F0334_INVENTORY_CloseChest + F0163_DUNGEON_LinkThingToList + G0426_T_OpenChest + G0425_aT_ChestSlots + + F0395_MENUS_DrawMovementArrows // done F0357_COMMAND_DiscardAllInput // skip F0098_DUNGEONVIEW_DrawFloorAndCeiling // wat diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt index ee198d8017..558fc8a3e2 100644 --- a/engines/dm/TODOs/todo.txt +++ b/engines/dm/TODOs/todo.txt @@ -9,10 +9,14 @@ Bugs: Game crashes when reincaranting a fourth champion and trying to copy his portrait + Todo: Add wiki entry for DM Rename GraphicIndice enum entires and have their name include GraphicIndice I forgot to add localization warnings Attend to Arnaud's notes on github Double check enums with hex literals, I think I screwed the regex when processing them + + Missing functions: + Add missing F0163_DUNGEON_LinkThingToList in MovesensMan::sensorIsTriggeredByClickOnWall (I don't think it's safe yet)
\ No newline at end of file diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 755a7d8cd7..7de4d76e60 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -1246,4 +1246,47 @@ int16 DungeonMan::getObjectInfoIndex(Thing thing) { } } -}
\ No newline at end of file +void DungeonMan::linkThingToList(Thing thingToLink, Thing thingInList, int16 mapX, int16 mapY) { + if (thingToLink == Thing::_thingEndOfList) + return; + + uint16 *rawObjPtr = getThingData(thingToLink); + *rawObjPtr = Thing::_thingEndOfList.toUint16(); + + if (mapX >= 0) { + Square *squarePtr = (Square*)&_currMap._data[mapX][mapY]; + if (squarePtr->get(kThingListPresent)) { + thingInList = getSquareFirstThing(mapX, mapY); + } else { + squarePtr->set(kThingListPresent); + uint16 *cumulativeCount = &_currMap._colCumulativeSquareFirstThingCount[mapX + 1]; + uint16 column = _dunData._columCount - (_dunData._mapsFirstColumnIndex[_currMap._index] + mapX) - 1; + while (column--) { + (*cumulativeCount++)++; + } + uint16 mapYStep = 0; + squarePtr -= mapY; + uint16 squareFirstThingIndex = _currMap._colCumulativeSquareFirstThingCount[mapX]; + while (mapYStep++ != mapY) { + if (squarePtr->get(kThingListPresent)) { + squareFirstThingIndex++; + } + squarePtr++; + } + Thing* thingPtr = &_dunData._squareFirstThings[squareFirstThingIndex]; + memmove(thingPtr + 1, thingPtr, sizeof(Thing) * (_fileHeader._squareFirstThingCount - squareFirstThingIndex - 1)); + *thingPtr = thingToLink; + return; + } + } + + Thing thing = getNextThing(thingInList); + while (thing != Thing::_thingEndOfList) { + thing = getNextThing(thing); + thingInList = thing; + } + rawObjPtr = getThingData(thingInList); + *rawObjPtr = thingToLink.toUint16(); +} + +} diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 5191ba9867..064ea49056 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -641,6 +641,7 @@ public: uint16 getObjectWeight(Thing thing); // @ F0140_DUNGEON_GetObjectWeight int16 getObjectInfoIndex(Thing thing); // @ F0141_DUNGEON_GetObjectInfoIndex + void linkThingToList(Thing thingToLink, Thing thingInList, int16 mapX, int16 mapY); // @ F0163_DUNGEON_LinkThingToList uint32 _rawDunFileDataSize; // @ probably NONE byte *_rawDunFileData; // @ ??? |