diff --git a/main.cpp b/main.cpp
index 16122a0..7407707 100644
--- a/main.cpp
+++ b/main.cpp
@@ -166,7 +166,10 @@ void Init() {
fread(old_map, old_map_width*old_map_height, 1, f);
for (int y = 0; y < map_height; y++) {
for (int x = 0; x < map_width; x++) {
- map[x + y*map_width] = old_map[x + y*old_map_width];
+ map[x + y*map_width] = 0;
+ if (old_map_width > x && old_map_height > y && (x + y*map_width) < (old_map_width*old_map_height)) {
+ map[x + y*map_width] = old_map[x + y*(map_width)];
+ }
}
}
dialog = 2;
@@ -403,10 +406,12 @@ void ShiftMap(int sx, int sy) {
unsigned char* new_map = (unsigned char*)malloc(map_width*map_height);
for (int y = 0; y < map_height; y++) {
for (int x = 0; x < map_width; x++) {
- new_map[x + y*map_width] = map[x + y*map_width];
+ new_map[x + y*map_width] = map[mod(x+sx, map_width) + mod(y+sy, map_height)*map_width];
}
}
-
+ free(map);
+ map = new_map;
+ UpdateMiniMap();
}
void DoMiniMap() {
@@ -441,10 +446,10 @@ void DoMiniMap() {
}
if (keyJustPressed == SDL_SCANCODE_E) state = STATE_TILEMAP;
if (keyboard[SDL_SCANCODE_LCTRL]) {
- if (keyJustPressed == SDL_SCANCODE_A) ShiftMap(-1, 0);
- if (keyJustPressed == SDL_SCANCODE_D) ShiftMap(1, 0);
- if (keyJustPressed == SDL_SCANCODE_W) ShiftMap(0, -1);
- if (keyJustPressed == SDL_SCANCODE_S) ShiftMap(0, 1);
+ if (keyJustPressed == SDL_SCANCODE_A) ShiftMap(1, 0);
+ if (keyJustPressed == SDL_SCANCODE_D) ShiftMap(-1, 0);
+ if (keyJustPressed == SDL_SCANCODE_W) ShiftMap(0, 1);
+ if (keyJustPressed == SDL_SCANCODE_S) ShiftMap(0, -1);
}
}
diff --git a/map.map b/map.map
index 6a81ca5..00d6b6b 100644
Binary files a/map.map and b/map.map differ
diff --git a/mappy.vcxproj b/mappy.vcxproj
index 66fbaed..47def7b 100644
--- a/mappy.vcxproj
+++ b/mappy.vcxproj
@@ -87,8 +87,15 @@
+
+
+
+
+
+
+
diff --git a/mappy.vcxproj.filters b/mappy.vcxproj.filters
index ef3fef3..d5b66a7 100644
--- a/mappy.vcxproj.filters
+++ b/mappy.vcxproj.filters
@@ -29,5 +29,18 @@
Header Files
+
+ Header Files
+
+
+
+
+ Resource Files
+
+
+
+
+ Resource Files
+
\ No newline at end of file
diff --git a/res.aps b/res.aps
new file mode 100644
index 0000000..5db037d
Binary files /dev/null and b/res.aps differ
diff --git a/res.rc b/res.rc
new file mode 100644
index 0000000..d6c565c
Binary files /dev/null and b/res.rc differ
diff --git a/resource.h b/resource.h
new file mode 100644
index 0000000..f159059
Binary files /dev/null and b/resource.h differ