- Prevent TestSuite from crashing, by not showing big cards during the test suite
- Updated font size in game, to be readable
- WARNING!!! One test (brass man) not working anymore !!! High priority
This commit is contained in:
wagic.the.homebrew
2009-01-17 01:46:11 +00:00
parent 731f925800
commit 1251ef0096
15 changed files with 93 additions and 114 deletions
+5 -2
View File
@@ -1,4 +1,4 @@
######################## /*########################
#Generic engine features #Generic engine features
######################## ########################
generic/first_strike.txt generic/first_strike.txt
@@ -17,7 +17,9 @@ animate_dead.txt
animate_dead2.txt animate_dead2.txt
ascendant_evincar.txt ascendant_evincar.txt
ascendant_evincar2.txt ascendant_evincar2.txt
*/
brass_man.txt brass_man.txt
/*
castle.txt castle.txt
circle_of_protection.txt circle_of_protection.txt
control_magic.txt control_magic.txt
@@ -57,4 +59,5 @@ terror.txt
volcanic_island.txt volcanic_island.txt
white_knight1.txt white_knight1.txt
wrath_of_god.txt wrath_of_god.txt
zombie_master.txt zombie_master.txt
*/
+2 -37
View File
@@ -7,43 +7,8 @@ inplay:1099,1387,1388
life:20 life:20
[DO] [DO]
1099 1099
next eot
#blockers eot
next
#combatdamage
next
#endofcombat
next
#main phase 2
next
#eot
next
#cleanup
next
#untap 2
next
#upkeep 2
next
#draw 2
next
#main 2
next
#combatbegin 2
next
#attackers 2
next
#blockers 2
next
#combatdamage 2
next
#endofcombat 2
next
#main phase II 2
next
#eot 2
next
#cleanup 1
next
#untap 1 #untap 1
next next
#upkeep 1 #upkeep 1
-1
View File
@@ -2,7 +2,6 @@
#define _LOGGER_H_ #define _LOGGER_H_
#ifdef DOLOG #ifdef DOLOG
#define LOG(x) Logger::Log(x); #define LOG(x) Logger::Log(x);
#else #else
+2
View File
@@ -1,6 +1,8 @@
#ifndef _MTGDEFINITION_H_ #ifndef _MTGDEFINITION_H_
#define _MTGDEFINITION_H_ #define _MTGDEFINITION_H_
#define DEFAULT_MAIN_FONT_SCALE 1.0
class Constants class Constants
{ {
public: public:
+7 -7
View File
@@ -22,7 +22,7 @@ void NextGamePhase::Render(){
int nextPhase = (GameObserver::GetInstance()->getCurrentGamePhase() + 1) % Constants::MTG_PHASE_CLEANUP; int nextPhase = (GameObserver::GetInstance()->getCurrentGamePhase() + 1) % Constants::MTG_PHASE_CLEANUP;
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
int playerId = 1; int playerId = 1;
if (GameObserver::GetInstance()->currentActionPlayer == GameObserver::GetInstance()->players[1]) playerId = 2; if (GameObserver::GetInstance()->currentActionPlayer == GameObserver::GetInstance()->players[1]) playerId = 2;
@@ -43,7 +43,7 @@ int StackAbility::resolve(){
void StackAbility::Render(){ void StackAbility::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
sprintf(buffer, "%s", ability->getMenuText()); sprintf(buffer, "%s", ability->getMenuText());
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT); mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
@@ -104,7 +104,7 @@ int Spell::resolve(){
void Spell::Render(){ void Spell::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
sprintf(buffer, "%s", source->getName()); sprintf(buffer, "%s", source->getName());
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT); mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
@@ -150,7 +150,7 @@ int PutInGraveyard::resolve(){
void PutInGraveyard::Render(){ void PutInGraveyard::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
if (!removeFromGame){ if (!removeFromGame){
mFont->DrawString("goes to graveyard", x + 20 , y, JGETEXT_LEFT); mFont->DrawString("goes to graveyard", x + 20 , y, JGETEXT_LEFT);
}else{ }else{
@@ -182,7 +182,7 @@ int DrawAction::resolve(){
void DrawAction::Render(){ void DrawAction::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
int playerId = 1; int playerId = 1;
if (player == GameObserver::GetInstance()->players[1]) playerId = 2; if (player == GameObserver::GetInstance()->players[1]) playerId = 2;
@@ -642,7 +642,7 @@ void ActionStack::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
@@ -688,7 +688,7 @@ void ActionStack::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
renderer->FillRect(x0 ,y0 , width ,height , ARGB(200,0,0,0)); renderer->FillRect(x0 ,y0 , width ,height , ARGB(200,0,0,0));
+1 -1
View File
@@ -306,7 +306,7 @@ void CardGui::Render(){
mFont->SetScale(1.0); mFont->SetScale(1.0);
} }
if (card->isACreature()){ if (card->isACreature()){
mFont->SetScale(0.75); mFont->SetScale(1.0);
char buffer[200]; char buffer[200];
sprintf(buffer, "%i/%i",card->power,card->life); sprintf(buffer, "%i/%i",card->power,card->life);
renderer->FillRect(x+2,y + mHeight - 12, 25 , 12 ,ARGB(128,0,0,0)); renderer->FillRect(x+2,y + mHeight - 12, 25 , 12 ,ARGB(128,0,0,0));
+1 -1
View File
@@ -50,7 +50,7 @@ int Damage::resolve(){
void Damage::Render(){ void Damage::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0); mFont->SetBase(0);
mFont->SetScale(0.75); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
sprintf(buffer, "Does %i damage to", damage); sprintf(buffer, "Does %i damage to", damage);
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT); mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
+35 -33
View File
@@ -188,24 +188,24 @@ void GameStateDuel::Update(float dt)
break; break;
case DUEL_STATE_CHOOSE_DECK1: case DUEL_STATE_CHOOSE_DECK1:
if (mParent->players[0] == PLAYER_TYPE_HUMAN) if (mParent->players[0] == PLAYER_TYPE_HUMAN)
deckmenu->Update(dt); deckmenu->Update(dt);
#ifdef TESTSUITE #ifdef TESTSUITE
else if (mParent->players[1] == PLAYER_TYPE_TESTSUITE){ else if (mParent->players[1] == PLAYER_TYPE_TESTSUITE){
if (testSuite && testSuite->loadNext()){ if (testSuite && testSuite->loadNext()){
loadTestSuitePlayers(); loadTestSuitePlayers();
mGamePhase = DUEL_STATE_PLAY; mGamePhase = DUEL_STATE_PLAY;
testSuite->initGame(); testSuite->initGame();
char buf[4096]; char buf[4096];
sprintf(buf, "nb cards in player2's graveyard : %i\n",mPlayers[1]->game->graveyard->nb_cards); sprintf(buf, "nb cards in player2's graveyard : %i\n",mPlayers[1]->game->graveyard->nb_cards);
LOG(buf); LOG(buf);
}else{ }else{
mGamePhase = DUEL_STATE_END; mGamePhase = DUEL_STATE_END;
} }
} }
#endif #endif
else{ else{
loadPlayer(0); loadPlayer(0);
mGamePhase = DUEL_STATE_CHOOSE_DECK2; mGamePhase = DUEL_STATE_CHOOSE_DECK2;
} }
break; break;
case DUEL_STATE_CHOOSE_DECK1_TO_2: case DUEL_STATE_CHOOSE_DECK1_TO_2:
@@ -337,6 +337,7 @@ void GameStateDuel::Update(float dt)
void GameStateDuel::Render() void GameStateDuel::Render()
{ {
//Erase //Erase
LOG("Start Render\n");
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0)); JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
if (game) if (game)
@@ -345,33 +346,33 @@ void GameStateDuel::Render()
{ {
case DUEL_STATE_END: case DUEL_STATE_END:
{ {
JRenderer::GetInstance()->ClearScreen(ARGB(200,0,0,0)); JRenderer::GetInstance()->ClearScreen(ARGB(200,0,0,0));
char buffer[50]; char buffer[50];
int p0life = mPlayers[0]->life; int p0life = mPlayers[0]->life;
if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() ){ if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() ){
if (game->gameOver !=mPlayers[0]){ if (game->gameOver !=mPlayers[0]){
sprintf (buffer, "Victory! Congratulations, You earn 500 credits"); sprintf (buffer, "Victory! Congratulations, You earn 500 credits");
}else{ }else{
sprintf (buffer, "You have been defeated"); sprintf (buffer, "You have been defeated");
} }
}else{ }else{
int winner = 2; int winner = 2;
if (game->gameOver !=mPlayers[0]){ if (game->gameOver !=mPlayers[0]){
winner = 1; winner = 1;
} }
sprintf(buffer, "Player %i wins (%i)", winner, p0life ); sprintf(buffer, "Player %i wins (%i)", winner, p0life );
} }
mFont->DrawString(buffer, 10, 150); mFont->DrawString(buffer, 10, 150);
break; break;
} }
case DUEL_STATE_CHOOSE_DECK1: case DUEL_STATE_CHOOSE_DECK1:
case DUEL_STATE_CHOOSE_DECK1_TO_2: case DUEL_STATE_CHOOSE_DECK1_TO_2:
case DUEL_STATE_CHOOSE_DECK2: case DUEL_STATE_CHOOSE_DECK2:
case DUEL_STATE_CHOOSE_DECK2_TO_PLAY: case DUEL_STATE_CHOOSE_DECK2_TO_PLAY:
if (opponentMenu){ if (opponentMenu){
opponentMenu->Render(); opponentMenu->Render();
}else if (deckmenu){ }else if (deckmenu){
deckmenu->Render(); deckmenu->Render();
} }
break; break;
case DUEL_STATE_ERROR_NO_DECK: case DUEL_STATE_ERROR_NO_DECK:
@@ -383,6 +384,7 @@ void GameStateDuel::Render()
case DUEL_STATE_BACK_TO_MAIN_MENU: case DUEL_STATE_BACK_TO_MAIN_MENU:
menu->Render(); menu->Render();
} }
LOG("End Render\n");
} }
void GameStateDuel::ButtonPressed(int controllerId, int controlId) void GameStateDuel::ButtonPressed(int controllerId, int controlId)
-3
View File
@@ -152,9 +152,6 @@ void MTGCard::setMTGId(int id){
}else{ }else{
sprintf(image_name, "%d.jpg", mtgid); sprintf(image_name, "%d.jpg", mtgid);
} }
#ifdef WIN32
OutputDebugString(image_name);
#endif
} }
int MTGCard::getMTGId(){ int MTGCard::getMTGId(){
+7 -2
View File
@@ -308,10 +308,12 @@ void MTGGuiPlay::RenderPhaseBar(){
}else{ }else{
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
} }
mFont->SetScale(1.0);
mFont->DrawString(Constants::MTGPhaseNames[currentPhase], 375, 0); mFont->DrawString(Constants::MTGPhaseNames[currentPhase], 375, 0);
} }
void MTGGuiPlay::Render(){ void MTGGuiPlay::Render(){
LOG("Start MTGGuiPlay Render\n");
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
//alphaBg[1] = 255; //alphaBg[1] = 255;
@@ -367,10 +369,13 @@ void MTGGuiPlay::Render(){
if (mCount && mObjects[mCurr] != NULL){ if (mCount && mObjects[mCurr] != NULL){
mObjects[mCurr]->Render(); mObjects[mCurr]->Render();
if (hasFocus && mCurr >= offset && showBigCards){ if (hasFocus && mCurr >= offset && showBigCards && !game->currentlyActing()->isAI() ){
((CardGui *)mObjects[mCurr])->RenderBig(-1,-1,showBigCards-1); //For some reason RenderBig crashes when the testsuite is playing, so we add a "isAI()" test...which was supposed to be there at some point anyways...
CardGui * cardg = ((CardGui *)mObjects[mCurr]);
cardg->RenderBig(-1,-1,showBigCards-1);
} }
} }
LOG("End MTGGuiPlay Render\n");
} }
MTGGuiPlay::~MTGGuiPlay(){ MTGGuiPlay::~MTGGuiPlay(){
-3
View File
@@ -55,9 +55,6 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
int colors[2]; int colors[2];
int values[2]; int values[2];
if (!intvalue && value.size() > 1){ if (!intvalue && value.size() > 1){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("Hybrid Mana ???\n");
#endif
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
char c = value[i]; char c = value[i];
if (c >='0' && c <='9'){ if (c >='0' && c <='9'){
+2 -3
View File
@@ -46,8 +46,7 @@ void GuiAvatar::Render(){
JRenderer * r = JRenderer::GetInstance(); JRenderer * r = JRenderer::GetInstance();
int life = player->life; int life = player->life;
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetScale(0.75); mFont->SetScale(1.0);
//Avatar //Avatar
int lifeDiff = life - currentLife; int lifeDiff = life - currentLife;
if (lifeDiff < 0 && currentLife >0 ){ if (lifeDiff < 0 && currentLife >0 ){
@@ -112,9 +111,9 @@ void GuiGameZone::Render(){
} }
//Number of cards //Number of cards
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT); JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetScale(1.0);
char buffer[512]; char buffer[512];
sprintf(buffer,"%i", zone->nb_cards); sprintf(buffer,"%i", zone->nb_cards);
mFont->SetScale(0.75);
mFont->SetColor(ARGB(128,0,0,0)); mFont->SetColor(ARGB(128,0,0,0));
mFont->DrawString(buffer, x+2, y+2); mFont->DrawString(buffer, x+2, y+2);
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
+22 -17
View File
@@ -223,22 +223,27 @@ void TestSuite::initGame(){
for (int j = 0; j < 4; j++){ for (int j = 0; j < 4; j++){
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (int k = 0; k < initState.playerData[i].zones[j].nbitems; k++){ for (int k = 0; k < initState.playerData[i].zones[j].nbitems; k++){
MTGCardInstance * card = getCardByMTGId(initState.playerData[i].zones[j].cards[k]); MTGCardInstance * card = getCardByMTGId(initState.playerData[i].zones[j].cards[k]);
if (card && zone != p->game->library){ char buf[4096];
if (zone == p->game->inPlay){ sprintf(buf, "QUAD : %p\n", card->getQuad());
p->game->putInZone(card, p->game->library, p->game->hand); OutputDebugString(buf);
Spell * spell = NEW Spell(card); if (card && zone != p->game->library){
p->game->putInZone(card, p->game->hand, p->game->stack); if (zone == p->game->inPlay){
spell->resolve(); p->game->putInZone(card, p->game->library, p->game->hand);
card->summoningSickness = 0; Spell * spell = NEW Spell(card);
delete spell; p->game->putInZone(card, p->game->hand, p->game->stack);
}else{ spell->resolve();
if (!p->game->library->hasCard(card)){ card->summoningSickness = 0;
LOG ("ERROR, CARD NOT FOUND IN LIBRARY\n"); delete spell;
} }else{
p->game->putInZone(card,p->game->library,zone); if (!p->game->library->hasCard(card)){
} LOG ("ERROR, CARD NOT FOUND IN LIBRARY\n");
} }
p->game->putInZone(card,p->game->library,zone);
}
}else{
if (!card) LOG ("ERROR, card is NULL\n");
}
} }
} }
} }
@@ -405,7 +410,7 @@ void TestSuite::cleanup(){
} }
void TestSuite::load(const char * _filename){ void TestSuite::load(const char * _filename){
char filename[50096]; char filename[4096];
sprintf(filename, RESPATH"/test/%s", _filename); sprintf(filename, RESPATH"/test/%s", _filename);
std::ifstream file(filename); std::ifstream file(filename);
std::string s; std::string s;
+5
View File
@@ -9,6 +9,11 @@ TexturesCache::TexturesCache(){
for (int i=0; i<MAX_CACHE_OBJECTS;i++){ for (int i=0; i<MAX_CACHE_OBJECTS;i++){
cache[i] = NULL; cache[i] = NULL;
} }
#ifdef WIN32
char buf [4096];
sprintf(buf, " Init TextureCache : %p\n", this);
OutputDebugString(buf);
#endif
} }
TexturesCache::~TexturesCache(){ TexturesCache::~TexturesCache(){
+4 -4
View File
@@ -553,6 +553,10 @@
RelativePath=".\include\CardGui.h" RelativePath=".\include\CardGui.h"
> >
</File> </File>
<File
RelativePath=".\include\config.h"
>
</File>
<File <File
RelativePath=".\include\ConstraintResolver.h" RelativePath=".\include\ConstraintResolver.h"
> >
@@ -573,10 +577,6 @@
RelativePath=".\include\DamageResolverLayer.h" RelativePath=".\include\DamageResolverLayer.h"
> >
</File> </File>
<File
RelativePath=".\include\debug.h"
>
</File>
<File <File
RelativePath=".\include\DeckDataWrapper.h" RelativePath=".\include\DeckDataWrapper.h"
> >