[Client] Make Back button work in character generation

Character generation was coded in a strange way by Koncord in the earliest days of the project, but this fixes the main problem with it.
0.8.0
David Cernat 3 years ago
parent e72bacbed3
commit 2898ad6e9a

@ -17,6 +17,17 @@
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
/*
Start of tes3mp addition
Include additional headers for multiplayer purposes
*/
#include "../mwmp/Main.hpp"
#include "../mwmp/LocalPlayer.hpp"
/*
End of tes3mp addition
*/
#include "textinput.hpp" #include "textinput.hpp"
#include "race.hpp" #include "race.hpp"
#include "class.hpp" #include "class.hpp"
@ -329,6 +340,16 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->popGuiMode(); MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth); MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
/*
Start of tes3mp addition
Decrease the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage--;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::onReviewActivateDialog(int parDialog) void CharacterCreation::onReviewActivateDialog(int parDialog)
@ -381,6 +402,16 @@ namespace MWGui
selectPickedClass(); selectPickedClass();
handleDialogDone(CSE_ClassChosen, GM_Birth); handleDialogDone(CSE_ClassChosen, GM_Birth);
/*
Start of tes3mp addition
Increase the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage++;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::onPickClassDialogBack() void CharacterCreation::onPickClassDialogBack()
@ -411,6 +442,16 @@ namespace MWGui
break; break;
case ClassChoiceDialog::Class_Back: case ClassChoiceDialog::Class_Back:
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race); MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
/*
Start of tes3mp addition
Decrease the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage--;
/*
End of tes3mp addition
*/
break; break;
}; };
@ -439,6 +480,16 @@ namespace MWGui
} }
handleDialogDone(CSE_NameChosen, GM_Race); handleDialogDone(CSE_NameChosen, GM_Race);
/*
Start of tes3mp addition
Increase the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage++;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::selectRace() void CharacterCreation::selectRace()
@ -477,6 +528,16 @@ namespace MWGui
selectRace(); selectRace();
handleDialogDone(CSE_RaceChosen, GM_Class); handleDialogDone(CSE_RaceChosen, GM_Class);
/*
Start of tes3mp addition
Increase the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage++;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::selectBirthSign() void CharacterCreation::selectBirthSign()
@ -498,6 +559,16 @@ namespace MWGui
selectBirthSign(); selectBirthSign();
handleDialogDone(CSE_BirthSignChosen, GM_Review); handleDialogDone(CSE_BirthSignChosen, GM_Review);
/*
Start of tes3mp addition
Increase the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage++;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::onBirthSignDialogBack() void CharacterCreation::onBirthSignDialogBack()
@ -506,6 +577,16 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->popGuiMode(); MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class); MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
/*
Start of tes3mp addition
Decrease the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage--;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::selectCreatedClass() void CharacterCreation::selectCreatedClass()
@ -547,6 +628,16 @@ namespace MWGui
selectCreatedClass(); selectCreatedClass();
handleDialogDone(CSE_ClassChosen, GM_Birth); handleDialogDone(CSE_ClassChosen, GM_Birth);
/*
Start of tes3mp addition
Increase the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage++;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::onCreateClassDialogBack() void CharacterCreation::onCreateClassDialogBack()
@ -556,6 +647,16 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->popGuiMode(); MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class); MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
/*
Start of tes3mp addition
Decrease the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage--;
/*
End of tes3mp addition
*/
} }
void CharacterCreation::onClassQuestionChosen(int _index) void CharacterCreation::onClassQuestionChosen(int _index)
@ -748,6 +849,16 @@ namespace MWGui
selectGeneratedClass(); selectGeneratedClass();
handleDialogDone(CSE_ClassChosen, GM_Birth); handleDialogDone(CSE_ClassChosen, GM_Birth);
/*
Start of tes3mp addition
Increase the character generation stage tracked for the LocalPlayer
*/
mwmp::Main::get().getLocalPlayer()->charGenState.currentStage++;
/*
End of tes3mp addition
*/
} }
CharacterCreation::~CharacterCreation() CharacterCreation::~CharacterCreation()

@ -155,7 +155,6 @@ bool LocalPlayer::processCharGen()
} }
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->setPlayer(this); getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send(); getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send();
charGenState.currentStage++;
return false; return false;
} }

Loading…
Cancel
Save