mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-28 04:23:42 +01:00
added items on all maps - one bug to be corrected with coodinates
This commit is contained in:
parent
a5328d0be6
commit
9d8464e0d5
9 changed files with 133 additions and 46 deletions
|
@ -12,9 +12,9 @@ find_package(Gint 2.9 REQUIRED)
|
|||
find_package(LibProf 2.4 REQUIRED)
|
||||
|
||||
#set the color mode either to 1b or 2b
|
||||
set(COLORMODE_fx 2b)
|
||||
set(COLORMODE_fx 1b)
|
||||
#set the color mode either to 1b, 2b or EGA64
|
||||
set(COLORMODE_cg 2b)
|
||||
set(COLORMODE_cg EGA64)
|
||||
|
||||
fxconv_declare_converters(assets/converters.py)
|
||||
|
||||
|
|
8
TODO.txt
8
TODO.txt
|
@ -1,6 +1,6 @@
|
|||
- Jeu de tuile 1bit pour CG pour avoir la version 1bit vérifiable en fonctionnement dans l'émulateur de Heath
|
||||
- corriger les tuiles 1bit pour les rivières (tiles 1 2 3 et 4) avec niveaux de diphering pour tiles 1 et 3 (gris 33% et 66%)
|
||||
- ajouter face pour dialogue pour PNJ
|
||||
- ajouter indicateur visuel pour action joueur quand on est proche d'un PNJ ou d'un panneau
|
||||
[OK] - Jeu de tuile 1bit pour CG pour avoir la version 1bit vérifiable en fonctionnement dans l'émulateur de Heath
|
||||
[OK] - corriger les tuiles 1bit pour les rivières (tiles 1 2 3 et 4) avec niveaux de diphering pour tiles 1 et 3 (gris 33% et 66%)
|
||||
[OK] - ajouter face pour dialogue pour PNJ
|
||||
[OK] - ajouter indicateur visuel pour action joueur quand on est proche d'un PNJ ou d'un panneau
|
||||
|
||||
- faire des fonts lisibles avec le set `print` disponible intégralement
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="7" nextobjectid="6">
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="8" nextobjectid="9">
|
||||
<editorsettings>
|
||||
<export target="level0.json" format="json"/>
|
||||
</editorsettings>
|
||||
|
@ -90,7 +90,19 @@
|
|||
</data>
|
||||
</layer>
|
||||
<objectgroup id="4" name="ExtraData">
|
||||
<object id="1" name="PlayerStart" type="PST" x="52" y="44">
|
||||
<object id="1" name="INFO3" type="INFO" x="232" y="79.75">
|
||||
<properties>
|
||||
<property name="dialog" value="Etrange ce coffre ouvert ..."/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="8" name="INFO2" type="INFO" x="119.75" y="47.25">
|
||||
<properties>
|
||||
<property name="dialog" value="Et sa tombe est en train d'etre creusee ...^"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="7" name="INFO2" type="INFO" x="52" y="44">
|
||||
<properties>
|
||||
<property name="dialog" value="Quelqu'un est mort ici ..."/>
|
||||
</properties>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="4" nextobjectid="1">
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="2">
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
<layer id="1" name="Background" width="48" height="24">
|
||||
|
@ -16,16 +16,16 @@
|
|||
2,293,1,1,1,1,1,1,1,1,1,1,1,1,272,2,2,2,2,270,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,267,268,269,1,1,1,1,1,1,1,1,1,1,
|
||||
2,2,269,1,1,1,1,1,1,319,319,269,1,1,1,316,271,316,271,317,1,1,1,1,319,319,319,268,268,319,319,319,268,319,320,2,2,318,319,320,268,269,1,1,1,1,1,1,
|
||||
2,2,2,269,1,1,1,1,320,2,2,2,269,1,1,1,1,1,1,1,1,1,267,2,2,2,2,2,2,2,2,2,2,2,2,2,2,219,2,2,2,318,319,320,269,1,1,1,
|
||||
2,2,2,2,319,268,319,320,2,2,2,2,318,319,269,1,1,1,1,1,1,267,2,2,2,2,313,265,242,266,241,219,314,313,242,241,289,314,219,2,2,2,2,2,2,269,1,1,
|
||||
27,26,27,26,27,28,2,2,2,2,2,2,2,2,318,319,319,268,268,319,319,320,2,2,2,219,2,2,2,2,266,241,289,290,266,265,290,313,266,297,298,299,300,2,2,318,319,320,
|
||||
2,2,2,2,319,268,319,320,2,2,2,2,318,319,269,1,1,1,1,1,1,267,2,2,2,2,313,265,242,266,241,219,314,313,242,241,2,2,219,2,2,2,2,2,2,269,1,1,
|
||||
27,26,27,26,27,28,2,2,2,2,2,2,2,2,318,319,319,268,268,319,319,320,2,2,2,219,2,2,2,2,266,241,289,290,266,265,2,2,2,297,298,299,300,2,2,318,319,320,
|
||||
2,50,51,51,99,100,132,2,2,2,2,2,2,2,2,2,2,2,2,314,265,2,2,2,2,313,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
2,74,75,76,16,17,133,2,2,2,2,2,2,2,2,2,2,2,241,219,290,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
98,98,99,100,40,41,290,314,297,298,299,300,2,2,2,2,2,219,219,289,2,297,298,299,300,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,297,298,299,300,2,
|
||||
121,122,123,124,64,65,265,289,313,289,241,265,219,2,2,2,2,290,314,2,2,2,2,2,2,2,297,298,299,300,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
145,146,147,148,132,2,2,2,2,2,2,314,314,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,297,298,299,300,2,2,2,2,2,2,2,2,2,
|
||||
121,122,123,124,64,65,265,289,313,289,241,265,219,2,2,2,2,290,314,2,2,2,2,2,2,2,297,298,299,300,2,2,2,2,402,403,2,374,375,2,404,405,2,2,2,2,2,2,
|
||||
145,146,147,148,132,2,2,2,2,2,2,314,314,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
169,170,171,172,133,2,2,2,2,2,2,2,2,297,298,299,300,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,385,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,385,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,345,346,347,348,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,385,2,2,2,297,298,299,300,2,2,2,2,2,2,2,2,2,2,369,370,371,372,297,298,299,300,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,385,2,2,2,297,298,299,300,2,2,2,2,2,2,2,2,2,2,369,370,371,372,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,297,298,299,300,2,2,2,2,2,2,2,2,2,2,385,2,2,2,2,2,2,2,2,2,2,2,2,2,393,394,395,396,2,2,2,2,2,297,298,299,300,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,297,298,299,300,297,298,299,300,2,2,2,2,2,2,2,2,2,2,2,2,2,2
|
||||
</data>
|
||||
|
@ -46,19 +46,19 @@
|
|||
251,252,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,0,249,250,251,252,0,0,0,0,0,
|
||||
275,276,0,0,0,0,0,0,201,202,203,204,0,0,0,0,0,0,0,0,0,201,202,203,204,0,0,0,0,0,0,0,0,0,0,0,0,0,0,273,274,275,276,201,202,203,204,0,
|
||||
0,0,0,0,0,0,0,0,225,226,227,228,0,0,0,0,0,0,0,0,0,225,226,227,228,0,201,202,203,204,0,0,0,0,0,0,0,0,0,0,0,0,0,225,226,227,228,0,
|
||||
0,0,0,0,0,0,0,0,249,250,251,252,0,0,0,0,0,0,0,0,0,249,250,251,252,0,225,226,227,228,0,0,0,0,0,201,202,203,204,0,0,0,0,249,250,251,252,0,
|
||||
0,0,0,0,0,0,0,0,273,274,275,276,0,201,202,203,204,0,0,0,0,273,274,275,276,0,249,250,251,252,201,202,203,204,0,225,226,227,228,0,0,0,0,273,274,275,276,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,225,226,227,228,0,0,0,0,0,0,0,0,0,273,274,275,276,225,226,227,228,0,249,250,251,252,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,249,250,251,252,0,0,0,0,201,202,203,204,0,0,0,0,0,249,250,251,252,0,273,274,275,276,201,202,203,204,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,201,202,203,204,0,0,273,274,275,276,0,0,0,0,225,226,227,228,0,0,0,0,0,273,274,275,276,0,0,0,0,0,225,226,227,228,0,201,202,203,204,
|
||||
0,0,0,0,0,0,0,225,226,227,228,0,0,0,0,0,0,0,0,0,0,249,250,251,252,0,201,202,203,204,201,202,203,204,0,0,0,0,0,249,250,251,252,0,225,226,227,228,
|
||||
204,0,0,201,202,203,204,249,250,251,252,201,202,203,204,0,0,0,0,0,0,273,274,275,276,0,225,226,227,228,225,226,227,228,0,0,0,0,0,273,274,275,276,0,249,250,251,252,
|
||||
0,0,0,0,0,0,0,0,249,250,251,252,0,0,0,0,0,0,0,0,0,249,250,251,252,0,225,226,227,228,0,0,0,0,0,0,0,0,0,0,0,0,0,249,250,251,252,0,
|
||||
0,0,0,0,0,0,0,0,273,274,275,276,0,201,202,203,204,0,0,0,0,273,274,275,276,0,249,250,251,252,201,202,203,204,354,355,0,0,0,0,356,357,0,273,274,275,276,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,225,226,227,228,0,0,0,0,0,0,0,0,0,273,274,275,276,225,226,227,228,378,379,0,350,351,0,380,381,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,249,250,251,252,0,0,0,0,201,202,203,204,0,0,0,0,0,249,250,251,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,201,202,203,204,0,0,273,274,275,276,0,0,0,0,225,226,227,228,0,0,0,0,0,273,274,275,276,0,0,0,0,0,0,0,0,0,0,201,202,203,204,
|
||||
0,0,0,0,0,0,0,225,226,227,228,0,0,0,0,0,0,0,0,0,0,249,250,251,252,0,201,202,203,204,201,202,203,204,0,0,0,0,0,0,0,0,0,0,225,226,227,228,
|
||||
204,0,0,201,202,203,204,249,250,251,252,201,202,203,204,0,0,0,0,0,0,273,274,275,276,0,225,226,227,228,225,226,227,228,0,0,0,0,0,0,0,0,0,0,249,250,251,252,
|
||||
228,0,0,225,226,227,228,273,274,275,276,225,226,227,228,0,0,0,0,0,0,0,0,0,0,0,249,250,251,252,249,250,251,252,0,0,0,0,0,0,0,0,0,0,273,274,275,276,
|
||||
252,0,0,249,250,251,252,0,0,0,0,249,250,251,252,0,0,0,0,0,0,0,0,0,0,0,273,274,275,276,273,274,275,276,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
276,0,0,273,274,275,276,0,0,0,0,273,274,275,276,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
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="3" name="Walkable" width="48" height="24" visible="0">
|
||||
<layer id="3" name="Walkable" width="48" height="24">
|
||||
<data encoding="csv">
|
||||
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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
@ -77,13 +77,21 @@
|
|||
0,0,0,0,410,410,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,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,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,410,410,0,0,0,0,0,0,0,0,0,0,0,410,410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,410,410,0,0,
|
||||
410,410,410,410,410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,410,410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
410,410,410,410,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,410,410,0,0,0,0,0,0,0,0,0,0,
|
||||
410,410,410,410,410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,410,410,0,0,0,0,0,410,410,0,410,410,0,410,410,0,0,0,0,0,0,
|
||||
410,410,410,410,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,0,0,0,0,0,0,0,0,
|
||||
410,410,410,410,0,0,0,0,0,0,0,0,0,0,410,410,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,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,410,410,410,410,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,410,410,0,0,0,0,0,0,0,0,0,0,0,410,410,410,410,0,410,410,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,410,410,0,0,0,0,0,0,0,0,0,0,0,410,410,410,410,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,410,410,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,410,410,410,410,0,0,0,0,0,0,410,410,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,410,410,0,0,410,410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="4" name="ExtraData">
|
||||
<object id="1" name="INFO1" type="INFO" x="303.75" y="143.25">
|
||||
<properties>
|
||||
<property name="dialog" value="Le tombeau du Chevalier Legendaire"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="4" nextobjectid="1">
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="5">
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
<layer id="1" name="Background" width="48" height="24">
|
||||
|
@ -86,4 +86,24 @@
|
|||
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,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="4" name="ExtraData">
|
||||
<object id="1" name="INFO1" type="INFO" x="128" y="87.5">
|
||||
<properties>
|
||||
<property name="dialog" value="Encore une tombe ..."/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="2" name="INFO2" type="INFO" x="262.75" y="49">
|
||||
<properties>
|
||||
<property name="dialog" value="Un passage souterrain ..."/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="3" name="SGN1" type="SGN" x="296" y="143.75">
|
||||
<properties>
|
||||
<property name="dialog" value="C'est la maison du gardien du cimetiere"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="4" nextobjectid="1">
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="6">
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
<layer id="1" name="Background" width="48" height="24">
|
||||
|
@ -58,7 +58,7 @@
|
|||
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,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="3" name="Walkable" width="48" height="24" visible="0">
|
||||
<layer id="3" name="Walkable" width="48" height="24">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,410,410,0,0,0,0,0,0,410,410,0,0,0,0,0,0,0,410,410,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,0,0,0,0,0,0,0,0,0,0,410,410,0,0,0,0,410,0,0,0,0,0,0,0,410,410,410,410,410,410,410,410,410,410,0,410,410,
|
||||
|
@ -86,4 +86,36 @@
|
|||
0,0,0,0,0,0,0,410,410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,410,410,410,410,0,0,0,0,0,0,0,410,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="4" name="ExtraData">
|
||||
<object id="1" name="SGN5" type="SGN" x="224" y="183.25">
|
||||
<properties>
|
||||
<property name="dialog" value="Maison du Maire"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="5" name="SGN4" type="SGN" x="320.5" y="159.25">
|
||||
<properties>
|
||||
<property name="dialog" value="Maison du Boulanger"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="3" name="SGN3" type="SGN" x="184.25" y="95.75">
|
||||
<properties>
|
||||
<property name="dialog" value="Maison du Boucher"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="4" name="SGN2" type="SGN" x="343.75" y="80">
|
||||
<properties>
|
||||
<property name="dialog" value="Maison du Marechal Ferrand"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="2" name="SGN1" type="SGN" x="71.75" y="143.25">
|
||||
<properties>
|
||||
<property name="dialog" value="Maison du Fermier"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
|
11
src/game.c
11
src/game.c
|
@ -15,17 +15,21 @@ extern bopti_image_t SignAction_img;
|
|||
|
||||
void game_logic(Game *game) {
|
||||
|
||||
/* we check if interactions are possible close to the player */
|
||||
for( int i=0; i<game->map_level->nbextradata; i++ )
|
||||
{
|
||||
/* simple distance check along X and Y axis */
|
||||
if ( (abs((int) game->player.x - (int) game->map_level->extradata[i].x*PXSIZE) < 8*PXSIZE)
|
||||
&& (abs((int) game->player.y - (int) game->map_level->extradata[i].y*PXSIZE) < 8*PXSIZE))
|
||||
{
|
||||
/* the player can do something */
|
||||
game->player.canDoSomething = true;
|
||||
/* we mark the action for futur treatment in player_action() */
|
||||
game->player.whichAction = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* else nothing to be done here */
|
||||
game->player.canDoSomething = false;
|
||||
game->player.whichAction = -1;
|
||||
return;
|
||||
|
@ -34,14 +38,15 @@ void game_logic(Game *game) {
|
|||
|
||||
void render_indicator(Game *game)
|
||||
{
|
||||
/* nothing to do for the player so we quit */
|
||||
if (game->player.canDoSomething==false)
|
||||
return;
|
||||
|
||||
/* else we draw a small indicator on the screen */
|
||||
dimage(5, 5, &SignAction_img);
|
||||
//dprint( 20, 20, C_RED, "X= %d - Y= %d / Xp= %d - Yp= %d", game->player.x, game->player.y, game->map_level->extradata[0].x*PXSIZE, game->map_level->extradata[0].y*PXSIZE );
|
||||
//dprint( 20, 40, C_RED, "ABS1= %d - ABS2= %d", abs((int) game->player.x - (int) game->map_level->extradata[0].x*PXSIZE), abs((int) game->player.y - (int) game->map_level->extradata[0].y*PXSIZE) );
|
||||
}
|
||||
|
||||
|
||||
void draw(Game *game) {
|
||||
/* Draw everything. */
|
||||
render_map_by_layer(game, BACKGROUND);
|
||||
|
|
27
src/game.h
27
src/game.h
|
@ -28,22 +28,31 @@ typedef struct {
|
|||
int16_t x, y; /* The position of the player int the current map */
|
||||
uint16_t px, py; /* The position of the player on screen */
|
||||
int16_t wx, wy; /* position of the player in the world */
|
||||
int16_t life; /* How many lives the player still has between 0
|
||||
* and 100. */
|
||||
int8_t life; /* How many lives the player still has between 0 and 100. */
|
||||
int8_t speed; /* The speed of the movement of the player. */
|
||||
|
||||
bool canDoSomething; /* set to true if a action can be done in the current position of the map */
|
||||
int32_t whichAction; /* indicates which data are relevant to the current action in the extradata layer of the map */
|
||||
bool isDoingAction;
|
||||
|
||||
/* set to true if a action can be done in the current position of the map */
|
||||
bool canDoSomething;
|
||||
/* indicates which data are relevant to the current action in the */
|
||||
/* extradata layer of the map */
|
||||
int32_t whichAction;
|
||||
/* the player is doing something */
|
||||
bool isDoingAction;
|
||||
} Player;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* position of the item */
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
/* its name */
|
||||
char *name;
|
||||
/* its class (NPC, SGN, INFO, ... )*/
|
||||
char *type;
|
||||
/* data to be shown in the dialog*/
|
||||
char *dialog;
|
||||
/* ... this can be extended as per needs ... */
|
||||
} ExtraData;
|
||||
|
||||
|
||||
|
@ -66,16 +75,16 @@ typedef struct {
|
|||
|
||||
/* contain the properties of the tiles */
|
||||
/* this is given by the layer Walkable of the map in Tiled */
|
||||
|
||||
uint8_t *walkable;
|
||||
|
||||
/* structure that contains all the items on the map to interract with */
|
||||
/* each portion of the map has its own list to avoid scrutinizing too much */
|
||||
/* data when lloking for proximity of items */
|
||||
uint32_t nbextradata;
|
||||
ExtraData *extradata;
|
||||
|
||||
/* list of all the tiles */
|
||||
/* list of all the tiles to draw the background and the foreground layers */
|
||||
uint16_t *layers[];
|
||||
|
||||
|
||||
} Map;
|
||||
|
||||
|
||||
|
|
13
src/player.c
13
src/player.c
|
@ -87,12 +87,14 @@ void player_action(Game *game) {
|
|||
|
||||
if( game->player.canDoSomething ) /* we can do something */
|
||||
{
|
||||
/* we indicate that the player is occupied */
|
||||
game->player.isDoingAction = true;
|
||||
|
||||
/* we collect the information */
|
||||
char *text = game->map_level->extradata[game->player.whichAction].dialog;
|
||||
/* we use the correct image as per the class of the item */
|
||||
bopti_image_t *face;
|
||||
|
||||
if (strcmp("PST", game->map_level->extradata[game->player.whichAction].type)==0)
|
||||
if (strcmp("INFO", game->map_level->extradata[game->player.whichAction].type)==0)
|
||||
face = &INFO_Icon_img;
|
||||
else if (strcmp("NPC", game->map_level->extradata[game->player.whichAction].type)==0)
|
||||
face = &NPC_Icon_img;
|
||||
|
@ -100,11 +102,10 @@ void player_action(Game *game) {
|
|||
face = &SGN_Icon_img;
|
||||
else face = &demo_player_img;
|
||||
|
||||
showtext_dialog( game,
|
||||
face,
|
||||
text,
|
||||
true, true );
|
||||
/* we treat the action - i.e. we show a dialog */
|
||||
showtext_dialog( game, face, text, true, true );
|
||||
|
||||
/* when done we release the occupied status of the player */
|
||||
game->player.isDoingAction = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue