Hitbox fade hints implemented for colliding terrain.

pull/28/head
sigonasr2 2 years ago
parent 3f60180b68
commit bc23188d60
  1. 20
      Crawler/Crawler.cpp
  2. 2
      Crawler/Version.h
  3. 34
      Crawler/assets/maps/Decorations_c1_No_Shadow24x24.tsx

@ -636,12 +636,12 @@ void Crawler::RenderWorld(float fElapsedTime){
if(!IsForegroundTile(tileSheet,tileSheetIndex)&&!IsUpperForegroundTile(tileSheetIndex)&&!IsReflectiveTile(tileSheet,tileSheetIndex)){ if(!IsForegroundTile(tileSheet,tileSheetIndex)&&!IsUpperForegroundTile(tileSheetIndex)&&!IsReflectiveTile(tileSheet,tileSheetIndex)){
if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});} if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});}
RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY}); RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY});
} if("debug_collision_boxes"_I){
if("debug_collision_boxes"_I){ if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision;
geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision; view.FillRectDecal(vi2d{x,y}*24+collision.pos,collision.size,{0,0,0,128});
view.FillRectDecal(vi2d{x,y}*24+collision.pos,collision.size,{0,0,0,128}); view.DrawRectDecal(vi2d{x,y}*24+collision.pos,collision.size,GREY);
view.DrawRectDecal(vi2d{x,y}*24+collision.pos,collision.size,GREY); }
} }
} }
} }
@ -752,6 +752,14 @@ void Crawler::RenderWorld(float fElapsedTime){
} }
for(TileRenderData&tile:group.GetTiles()){ for(TileRenderData&tile:group.GetTiles()){
RenderTile(tile,{255,255,255,uint8_t(255-group.fadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)}); RenderTile(tile,{255,255,255,uint8_t(255-group.fadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
float distToPlayer=geom2d::line<float>(player->GetPos(),tile.pos+vf2d{12,12}).length();
if(distToPlayer<24*3&&group.fadeFactor>0&&tile.tileSheet.tileset->collision.find(tile.tileID)!=tile.tileSheet.tileset->collision.end()){
geom2d::rect<int>collision=tile.tileSheet.tileset->collision[tile.tileID].collision;
distToPlayer/=4;
if(distToPlayer<1){distToPlayer=1;}
view.FillRectDecal(tile.pos+collision.pos,collision.size,{255,0,0,uint8_t(128*group.fadeFactor/sqrt(distToPlayer))});
view.DrawRectDecal(tile.pos+collision.pos,collision.size,{128,0,0,uint8_t(255/sqrt(distToPlayer))});
}
} }
} }
} }

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 1418 #define VERSION_BUILD 1432
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -303,12 +303,13 @@
<tile id="431" type="ForegroundTile"/> <tile id="431" type="ForegroundTile"/>
<tile id="432" type="ForegroundTile"/> <tile id="432" type="ForegroundTile"/>
<tile id="433" type="ForegroundTile"/> <tile id="433" type="ForegroundTile"/>
<tile id="435"> <tile id="434" type="ForegroundTile"/>
<tile id="435" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="18" width="24" height="6"/> <object id="1" x="0" y="18" width="24" height="6"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="436"> <tile id="436" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="11" width="18" height="13"/> <object id="1" x="0" y="11" width="18" height="13"/>
</objectgroup> </objectgroup>
@ -322,14 +323,14 @@
<object id="1" x="3" y="6" width="19" height="13"/> <object id="1" x="3" y="6" width="19" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="459"> <tile id="459" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="7" y="7" width="17" height="17"/> <object id="1" x="7" y="18" width="17" height="6"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="460"> <tile id="460" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="7" width="13" height="17"/> <object id="1" x="0" y="18" width="13" height="6"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="461"> <tile id="461">
@ -356,17 +357,17 @@
<tile id="476" type="ForegroundTile"/> <tile id="476" type="ForegroundTile"/>
<tile id="477" type="ForegroundTile"/> <tile id="477" type="ForegroundTile"/>
<tile id="478" type="ForegroundTile"/> <tile id="478" type="ForegroundTile"/>
<tile id="479"> <tile id="479" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="4" y="0" width="20" height="22"/> <object id="1" x="4" y="0" width="20" height="22"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="480"> <tile id="480" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="24" height="22"/> <object id="1" x="0" y="0" width="24" height="22"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="481"> <tile id="481" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="10" height="8"/> <object id="1" x="0" y="0" width="10" height="8"/>
</objectgroup> </objectgroup>
@ -388,12 +389,12 @@
<tile id="501" type="ForegroundTile"/> <tile id="501" type="ForegroundTile"/>
<tile id="502" type="ForegroundTile"/> <tile id="502" type="ForegroundTile"/>
<tile id="503" type="ForegroundTile"/> <tile id="503" type="ForegroundTile"/>
<tile id="504"> <tile id="504" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="7" y="0" width="17" height="15"/> <object id="1" x="7" y="0" width="17" height="15"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="505"> <tile id="505" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="15"/> <object id="1" x="0" y="0" width="16" height="15"/>
</objectgroup> </objectgroup>
@ -478,12 +479,13 @@
<object id="1" x="0" y="0" width="24" height="24"/> <object id="1" x="0" y="0" width="24" height="24"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="525"> <tile id="524" type="ForegroundTile"/>
<tile id="525" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="19" width="24" height="5"/> <object id="1" x="0" y="19" width="24" height="5"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="526"> <tile id="526" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="12" width="18" height="12"/> <object id="1" x="0" y="12" width="18" height="12"/>
</objectgroup> </objectgroup>
@ -557,17 +559,17 @@
<object id="1" x="0" y="0" width="18" height="6"/> <object id="1" x="0" y="0" width="18" height="6"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="569"> <tile id="569" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="4" y="0" width="20" height="21"/> <object id="1" x="4" y="0" width="20" height="21"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="570"> <tile id="570" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="24" height="21"/> <object id="1" x="0" y="0" width="24" height="21"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="571"> <tile id="571" type="ForegroundTile">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="9" height="7"/> <object id="1" x="0" y="0" width="9" height="7"/>
</objectgroup> </objectgroup>

Loading…
Cancel
Save