New icon. Bad redimension, mustfix

This commit is contained in:
2016-05-18 13:31:28 +02:00
parent 038e0c1e79
commit 887291d474
7 changed files with 32 additions and 7 deletions

View File

@@ -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);
}
}

BIN
map.map

Binary file not shown.

View File

@@ -87,8 +87,15 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="font.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stb_image.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\..\..\Users\Raimon\Dropbox\jailgames2016\Rise of the Bal1\utils\mappy\mappy.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@@ -29,5 +29,18 @@
<ClInclude Include="stb_image.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\..\Users\Raimon\Dropbox\jailgames2016\Rise of the Bal1\utils\mappy\mappy.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

BIN
res.aps Normal file

Binary file not shown.

BIN
res.rc Normal file

Binary file not shown.

BIN
resource.h Normal file

Binary file not shown.