Skip to content

Commit

Permalink
Added more flexibility for map making
Browse files Browse the repository at this point in the history
  • Loading branch information
fazelukario committed Nov 13, 2023
1 parent c32f74b commit 4b6c868
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
25 changes: 21 additions & 4 deletions Pseudo3DCLIGame/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ int ScreenHeight = 40; // Console Screen Size Y (rows)
int MapWidth = 0; // World Dimensions
int MapHeight = 0;

float PlayerX = 14.7f; // Player Start Position
float PlayerY = 5.09f;
float PlayerX = 1.0f; // Player Start Position
float PlayerY = 1.0f;
float PlayerA = 0.0f; // Player Start Rotation
float FOV = 3.14159f / 4.0f; // Field of View
float Depth = 16.0f; // Maximum rendering distance
Expand All @@ -43,13 +43,30 @@ int main()
// Create Map of world space # = wall block, . = space
wifstream file(mapFileName);
wstring map, line;
int lineIndex = 0;
float mapConfig[6];
while (getline(file, line))
{
map += line;
MapHeight++;
if (lineIndex < 6)
{
mapConfig[lineIndex] = stof(line);
lineIndex++;
}
else
{
map += line;
MapHeight++;
}
}
MapWidth = (int)(line.length());

PlayerX = mapConfig[0];
PlayerY = mapConfig[1];
PlayerA = mapConfig[2];
FOV = 3.14159f / mapConfig[3];
Depth = mapConfig[4];
Speed = mapConfig[5];

auto tp1 = chrono::system_clock::now();
auto tp2 = chrono::system_clock::now();

Expand Down
6 changes: 6 additions & 0 deletions maps/Example_map.p3dmap
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.5f
1.0f
0.0f
4.0f
16.0f
5.0f
################
#..............#
###.....########
Expand Down

0 comments on commit 4b6c868

Please sign in to comment.