Better method and now use the reset flag

This commit is contained in:
Baoulettes 2022-09-01 16:22:39 +02:00
parent 65e76dcfee
commit 2aafcc1df2
2 changed files with 17 additions and 14 deletions

View File

@ -468,10 +468,12 @@ static bool GiantLinkHandler(std::shared_ptr<Ship::Console> Console, const std::
try { try {
giantLink = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; giantLink = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
if (giantLink) if (giantLink) {
paperLink = 0;
minishLink = 0; minishLink = 0;
else } else {
resetLinkScale = 1; resetLinkScale = 1;
}
return CMD_SUCCESS; return CMD_SUCCESS;
} catch (std::invalid_argument const& ex) { } catch (std::invalid_argument const& ex) {
@ -487,13 +489,14 @@ static bool MinishLinkHandler(std::shared_ptr<Ship::Console> Console, const std:
} }
try { try {
resetLinkScale = 1;
minishLink = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; minishLink = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
if (minishLink) if (minishLink) {
paperLink = 0;
giantLink = 0; giantLink = 0;
else } else {
resetLinkScale = 1; resetLinkScale = 1;
}
return CMD_SUCCESS; return CMD_SUCCESS;
} catch (std::invalid_argument const& ex) { } catch (std::invalid_argument const& ex) {
@ -659,6 +662,12 @@ static bool PaperLinkHandler(std::shared_ptr<Ship::Console> Console, const std::
try { try {
paperLink = Ship::Math::clamp(std::stoi(args[1], nullptr, 10), 0.0f, 2.0f); paperLink = Ship::Math::clamp(std::stoi(args[1], nullptr, 10), 0.0f, 2.0f);
if (paperLink) {
minishLink = 0;
giantLink = 0;
} else {
resetLinkScale = 1;
}
return CMD_SUCCESS; return CMD_SUCCESS;
} catch (std::invalid_argument const& ex) { } catch (std::invalid_argument const& ex) {
SohImGui::console->SendErrorMessage("[SOH] Paper Link value must be a number."); SohImGui::console->SendErrorMessage("[SOH] Paper Link value must be a number.");

View File

@ -11118,16 +11118,10 @@ void Player_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actor.scale.z = 0.001f; this->actor.scale.z = 0.001f;
} }
if (paperLink == 1) { if (paperLink != 0) {
this->actor.scale.x = 0.001f; this->actor.scale.x = paperLink == 1 ? 0.001f : 0.01f;
this->actor.scale.y = 0.01f; this->actor.scale.y = 0.01f;
this->actor.scale.z = 0.01f; this->actor.scale.z = paperLink == 2 ? 0.001f : 0.01f;
}
if (paperLink == 2) {
this->actor.scale.x = 0.01f;
this->actor.scale.y = 0.01f;
this->actor.scale.z = 0.001f;
} }
if (resetLinkScale == 1) { if (resetLinkScale == 1) {