Fix bug with too little map

This commit is contained in:
Shadow15510 2021-08-18 23:12:15 +02:00
parent cba3e7ba75
commit aa89beb1a1
6 changed files with 53 additions and 75 deletions

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="25" height="25" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<editorsettings>
<export target="../maps/world.json" format="json"/>
</editorsettings>
<tileset firstgid="1" source="tileset.tsx"/>
<layer id="1" name="Calque de Tuiles 1" width="25" height="25">
<data encoding="csv">
55,55,55,6,55,55,6,6,55,6,59,6,55,6,6,55,55,6,55,6,55,55,6,55,6,
55,6,55,55,6,55,6,59,59,55,55,6,6,6,6,6,55,55,55,6,6,55,6,6,6,
6,6,6,55,6,6,55,55,6,6,55,55,59,55,6,55,6,55,6,6,6,59,6,55,6,
55,6,6,6,59,55,6,3,4,4,4,5,55,55,59,55,55,59,55,6,6,6,55,55,6,
55,55,6,6,55,3,4,100,1076,53,53,54,55,6,55,6,55,55,6,55,55,55,6,6,6,
6,55,6,59,6,52,53,53,53,53,53,99,5,6,6,55,55,55,55,55,55,55,6,55,6,
55,6,6,6,6,101,51,53,53,53,53,53,54,55,55,55,55,55,6,6,59,55,6,6,55,
6,55,6,55,55,55,52,53,53,1078,50,102,103,55,55,55,59,6,6,55,6,55,55,6,6,
55,55,59,6,55,55,101,102,102,102,103,55,6,6,55,6,6,55,6,6,55,55,6,55,6,
55,55,55,55,59,55,55,55,55,6,6,6,6,55,59,6,55,6,6,6,55,55,6,6,55,
55,6,55,6,6,6,6,6,6,55,6,6,6,6,55,6,55,6,6,55,6,6,55,55,55,
55,6,59,55,55,55,6,55,6,6,6,55,6,55,6,55,6,55,55,55,6,6,55,55,55,
55,55,55,55,59,6,6,55,55,55,55,55,55,55,6,6,6,59,55,6,55,6,55,55,6,
6,55,55,55,55,6,6,6,6,55,55,59,6,55,55,55,55,6,55,55,59,6,6,55,55,
55,55,59,55,55,6,55,59,6,6,6,6,6,55,6,55,6,6,6,6,6,6,55,55,55,
6,55,55,55,6,55,55,6,55,55,6,55,55,6,6,6,55,55,55,6,6,55,6,6,6,
55,6,55,55,59,6,6,55,59,6,6,6,6,55,59,55,6,55,6,55,55,6,55,55,6,
6,55,55,6,6,6,6,55,55,6,6,55,55,6,55,6,6,6,6,55,55,6,55,6,55,
6,6,55,6,6,6,6,6,6,55,59,55,55,6,6,55,55,6,55,55,6,6,55,6,55,
6,55,6,6,6,55,55,6,55,55,55,6,6,55,913,914,914,915,55,6,55,55,6,6,55,
55,55,6,55,55,59,6,55,55,6,55,6,6,6,962,963,963,964,55,6,55,55,6,6,55,
6,55,6,6,6,6,55,6,55,55,55,55,6,6,1011,1012,1012,1013,55,55,55,55,6,55,6,
55,6,55,55,6,55,6,55,6,55,6,6,6,6,55,6,55,55,55,6,55,55,6,6,55,
6,55,6,55,6,55,55,55,55,6,55,6,6,6,6,55,55,6,55,6,6,6,55,55,55,
55,55,6,55,55,55,55,6,6,55,6,55,55,55,55,55,55,6,6,55,55,55,55,55,55
</data>
</layer>
<layer id="2" name="Calque de Tuiles 2" width="25" height="25">
<data encoding="csv">
455,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,514,738,739,739,739,739,739,739,739,739,739,739,740,514,0,289,0,0,0,0,0,0,0,
0,0,563,787,736,837,837,837,837,837,837,837,837,737,789,563,0,0,0,0,0,0,0,0,0,
0,0,0,787,789,0,0,0,0,0,0,0,0,787,789,0,0,0,0,0,289,0,0,0,0,
0,0,514,787,789,0,0,0,0,0,0,0,0,787,789,514,0,0,0,0,0,0,0,0,0,
0,0,563,787,789,0,0,0,0,0,0,0,0,787,789,563,0,0,0,0,0,0,0,0,0,
0,0,0,787,789,0,0,0,0,0,0,0,0,787,789,0,0,0,0,0,0,0,0,0,0,
0,0,514,787,789,0,0,0,0,0,0,0,0,787,789,514,0,0,0,291,292,532,0,0,472,
0,0,563,787,789,0,0,0,0,0,0,0,0,787,789,563,0,514,0,340,341,532,532,0,0,
0,0,0,787,785,739,739,739,739,739,739,739,739,786,789,0,0,563,313,0,0,0,0,0,0,
0,0,514,836,837,837,837,837,837,837,837,837,837,837,838,514,0,0,0,406,0,359,359,0,0,
0,0,563,0,0,0,0,0,0,0,0,0,0,0,0,563,0,0,0,313,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,563,0,0,0,514,0,0,0,0,0,514,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,563,0,0,0,0,0,563,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,514,0,0,0,0,0,0,0,0,0,0,0,909,914,914,910,0,0,0,0,0,0,0,
0,0,563,0,0,0,0,0,0,0,1023,1020,1020,1020,958,963,963,959,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,1023,1024,0,0,1007,960,960,1008,0,0,0,16,0,0,0,
0,0,0,0,0,0,0,0,0,0,1023,1024,0,0,0,383,0,0,0,60,60,109,0,0,0,
0,0,0,0,0,0,0,0,0,0,1023,1019,1020,1020,0,33,0,383,20,256,256,305,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,934,936,0,0,0,0,0,0,0,0,
0,885,886,886,886,886,886,886,886,886,886,886,886,886,886,933,936,0,0,0,0,0,0,0,0,
0,983,984,984,984,984,984,984,984,984,984,984,984,984,984,984,985,0,0,0,0,0,0,0,0
</data>
</layer>
</map>

42
assets-cg/Tiled/world.tmx Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="15" height="15" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="tileset.tsx"/>
<layer id="1" name="Calque de Tuiles 1" width="15" height="15">
<data encoding="csv">
6,6,55,6,55,6,59,59,55,6,55,59,6,3,4,
55,55,55,55,55,6,55,55,55,6,6,55,3,100,53,
55,55,6,6,55,55,59,6,59,59,59,59,52,53,53,
6,55,59,6,6,55,6,55,55,6,55,3,100,53,50,
59,59,55,55,6,59,59,59,6,55,6,52,53,50,103,
59,59,59,55,59,55,55,55,6,59,6,101,102,103,55,
6,59,55,59,55,55,6,6,55,55,59,6,6,59,6,
59,6,55,55,6,6,55,6,6,55,6,59,6,55,59,
59,55,59,6,6,55,958,55,6,59,55,59,6,59,55,
59,6,55,59,55,55,108,108,59,59,55,55,55,6,6,
55,59,59,6,55,108,108,108,108,59,59,59,6,59,55,
6,59,6,55,59,6,6,6,55,55,6,59,59,55,55,
6,55,55,55,55,55,59,55,55,55,59,6,59,59,6,
6,59,55,6,6,59,55,59,59,59,6,59,55,6,6,
59,59,55,6,55,59,6,6,6,55,6,6,6,6,6
</data>
</layer>
<layer id="2" name="Calque de Tuiles 2" width="15" height="15">
<data encoding="csv">
470,471,59,59,59,6,6,59,562,55,59,6,0,0,0,
473,6,562,473,55,562,6,513,59,59,513,0,0,0,0,
471,471,6,471,59,55,59,55,562,59,562,0,0,200,565,
472,59,6,6,867,868,868,868,868,868,869,0,0,0,0,
0,0,0,0,916,473,55,55,472,55,918,0,0,0,0,
0,0,0,0,916,0,0,60,11,109,918,0,0,0,0,
0,867,868,868,865,0,0,257,209,308,864,868,868,869,0,
0,916,0,0,460,0,909,910,0,59,471,6,473,918,0,
0,916,0,0,460,909,946,959,910,471,55,473,6,918,0,
0,916,0,0,460,958,1007,1008,959,470,470,59,472,918,0,
0,965,966,966,816,1007,0,0,1008,0,815,966,966,967,0,
0,0,0,0,916,858,860,858,860,19,918,0,0,0,0,
513,6,0,0,916,0,0,0,0,0,918,0,0,0,0,
59,6,0,0,965,966,966,966,966,431,967,0,0,0,0,
55,562,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
</map>

View File

@ -1,28 +1,28 @@
{ "compressionlevel":-1,
"height":25,
"height":15,
"infinite":false,
"layers":[
{
"data":[55, 55, 55, 6, 55, 55, 6, 6, 55, 6, 59, 6, 55, 6, 6, 55, 55, 6, 55, 6, 55, 55, 6, 55, 6, 55, 6, 55, 55, 6, 55, 6, 59, 59, 55, 55, 6, 6, 6, 6, 6, 55, 55, 55, 6, 6, 55, 6, 6, 6, 6, 6, 6, 55, 6, 6, 55, 55, 6, 6, 55, 55, 59, 55, 6, 55, 6, 55, 6, 6, 6, 59, 6, 55, 6, 55, 6, 6, 6, 59, 55, 6, 3, 4, 4, 4, 5, 55, 55, 59, 55, 55, 59, 55, 6, 6, 6, 55, 55, 6, 55, 55, 6, 6, 55, 3, 4, 100, 1076, 53, 53, 54, 55, 6, 55, 6, 55, 55, 6, 55, 55, 55, 6, 6, 6, 6, 55, 6, 59, 6, 52, 53, 53, 53, 53, 53, 99, 5, 6, 6, 55, 55, 55, 55, 55, 55, 55, 6, 55, 6, 55, 6, 6, 6, 6, 101, 51, 53, 53, 53, 53, 53, 54, 55, 55, 55, 55, 55, 6, 6, 59, 55, 6, 6, 55, 6, 55, 6, 55, 55, 55, 52, 53, 53, 1078, 50, 102, 103, 55, 55, 55, 59, 6, 6, 55, 6, 55, 55, 6, 6, 55, 55, 59, 6, 55, 55, 101, 102, 102, 102, 103, 55, 6, 6, 55, 6, 6, 55, 6, 6, 55, 55, 6, 55, 6, 55, 55, 55, 55, 59, 55, 55, 55, 55, 6, 6, 6, 6, 55, 59, 6, 55, 6, 6, 6, 55, 55, 6, 6, 55, 55, 6, 55, 6, 6, 6, 6, 6, 6, 55, 6, 6, 6, 6, 55, 6, 55, 6, 6, 55, 6, 6, 55, 55, 55, 55, 6, 59, 55, 55, 55, 6, 55, 6, 6, 6, 55, 6, 55, 6, 55, 6, 55, 55, 55, 6, 6, 55, 55, 55, 55, 55, 55, 55, 59, 6, 6, 55, 55, 55, 55, 55, 55, 55, 6, 6, 6, 59, 55, 6, 55, 6, 55, 55, 6, 6, 55, 55, 55, 55, 6, 6, 6, 6, 55, 55, 59, 6, 55, 55, 55, 55, 6, 55, 55, 59, 6, 6, 55, 55, 55, 55, 59, 55, 55, 6, 55, 59, 6, 6, 6, 6, 6, 55, 6, 55, 6, 6, 6, 6, 6, 6, 55, 55, 55, 6, 55, 55, 55, 6, 55, 55, 6, 55, 55, 6, 55, 55, 6, 6, 6, 55, 55, 55, 6, 6, 55, 6, 6, 6, 55, 6, 55, 55, 59, 6, 6, 55, 59, 6, 6, 6, 6, 55, 59, 55, 6, 55, 6, 55, 55, 6, 55, 55, 6, 6, 55, 55, 6, 6, 6, 6, 55, 55, 6, 6, 55, 55, 6, 55, 6, 6, 6, 6, 55, 55, 6, 55, 6, 55, 6, 6, 55, 6, 6, 6, 6, 6, 6, 55, 59, 55, 55, 6, 6, 55, 55, 6, 55, 55, 6, 6, 55, 6, 55, 6, 55, 6, 6, 6, 55, 55, 6, 55, 55, 55, 6, 6, 55, 913, 914, 914, 915, 55, 6, 55, 55, 6, 6, 55, 55, 55, 6, 55, 55, 59, 6, 55, 55, 6, 55, 6, 6, 6, 962, 963, 963, 964, 55, 6, 55, 55, 6, 6, 55, 6, 55, 6, 6, 6, 6, 55, 6, 55, 55, 55, 55, 6, 6, 1011, 1012, 1012, 1013, 55, 55, 55, 55, 6, 55, 6, 55, 6, 55, 55, 6, 55, 6, 55, 6, 55, 6, 6, 6, 6, 55, 6, 55, 55, 55, 6, 55, 55, 6, 6, 55, 6, 55, 6, 55, 6, 55, 55, 55, 55, 6, 55, 6, 6, 6, 6, 55, 55, 6, 55, 6, 6, 6, 55, 55, 55, 55, 55, 6, 55, 55, 55, 55, 6, 6, 55, 6, 55, 55, 55, 55, 55, 55, 6, 6, 55, 55, 55, 55, 55, 55],
"height":25,
"data":[6, 6, 55, 6, 55, 6, 59, 59, 55, 6, 55, 59, 6, 3, 4, 55, 55, 55, 55, 55, 6, 55, 55, 55, 6, 6, 55, 3, 100, 53, 55, 55, 6, 6, 55, 55, 59, 6, 59, 59, 59, 59, 52, 53, 53, 6, 55, 59, 6, 6, 55, 6, 55, 55, 6, 55, 3, 100, 53, 50, 59, 59, 55, 55, 6, 59, 59, 59, 6, 55, 6, 52, 53, 50, 103, 59, 59, 59, 55, 59, 55, 55, 55, 6, 59, 6, 101, 102, 103, 55, 6, 59, 55, 59, 55, 55, 6, 6, 55, 55, 59, 6, 6, 59, 6, 59, 6, 55, 55, 6, 6, 55, 6, 6, 55, 6, 59, 6, 55, 59, 59, 55, 59, 6, 6, 55, 958, 55, 6, 59, 55, 59, 6, 59, 55, 59, 6, 55, 59, 55, 55, 108, 108, 59, 59, 55, 55, 55, 6, 6, 55, 59, 59, 6, 55, 108, 108, 108, 108, 59, 59, 59, 6, 59, 55, 6, 59, 6, 55, 59, 6, 6, 6, 55, 55, 6, 59, 59, 55, 55, 6, 55, 55, 55, 55, 55, 59, 55, 55, 55, 59, 6, 59, 59, 6, 6, 59, 55, 6, 6, 59, 55, 59, 59, 59, 6, 59, 55, 6, 6, 59, 59, 55, 6, 55, 59, 6, 6, 6, 55, 6, 6, 6, 6, 6],
"height":15,
"id":1,
"name":"Calque de Tuiles 1",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":25,
"width":15,
"x":0,
"y":0
},
{
"data":[455, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 738, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 740, 514, 0, 289, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, 787, 736, 837, 837, 837, 837, 837, 837, 837, 837, 737, 789, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 0, 0, 0, 0, 0, 289, 0, 0, 0, 0, 0, 0, 514, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 514, 0, 0, 0, 291, 292, 532, 0, 0, 472, 0, 0, 563, 787, 789, 0, 0, 0, 0, 0, 0, 0, 0, 787, 789, 563, 0, 514, 0, 340, 341, 532, 532, 0, 0, 0, 0, 0, 787, 785, 739, 739, 739, 739, 739, 739, 739, 739, 786, 789, 0, 0, 563, 313, 0, 0, 0, 0, 0, 0, 0, 0, 514, 836, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 838, 514, 0, 0, 0, 406, 0, 359, 359, 0, 0, 0, 0, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, 0, 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, 0, 514, 0, 0, 0, 0, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, 0, 0, 0, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 909, 914, 914, 910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, 0, 0, 0, 0, 0, 1023, 1020, 1020, 1020, 958, 963, 963, 959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1023, 1024, 0, 0, 1007, 960, 960, 1008, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1023, 1024, 0, 0, 0, 383, 0, 0, 0, 60, 60, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1023, 1019, 1020, 1020, 0, 33, 0, 383, 20, 256, 256, 305, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 934, 936, 0, 0, 0, 0, 0, 0, 0, 0, 0, 885, 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, 933, 936, 0, 0, 0, 0, 0, 0, 0, 0, 0, 983, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 985, 0, 0, 0, 0, 0, 0, 0, 0],
"height":25,
"data":[470, 471, 59, 59, 59, 6, 6, 59, 562, 55, 59, 6, 0, 0, 0, 473, 6, 562, 473, 55, 562, 6, 513, 59, 59, 513, 0, 0, 0, 0, 471, 471, 6, 471, 59, 55, 59, 55, 562, 59, 562, 0, 0, 200, 565, 472, 59, 6, 6, 867, 868, 868, 868, 868, 868, 869, 0, 0, 0, 0, 0, 0, 0, 0, 916, 473, 55, 55, 472, 55, 918, 0, 0, 0, 0, 0, 0, 0, 0, 916, 0, 0, 60, 11, 109, 918, 0, 0, 0, 0, 0, 867, 868, 868, 865, 0, 0, 257, 209, 308, 864, 868, 868, 869, 0, 0, 916, 0, 0, 460, 0, 909, 910, 0, 59, 471, 6, 473, 918, 0, 0, 916, 0, 0, 460, 909, 946, 959, 910, 471, 55, 473, 6, 918, 0, 0, 916, 0, 0, 460, 958, 1007, 1008, 959, 470, 470, 59, 472, 918, 0, 0, 965, 966, 966, 816, 1007, 0, 0, 1008, 0, 815, 966, 966, 967, 0, 0, 0, 0, 0, 916, 858, 860, 858, 860, 19, 918, 0, 0, 0, 0, 513, 6, 0, 0, 916, 0, 0, 0, 0, 0, 918, 0, 0, 0, 0, 59, 6, 0, 0, 965, 966, 966, 966, 966, 431, 967, 0, 0, 0, 0, 55, 562, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":15,
"id":2,
"name":"Calque de Tuiles 2",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":25,
"width":15,
"x":0,
"y":0
}],
@ -40,5 +40,5 @@
"tilewidth":16,
"type":"map",
"version":"1.6",
"width":25
"width":15
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -11,7 +11,8 @@ void display_map(const int x_offset, const int y_offset)
{
for (int x = 0 ; x <= SCREEN_WIDTH; x ++)
{
unsigned int tile_id = map_world.layers[layer][(y + y_offset / TILE_SIZE) * map_world.width + (x + x_offset / TILE_SIZE)];
unsigned int tile_id = 0;
if (x < map_world.width && y < map_world.height) tile_id = map_world.layers[layer][(y + y_offset / TILE_SIZE) * map_world.width + (x + x_offset / TILE_SIZE)];
if (tile_id != 0)
{

View File

@ -15,7 +15,7 @@ int main(void)
while (key != KEY_EXIT)
{
dclear(C_WHITE);
dclear(C_BLACK);
display_map(x_offset, y_offset);
dprint(2, 2, C_BLACK, "(%d, %d)", x_offset, y_offset);
dupdate();