- various compilations fixes for Symbian
- small cleanups of the TestSuite and Player classes
This commit is contained in:
@@ -75,8 +75,8 @@ JFileSystem* JFileSystem::GetInstance()
|
||||
init( RESPATH"/");
|
||||
#else
|
||||
init("Res/");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ void JMD2Model::Render(int frameNum)
|
||||
// display the textured model with proper lighting normals
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
@@ -296,7 +296,7 @@ void JMD2Model::Render(int frameNum)
|
||||
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1)|| (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1)|| (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
float vertex_data[]={
|
||||
pointList[mModel->triIndex[i].meshIndex[0]].x, pointList[mModel->triIndex[i].meshIndex[0]].y, pointList[mModel->triIndex[i].meshIndex[0]].z,
|
||||
pointList[mModel->triIndex[i].meshIndex[2]].x, pointList[mModel->triIndex[i].meshIndex[2]].y, pointList[mModel->triIndex[i].meshIndex[2]].z,
|
||||
@@ -330,7 +330,7 @@ void JMD2Model::Render(int frameNum)
|
||||
}
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDrawArrays(GL_TRIANGLES,0,3); // seems suspicious to put that here, should probably be in the loop
|
||||
#else
|
||||
glEnd();
|
||||
@@ -483,7 +483,7 @@ void JMD2Model::Render()
|
||||
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
// FIXME
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
#else
|
||||
@@ -538,7 +538,7 @@ void JMD2Model::Render()
|
||||
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
// FIXME
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
float vertex_data[]={
|
||||
vertex[0].x, vertex[0].y, vertex[0].z,
|
||||
vertex[2].x, vertex[2].y, vertex[2].z,
|
||||
@@ -572,7 +572,7 @@ void JMD2Model::Render()
|
||||
}
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
// FIXME
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDrawArrays(GL_TRIANGLES,0,3); // seems suspicious to put that here, should probably be in the loop
|
||||
#else
|
||||
glEnd();
|
||||
|
||||
@@ -1002,7 +1002,7 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
|
||||
glScalef(xScale, yScale, 1.0f);
|
||||
}
|
||||
|
||||
#if (defined GL_VERSION_ES_CM_1_1)
|
||||
#if (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -1132,7 +1132,7 @@ void JRenderer::RenderQuad(JQuad* quad, VertexColor* pt)
|
||||
//glDrawElements ( GL_TRIANGLE_STRIP, 6, GL_UNSIGNED_SHORT, indices );
|
||||
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -1241,7 +1241,7 @@ void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -1338,7 +1338,7 @@ void JRenderer::DrawRect(float x, float y, float width, float height, PIXEL_TYPE
|
||||
|
||||
glDrawArrays(GL_LINE_LOOP,0,4);
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -1438,7 +1438,7 @@ void JRenderer::FillRect(float x, float y, float width, float height, JColor* co
|
||||
glUniformMatrix4fv( prog1_mvpLoc, 1, GL_FALSE, (GLfloat*) &theMvpMatrix.m[0][0] );
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -1530,7 +1530,7 @@ void JRenderer::DrawLine(float x1, float y1, float x2, float y2, PIXEL_TYPE colo
|
||||
|
||||
glDrawArrays(GL_LINES,0,2);
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -1575,7 +1575,7 @@ void JRenderer::Plot(float x, float y, PIXEL_TYPE color)
|
||||
{
|
||||
checkGlError();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) && (!defined GL_VERSION_ES_CM_1_1)
|
||||
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) && (!defined GL_VERSION_ES_CM_1_1) && (!defined GL_OES_VERSION_1_1)
|
||||
JColor col;
|
||||
col.color = color;
|
||||
glColor4ub(col.r, col.g, col.b, col.a);
|
||||
@@ -1595,7 +1595,7 @@ void JRenderer::PlotArray(float *x, float *y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
checkGlError();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) && (!defined GL_VERSION_ES_CM_1_1)
|
||||
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) && (!defined GL_VERSION_ES_CM_1_1) && (!defined GL_OES_VERSION_1_1)
|
||||
JColor col;
|
||||
col.color = color;
|
||||
glColor4ub(col.r, col.g, col.b, col.a);
|
||||
@@ -2479,7 +2479,7 @@ void JRenderer::Enable2D()
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
|
||||
#if (defined GL_VERSION_ES_CM_1_1)
|
||||
#if (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glOrthof(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
|
||||
#else
|
||||
gluOrtho2D(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f);
|
||||
@@ -2607,7 +2607,7 @@ void JRenderer::RenderTriangles(JTexture* texture, Vertex3D *vertices, int start
|
||||
|
||||
delete[] colorCoords;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -2707,7 +2707,7 @@ void JRenderer::FillPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
delete[] vVertices;
|
||||
delete[] colors;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -2813,7 +2813,7 @@ void JRenderer::DrawPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
delete[] vVertices;
|
||||
delete[] colors;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
@@ -2955,7 +2955,7 @@ void JRenderer::DrawCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
|
||||
glDrawArrays(GL_LINE_STRIP,0,number);
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
@@ -3069,7 +3069,7 @@ void JRenderer::FillCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN,0,number);
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
@@ -3191,7 +3191,7 @@ void JRenderer::DrawPolygon(float x, float y, float size, int count, float start
|
||||
delete[] vVertices;
|
||||
delete[] colors;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
@@ -3315,7 +3315,7 @@ void JRenderer::FillPolygon(float x, float y, float size, int count, float start
|
||||
delete[] vVertices;
|
||||
delete[] colors;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
@@ -3469,7 +3469,7 @@ void JRenderer::DrawRoundRect(float x, float y, float w, float h, float radius,
|
||||
delete[] vVertices;
|
||||
delete[] colors;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
@@ -3658,7 +3658,7 @@ void JRenderer::FillRoundRect(float x, float y, float w, float h, float radius,
|
||||
delete[] vVertices;
|
||||
delete[] colors;
|
||||
|
||||
#elif (defined GL_VERSION_ES_CM_1_1)
|
||||
#elif (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
@@ -389,7 +389,7 @@ public:
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
//general restrictions
|
||||
if (opponentPoisoned && !source->controller()->opponent()->isPoisoned)
|
||||
if (opponentPoisoned && !source->controller()->opponent()->isPoisoned())
|
||||
return 0;
|
||||
if (sourceUntapped && source->isTapped() == 1)
|
||||
return 0;
|
||||
|
||||
@@ -28,7 +28,6 @@ public:
|
||||
JQuadPtr mAvatar;
|
||||
int playMode;
|
||||
bool nomaxhandsize;
|
||||
bool isPoisoned;
|
||||
MTGPlayerCards * game;
|
||||
MTGDeck * mDeck;
|
||||
string deckFile;
|
||||
@@ -56,6 +55,7 @@ public:
|
||||
int loseLife(int value);
|
||||
int gainOrLoseLife(int value);
|
||||
|
||||
bool isPoisoned() {return (poisonCount > 0);}
|
||||
int poisoned();
|
||||
int damaged();
|
||||
int prevented();
|
||||
|
||||
@@ -59,45 +59,52 @@ public:
|
||||
|
||||
class TestSuite
|
||||
{
|
||||
public:
|
||||
MTGAllCards* collection;
|
||||
int summoningSickness;
|
||||
bool forceAbility;
|
||||
int gameType;
|
||||
float timerLimit;
|
||||
unsigned int seed;
|
||||
int aiMaxCalls;
|
||||
int currentAction;
|
||||
TestSuiteState initState;
|
||||
private:
|
||||
int currentfile;
|
||||
int nbfiles;
|
||||
string files[1024];
|
||||
TestSuiteState endState;
|
||||
TestSuiteActions actions;
|
||||
string files[1024];
|
||||
int nbfiles;
|
||||
int currentfile;
|
||||
int nbFailed, nbTests, nbAIFailed, nbAITests;
|
||||
bool forceAbility;
|
||||
int summoningSickness;
|
||||
|
||||
int load(const char * filename);
|
||||
TestSuite(const char * filename,MTGAllCards* _collection);
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
/* but only used by the testsuite classes */
|
||||
float timerLimit;
|
||||
int aiMaxCalls;
|
||||
int currentAction;
|
||||
|
||||
TestSuiteState initState;
|
||||
string getNextAction();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int assertGame();
|
||||
|
||||
public:
|
||||
int gameType;
|
||||
unsigned int seed;
|
||||
int nbFailed, nbTests, nbAIFailed, nbAITests;
|
||||
TestSuite(const char * filename);
|
||||
void initGame();
|
||||
void pregameTests();
|
||||
int assertGame();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
string getNextAction();
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int loadNext();
|
||||
void cleanup();
|
||||
static int Log(const char * text);
|
||||
|
||||
};
|
||||
|
||||
class TestSuiteAI:public AIPlayerBaka
|
||||
{
|
||||
public:
|
||||
TestSuite * suite;
|
||||
private:
|
||||
MTGCardInstance * getCard(string action);
|
||||
float timer;
|
||||
TestSuite * suite;
|
||||
|
||||
public:
|
||||
TestSuiteAI(TestSuite * suite, int playerId);
|
||||
virtual int Act(float dt);
|
||||
MTGCardInstance * getCard(string action);
|
||||
virtual int displayStack();
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ void GameObserver::nextGamePhase()
|
||||
cleanupPhase();
|
||||
currentPlayer->damageCount = 0;
|
||||
currentPlayer->preventable = 0;
|
||||
currentPlayer->isPoisoned = false;
|
||||
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
||||
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
|
||||
mLayers->actionLayer()->Update(0);
|
||||
@@ -371,8 +370,6 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
if(getCurrentTargetChooser() && int(getCurrentTargetChooser()->targets.size()) == getCurrentTargetChooser()->maxtargets)
|
||||
getCurrentTargetChooser()->done = true;
|
||||
for (int i = 0; i < 2; i++)
|
||||
players[i]->isPoisoned = (players[i]->poisonCount > 0);
|
||||
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
|
||||
return;
|
||||
if (mLayers->actionLayer()->menuObject)
|
||||
|
||||
@@ -105,7 +105,7 @@ void GameStateDuel::Start()
|
||||
|
||||
#ifdef TESTSUITE
|
||||
SAFE_DELETE(testSuite);
|
||||
testSuite = NEW TestSuite("test/_tests.txt",MTGCollection());
|
||||
testSuite = NEW TestSuite("test/_tests.txt");
|
||||
#endif
|
||||
|
||||
setGamePhase(DUEL_STATE_CHOOSE_DECK1);
|
||||
|
||||
@@ -551,9 +551,8 @@ int TestSuite::assertGame()
|
||||
return 1;
|
||||
}
|
||||
|
||||
TestSuite::TestSuite(const char * filename, MTGAllCards* _collection)
|
||||
TestSuite::TestSuite(const char * filename)
|
||||
{
|
||||
collection = _collection;
|
||||
timerLimit = 0;
|
||||
|
||||
std::string s;
|
||||
|
||||
Reference in New Issue
Block a user