Connection points no longer make connections to the starting level mistakenly thanks to the Tiled editor. Fixes Issue #101. Release Build 12296.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 6m44s
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 6m44s
This commit is contained in:
parent
ddf7ade42e
commit
260b4edd88
@ -108,44 +108,41 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
|
||||
|
||||
#pragma region Handle Connection Point Clicking and Movement
|
||||
for(ConnectionPoint&cp:connections){
|
||||
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)
|
||||
||game->KEY_LEFT.Pressed()||game->KEY_RIGHT.Pressed()||game->KEY_UP.Pressed()||game->KEY_DOWN.Pressed()
|
||||
||(!analogMove&&(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog())>=0.2f))){
|
||||
bool mouseUsed=game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)&&!Menu::IsMouseOverMenu()&&game->IsMouseInsideWindow();
|
||||
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){
|
||||
|
||||
if(Unlock::IsUnlocked(cp)){
|
||||
if(mouseUsed){
|
||||
UpdateCurrentConnectionPoint(cp);
|
||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||
if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true;
|
||||
goto doneNavigating;
|
||||
}else{
|
||||
for(int directionInd=0;int neighborInd:currentConnectionPoint->neighbors){
|
||||
int targetDirection=-1;
|
||||
|
||||
if(game->KEY_LEFT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::WEST;
|
||||
if(game->KEY_RIGHT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()>=0.2f)targetDirection=ConnectionPoint::EAST;
|
||||
if(game->KEY_UP.Pressed()||game->KEY_SCROLLVERT_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::NORTH;
|
||||
if(game->KEY_DOWN.Pressed()||game->KEY_SCROLLVERT_L.Analog()>=0.2f)targetDirection=ConnectionPoint::SOUTH;
|
||||
|
||||
if(neighborInd==-1){
|
||||
directionInd++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
|
||||
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&targetDirection==directionInd){
|
||||
UpdateCurrentConnectionPoint(neighbor);
|
||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||
if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true;
|
||||
goto doneNavigating;
|
||||
}
|
||||
directionInd++;
|
||||
}
|
||||
}
|
||||
UpdateCurrentConnectionPoint(cp);
|
||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||
if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(game->KEY_LEFT.Pressed()||game->KEY_RIGHT.Pressed()||game->KEY_UP.Pressed()||game->KEY_DOWN.Pressed()
|
||||
||(!analogMove&&(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog())>=0.2f))){
|
||||
for(int directionInd=0;int neighborInd:currentConnectionPoint->neighbors){
|
||||
int targetDirection=-1;
|
||||
|
||||
if(game->KEY_UP.Pressed()||game->KEY_SCROLLVERT_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::NORTH;
|
||||
if(game->KEY_RIGHT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()>=0.2f)targetDirection=ConnectionPoint::EAST;
|
||||
if(game->KEY_DOWN.Pressed()||game->KEY_SCROLLVERT_L.Analog()>=0.2f)targetDirection=ConnectionPoint::SOUTH;
|
||||
if(game->KEY_LEFT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::WEST;
|
||||
|
||||
|
||||
if(neighborInd==-1){
|
||||
directionInd++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
|
||||
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&targetDirection==directionInd){
|
||||
UpdateCurrentConnectionPoint(neighbor);
|
||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||
if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true;
|
||||
break;
|
||||
}
|
||||
directionInd++;
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
doneNavigating:
|
||||
if(abs(game->KEY_SCROLLVERT_L.Analog())<0.2f&&abs(game->KEY_SCROLLHORZ_L.Analog())<0.2f){
|
||||
|
||||
@ -715,7 +715,12 @@ class TMXParser{
|
||||
int direction=stoi(key2.first.substr("Connection "s.length(),1))-1;
|
||||
int&neighborElement=newConnection.neighbors[direction];
|
||||
if(neighborElement!=-1)ERR(std::format("WARNING! Connection Point in direction {} is already occupied by node {}!",direction,neighborElement));
|
||||
newConnection.neighbors[direction]=key2.second.GetInteger();
|
||||
const int val{key2.second.GetInteger()};
|
||||
if(val==0){
|
||||
LOG(std::format("WARNING! {} is supposedly connected to {}, this is very likely a mistake!!!",newConnection.name,State_OverworldMap::connections[val].name));
|
||||
continue; //Prevents accidental connections to index 0 (Which shouldn't be happening)!
|
||||
}
|
||||
newConnection.neighbors[direction]=val;
|
||||
}
|
||||
}
|
||||
State_OverworldMap::connections.push_back(newConnection);
|
||||
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 12289
|
||||
#define VERSION_BUILD 12296
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="left-down" width="266" height="184" tilewidth="4" tileheight="4" infinite="0" nextlayerid="5" nextobjectid="65">
|
||||
<map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="left-down" width="266" height="184" tilewidth="4" tileheight="4" infinite="0" nextlayerid="5" nextobjectid="66">
|
||||
<properties>
|
||||
<property name="Background Music" propertytype="BGM" value="overworld"/>
|
||||
<property name="Level Type" type="int" propertytype="LevelType" value="4"/>
|
||||
@ -986,7 +986,6 @@
|
||||
</object>
|
||||
<object id="52" name="Story IV-I" type="StagePlate" x="565" y="257" width="18" height="22">
|
||||
<properties>
|
||||
<property name="Connection 1 - North" type="object" value="0"/>
|
||||
<property name="Connection 2 - East" type="object" value="53"/>
|
||||
<property name="Connection 4 - West" type="object" value="51"/>
|
||||
<property name="Map" propertytype="Level" value="STORY_4_1"/>
|
||||
@ -996,8 +995,8 @@
|
||||
</object>
|
||||
<object id="53" name="Stage IV-I" type="StagePlate" x="609" y="253" width="42" height="14">
|
||||
<properties>
|
||||
<property name="Connection 1 - North" type="object" value="0"/>
|
||||
<property name="Connection 2 - East" type="object" value="55"/>
|
||||
<property name="Connection 3 - South" type="object" value="0"/>
|
||||
<property name="Connection 4 - West" type="object" value="52"/>
|
||||
<property name="Map" propertytype="Level" value="CAMPAIGN_4_1"/>
|
||||
<property name="Type" propertytype="StageType" value="DUNGEON"/>
|
||||
@ -1103,5 +1102,8 @@
|
||||
<property name="Unlock Condition" propertytype="Level" value="STORY_2_1"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="65" x="261" y="447" width="130" height="46">
|
||||
<text fontfamily="Courier New" pixelsize="9" wrap="1" color="#ff0000" bold="1">NOTE: Nothing should be connected to the initial stage plate!!</text>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user