Erwan
-added possibility for tester to take control of the test suite
This commit is contained in:
@@ -43,12 +43,8 @@ void DuelLayers::init(){
|
||||
Add(NEW GuiBackground());
|
||||
}
|
||||
|
||||
void DuelLayers::Update(float dt, Player * currentPlayer)
|
||||
{
|
||||
for (int i = 0; i < nbitems; ++i) objects[i]->Update(dt);
|
||||
int isAI = currentPlayer->isAI();
|
||||
void DuelLayers::CheckUserInput(int isAI){
|
||||
u32 key;
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
while ((key = JGE::GetInstance()->ReadButton())){
|
||||
if ((!isAI) && (0 != key))
|
||||
{
|
||||
@@ -59,7 +55,16 @@ void DuelLayers::Update(float dt, Player * currentPlayer)
|
||||
if (cs->CheckUserInput(key)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DuelLayers::Update(float dt, Player * currentPlayer)
|
||||
{
|
||||
for (int i = 0; i < nbitems; ++i) objects[i]->Update(dt);
|
||||
int isAI = currentPlayer->isAI();
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
if (isAI) currentPlayer->Act(dt);
|
||||
|
||||
CheckUserInput(isAI);
|
||||
}
|
||||
|
||||
ActionStack * DuelLayers::stackLayer(){
|
||||
|
||||
@@ -10,7 +10,8 @@ using std::string;
|
||||
|
||||
TestSuiteAI::TestSuiteAI(TestSuite * _suite, int playerId):AIPlayer(_suite->buildDeck(playerId),"testsuite", "testsuite"){
|
||||
suite = _suite;
|
||||
timer= 0;
|
||||
timer = 0;
|
||||
humanMode = 0;
|
||||
mAvatarTex = JRenderer::GetInstance()->LoadTexture("ai/baka/avatar.jpg", TEX_TYPE_USE_VRAM);
|
||||
if (mAvatarTex){
|
||||
mAvatar = NEW JQuad(mAvatarTex, 0, 0, 35, 50);
|
||||
@@ -58,6 +59,12 @@ Interruptible * TestSuite::getActionByMTGId(int mtgid){
|
||||
int TestSuiteAI::Act(float dt){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
g->gameOver = NULL; // Prevent draw rule from losing the game
|
||||
if (humanMode){
|
||||
g->mLayers->CheckUserInput(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
timer+= dt;
|
||||
if (AManaProducer::currentlyTapping || timer < suite->timerLimit) return 1;
|
||||
timer = 0;
|
||||
@@ -89,6 +96,11 @@ int TestSuiteAI::Act(float dt){
|
||||
if (g->getCurrentGamePhase() != Constants::MTG_PHASE_CLEANUP) suite->currentAction--;
|
||||
g->userRequestNextGamePhase();
|
||||
}
|
||||
else if (action.compare("human")==0){
|
||||
OutputDebugString("You have control");
|
||||
humanMode = 1;
|
||||
return 1;
|
||||
}
|
||||
else if (action.compare("next")==0){
|
||||
/*
|
||||
if (drl->orderingIsNeeded){
|
||||
|
||||
Reference in New Issue
Block a user