diff options
Diffstat (limited to 'gob')
-rw-r--r-- | gob/goblin.cpp | 75 | ||||
-rw-r--r-- | gob/map.cpp | 7 | ||||
-rw-r--r-- | gob/map.h | 2 |
3 files changed, 22 insertions, 62 deletions
diff --git a/gob/goblin.cpp b/gob/goblin.cpp index 80c007c6b1..45779846c5 100644 --- a/gob/goblin.cpp +++ b/gob/goblin.cpp @@ -2197,77 +2197,28 @@ void gob_placeItem(int16 indexInPocket, int16 idInPocket) { - (scen_toRedrawLeft + scen_toRedrawRight) / 2; } - if ((map_itemsMap[yPos][xPos] & 0xff00) != 0) { - map_itemsMap[yPos][xPos] = - (map_itemsMap[yPos][xPos] & 0xff00) + idInPocket; + map_placeItem(xPos, yPos, idInPocket); - if (yPos > 0) { - - map_itemsMap[yPos - 1][xPos] = - (map_itemsMap[yPos - 1][xPos] & 0xff00) + - idInPocket; - } - - if (lookDir == 4) { - if (xPos < 25) { - - map_itemsMap[yPos][xPos + 1] = - (map_itemsMap[yPos][xPos + 1] & 0xff00) + - idInPocket; - - if (yPos > 0) { - map_itemsMap[yPos - 1][xPos + 1] = - (map_itemsMap[yPos - 1][xPos + - 1] & 0xff00) + idInPocket; - } - } - } else { - if (xPos > 0) { + if (yPos > 0) { + map_placeItem(xPos, yPos - 1, idInPocket); + } - map_itemsMap[yPos][xPos - 1] = - (map_itemsMap[yPos][xPos - 1] & 0xff00) + - idInPocket; + if (lookDir == 4) { + if (xPos < 25) { + map_placeItem(xPos + 1, yPos, idInPocket); - if (yPos > 0) { - map_itemsMap[yPos - 1][xPos - 1] = - (map_itemsMap[yPos - 1][xPos - - 1] & 0xff00) + idInPocket; - } + if (yPos > 0) { + map_placeItem(xPos + 1, yPos - 1, idInPocket); } } } else { + if (xPos > 0) { + map_placeItem(xPos - 1, yPos, idInPocket); - map_itemsMap[yPos][xPos] += (idInPocket << 8); - - if (yPos > 0) { - - map_itemsMap[yPos - 1][xPos] += (idInPocket << 8); - } - - if (lookDir == 4) { - if (xPos < 25) { - - map_itemsMap[yPos][xPos + 1] += - (idInPocket << 8); - - if (yPos > 0) { - map_itemsMap[yPos - 1][xPos + 1] += - (idInPocket << 8); - } - } - } else { - if (xPos > 0) { - - map_itemsMap[yPos][xPos - 1] += - (idInPocket << 8); - - if (yPos > 0) { - map_itemsMap[yPos - 1][xPos - 1] += - (idInPocket << 8); - } + if (yPos > 0) { + map_placeItem(xPos - 1, yPos - 1, idInPocket); } } - } if (idInPocket >= 0 && idInPocket < 20) { diff --git a/gob/map.cpp b/gob/map.cpp index d603dafe6c..a947996ff8 100644 --- a/gob/map.cpp +++ b/gob/map.cpp @@ -48,6 +48,13 @@ char map_loadFromAvo; char map_sourceFile[15]; static char *map_avoDataPtr; +void map_placeItem(int16 x, int16 y, int16 id) { + if ((map_itemsMap[y][x] & 0xff00) != 0) + map_itemsMap[y][x] = (map_itemsMap[y][x] & 0xff00) | id; + else + map_itemsMap[y][x] = (map_itemsMap[y][x] & 0x00ff) | (id << 8); +} + int16 map_getDirection(int16 x0, int16 y0, int16 x1, int16 y1) { int16 dir; @@ -54,6 +54,8 @@ extern char map_loadFromAvo; extern Map_ItemPos map_itemPoses[40]; extern char map_sourceFile[15]; +void map_placeItem(int16 x, int16 y, int16 id); + int16 map_getDirection(int16 x0, int16 y0, int16 x1, int16 y1); void map_findNearestToGob(void); void map_findNearestToDest(void); |