author | ecalot
<ecalot> 2004-08-12 01:14:45 UTC |
committer | ecalot
<ecalot> 2004-08-12 01:14:45 UTC |
parent | 287125ede53ef0dfee364c3fa7ab641fb92b7abc |
FP/src/include/room.h | +2 | -0 |
FP/src/res/maps.c | +39 | -1 |
diff --git a/FP/src/include/room.h b/FP/src/include/room.h index f99aa65..5402d3c 100644 --- a/FP/src/include/room.h +++ b/FP/src/include/room.h @@ -37,6 +37,8 @@ room.h: FreePrince : Draw Screen #include "maps.h" typedef char tRoomId; +typedef unsigned char tTileId; +typedef unsigned char tModId; typedef struct { tRoomId id; diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c index c3e8c51..ca472b1 100644 --- a/FP/src/res/maps.c +++ b/FP/src/res/maps.c @@ -85,7 +85,45 @@ int levelUse(void* level) { } tTile levelGetTile(tRoom* room,int x, int y) { - tTile result; + tTile result; + tTileId fore; + tModId back; + + fore=room->fore[x+12*y]; + back=room->back[x+12*y]; + + switch (fore) { /* TODO: use arrays and a better algorithm */ + case T_EMPTY: + result.walkable=0; + result.block=0; + result.hasTorch=0; + result.hasFloor=0; + result.hasBrokenTile=0; + result.isWall=0; + result.hasSword=0; + break; + case T_FLOOR: + case T_TORCH: + case T_SWORD: + case T_DEBRIS: + result.walkable=1; + result.block=0; + result.hasTorch=(fore==T_TORCH); + result.hasFloor=1; + result.hasBrokenTile=(fore==T_DEBRIS); + result.isWall=0; + result.hasSword=(fore==T_SWORD); + break; + case T_WALL: + result.walkable=0; + result.block=1; + result.hasTorch=0; + result.hasFloor=0; + result.hasBrokenTile=0; + result.isWall=1; + result.hasSword=0; + break; + } return result; }