From caa7fd224444fbc2f13c94d3ec89c2b22472fd8c Mon Sep 17 00:00:00 2001 From: gerstrong Date: Fri, 31 Jul 2009 14:04:05 +0000 Subject: [PATCH] - level 16 in ep2 can now be exited after saving Wash DC - improved tile attribut loading for mods like silcar git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@195 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 --- src/fileio/CTileLoader.cpp | 52 ++++++++++++++++++-------------------- src/fileio/CTileLoader.h | 1 + src/game.cpp | 2 +- src/main.cpp | 2 +- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/fileio/CTileLoader.cpp b/src/fileio/CTileLoader.cpp index ed05016a3..08bf4cb13 100644 --- a/src/fileio/CTileLoader.cpp +++ b/src/fileio/CTileLoader.cpp @@ -164,36 +164,27 @@ void CTileLoader::assignChangeTileAttribute(stTile *tile) tile[i].chgtile = 0; // At any other case, than the special ones, the tile is always 143 for pickuppable items - // 17 is tile for an exit. + // 17 is tile for an exit. Until row 19, this seems to be valid for(int i=0 ; i= 2 && - TileProperty[i][BEHAVIOR] <= 21 && - TileProperty[i][BEHAVIOR] != 17 ) - { + if(canbePickedup(i) ) tile[i].chgtile = 143; - } - } switch(m_episode) { case 1: - { - for(int i=502 ; i<=506 ; i++) // Workaround in Level 12 of Episode 2, where the tiles are solid after a taken item. - { - if( (TileProperty[i][BEHAVIOR] >= 6 && - TileProperty[i][BEHAVIOR] <= 21 && - TileProperty[i][BEHAVIOR] != 17) || - TileProperty[i][BEHAVIOR] == 27 || - TileProperty[i][BEHAVIOR] == 28 ) - tile[i].chgtile = 439; - } - break; - } case 2: { - for(int i=306 ; i<=311 ; i++) // Workaround in Level 12 of Episode 2, where the tiles are solid after a taken item. - tile[i].chgtile = 276; + for(int i=38*13 ; i<39*13 ; i++) // Workaround for silcar 1. Row 38 + if( canbePickedup(i) ) + tile[i].chgtile = 439; + + for(int i=35*13 ; i<36*13 ; i++) // Workaround for silcar 4. Row 35 + if( canbePickedup(i) ) + tile[i].chgtile = 335; + + for(int i=23*13 ; i<24*13 ; i++) // Workaround in Level 12 of Episode 2, where the tiles are solid after a taken item. + tile[i].chgtile = 276; // Row 23 + break; } case 3: @@ -202,11 +193,7 @@ void CTileLoader::assignChangeTileAttribute(stTile *tile) for(int i=0 ; i<=numtiles ; i++) { // Only items!! - if( (TileProperty[i][BEHAVIOR] >= 6 && - TileProperty[i][BEHAVIOR] <= 21 && - TileProperty[i][BEHAVIOR] != 17) || - TileProperty[i][BEHAVIOR] == 27 || - TileProperty[i][BEHAVIOR] == 28 ) + if(canbePickedup(i)) { int j = i; while(TileProperty[j][BEHAVIOR] != 0) // "Nothing" is to the left of items row. @@ -214,7 +201,7 @@ void CTileLoader::assignChangeTileAttribute(stTile *tile) tile[i].chgtile = j; } - // Only Doors! Tile is always 182 + // Only for Doors! Tile is always 182 if(TileProperty[i][BEHAVIOR] >= 2 && TileProperty[i][BEHAVIOR] <= 5) tile[i].chgtile = 182; @@ -224,3 +211,12 @@ void CTileLoader::assignChangeTileAttribute(stTile *tile) } } } + +bool CTileLoader::canbePickedup(int tile) +{ + return ((TileProperty[tile][BEHAVIOR] >= 6 && + TileProperty[tile][BEHAVIOR] <= 21 && + TileProperty[tile][BEHAVIOR] != 17) || + TileProperty[tile][BEHAVIOR] == 27 || + TileProperty[tile][BEHAVIOR] == 28); +} diff --git a/src/fileio/CTileLoader.h b/src/fileio/CTileLoader.h index 3a5c0c671..1d4e99c63 100644 --- a/src/fileio/CTileLoader.h +++ b/src/fileio/CTileLoader.h @@ -44,6 +44,7 @@ private: void assignChangeTileAttribute(stTile *tile); bool setProperOffset(); + bool canbePickedup(int tile); }; #endif /* CTILELOADER_H_ */ diff --git a/src/game.cpp b/src/game.cpp index d9e1eff3d..678cd9866 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1328,7 +1328,7 @@ void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP) break; case 17: - if (pCKP->Control.levelcontrol.canexit && (!pCKP->Control.levelcontrol.isfinallevel || player[theplayer].inventory.HasFuel)) + if (pCKP->Control.levelcontrol.canexit) { pCKP->Control.levelcontrol.exitXpos = (mpx+2)<<4; PlayerTouchedExit(theplayer, pCKP); diff --git a/src/main.cpp b/src/main.cpp index bb04265f2..3c445615f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -351,7 +351,7 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP) } p_levelcontrol->curlevel = p_levelcontrol->chglevelto; - if (p_levelcontrol->curlevel == FINAL_MAP) + if (p_levelcontrol->curlevel == FINAL_MAP && p_levelcontrol->episode == 1) { p_levelcontrol->isfinallevel = 1; p_levelcontrol->canexit = 0;