- 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

View File

@@ -1,4 +1,4 @@
########################
/*########################
#Generic engine features
########################
generic/first_strike.txt
@@ -17,7 +17,9 @@ animate_dead.txt
animate_dead2.txt
ascendant_evincar.txt
ascendant_evincar2.txt
*/
brass_man.txt
/*
castle.txt
circle_of_protection.txt
control_magic.txt
@@ -57,4 +59,5 @@ terror.txt
volcanic_island.txt
white_knight1.txt
wrath_of_god.txt
zombie_master.txt
zombie_master.txt
*/

View File

@@ -7,43 +7,8 @@ inplay:1099,1387,1388
life:20
[DO]
1099
next
#blockers
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
eot
eot
#untap 1
next
#upkeep 1

View File

@@ -2,7 +2,6 @@
#define _LOGGER_H_
#ifdef DOLOG
#define LOG(x) Logger::Log(x);
#else

View File

@@ -1,6 +1,8 @@
#ifndef _MTGDEFINITION_H_
#define _MTGDEFINITION_H_
#define DEFAULT_MAIN_FONT_SCALE 1.0
class Constants
{
public:

View File

@@ -22,7 +22,7 @@ void NextGamePhase::Render(){
int nextPhase = (GameObserver::GetInstance()->getCurrentGamePhase() + 1) % Constants::MTG_PHASE_CLEANUP;
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
int playerId = 1;
if (GameObserver::GetInstance()->currentActionPlayer == GameObserver::GetInstance()->players[1]) playerId = 2;
@@ -43,7 +43,7 @@ int StackAbility::resolve(){
void StackAbility::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, "%s", ability->getMenuText());
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
@@ -104,7 +104,7 @@ int Spell::resolve(){
void Spell::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, "%s", source->getName());
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
@@ -150,7 +150,7 @@ int PutInGraveyard::resolve(){
void PutInGraveyard::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
if (!removeFromGame){
mFont->DrawString("goes to graveyard", x + 20 , y, JGETEXT_LEFT);
}else{
@@ -182,7 +182,7 @@ int DrawAction::resolve(){
void DrawAction::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
int playerId = 1;
if (player == GameObserver::GetInstance()->players[1]) playerId = 2;
@@ -642,7 +642,7 @@ void ActionStack::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
JRenderer * renderer = JRenderer::GetInstance();
@@ -688,7 +688,7 @@ void ActionStack::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
JRenderer * renderer = JRenderer::GetInstance();
renderer->FillRect(x0 ,y0 , width ,height , ARGB(200,0,0,0));

View File

@@ -306,7 +306,7 @@ void CardGui::Render(){
mFont->SetScale(1.0);
}
if (card->isACreature()){
mFont->SetScale(0.75);
mFont->SetScale(1.0);
char buffer[200];
sprintf(buffer, "%i/%i",card->power,card->life);
renderer->FillRect(x+2,y + mHeight - 12, 25 , 12 ,ARGB(128,0,0,0));

View File

@@ -50,7 +50,7 @@ int Damage::resolve(){
void Damage::Render(){
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetBase(0);
mFont->SetScale(0.75);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, "Does %i damage to", damage);
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);

View File

@@ -188,24 +188,24 @@ void GameStateDuel::Update(float dt)
break;
case DUEL_STATE_CHOOSE_DECK1:
if (mParent->players[0] == PLAYER_TYPE_HUMAN)
deckmenu->Update(dt);
deckmenu->Update(dt);
#ifdef TESTSUITE
else if (mParent->players[1] == PLAYER_TYPE_TESTSUITE){
if (testSuite && testSuite->loadNext()){
loadTestSuitePlayers();
mGamePhase = DUEL_STATE_PLAY;
testSuite->initGame();
char buf[4096];
sprintf(buf, "nb cards in player2's graveyard : %i\n",mPlayers[1]->game->graveyard->nb_cards);
LOG(buf);
}else{
mGamePhase = DUEL_STATE_END;
}
if (testSuite && testSuite->loadNext()){
loadTestSuitePlayers();
mGamePhase = DUEL_STATE_PLAY;
testSuite->initGame();
char buf[4096];
sprintf(buf, "nb cards in player2's graveyard : %i\n",mPlayers[1]->game->graveyard->nb_cards);
LOG(buf);
}else{
mGamePhase = DUEL_STATE_END;
}
}
#endif
else{
loadPlayer(0);
mGamePhase = DUEL_STATE_CHOOSE_DECK2;
loadPlayer(0);
mGamePhase = DUEL_STATE_CHOOSE_DECK2;
}
break;
case DUEL_STATE_CHOOSE_DECK1_TO_2:
@@ -337,6 +337,7 @@ void GameStateDuel::Update(float dt)
void GameStateDuel::Render()
{
//Erase
LOG("Start Render\n");
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
if (game)
@@ -345,33 +346,33 @@ void GameStateDuel::Render()
{
case DUEL_STATE_END:
{
JRenderer::GetInstance()->ClearScreen(ARGB(200,0,0,0));
char buffer[50];
int p0life = mPlayers[0]->life;
if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() ){
if (game->gameOver !=mPlayers[0]){
sprintf (buffer, "Victory! Congratulations, You earn 500 credits");
}else{
sprintf (buffer, "You have been defeated");
}
}else{
int winner = 2;
if (game->gameOver !=mPlayers[0]){
winner = 1;
}
sprintf(buffer, "Player %i wins (%i)", winner, p0life );
}
mFont->DrawString(buffer, 10, 150);
break;
JRenderer::GetInstance()->ClearScreen(ARGB(200,0,0,0));
char buffer[50];
int p0life = mPlayers[0]->life;
if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() ){
if (game->gameOver !=mPlayers[0]){
sprintf (buffer, "Victory! Congratulations, You earn 500 credits");
}else{
sprintf (buffer, "You have been defeated");
}
}else{
int winner = 2;
if (game->gameOver !=mPlayers[0]){
winner = 1;
}
sprintf(buffer, "Player %i wins (%i)", winner, p0life );
}
mFont->DrawString(buffer, 10, 150);
break;
}
case DUEL_STATE_CHOOSE_DECK1:
case DUEL_STATE_CHOOSE_DECK1_TO_2:
case DUEL_STATE_CHOOSE_DECK2:
case DUEL_STATE_CHOOSE_DECK2_TO_PLAY:
if (opponentMenu){
opponentMenu->Render();
opponentMenu->Render();
}else if (deckmenu){
deckmenu->Render();
deckmenu->Render();
}
break;
case DUEL_STATE_ERROR_NO_DECK:
@@ -383,6 +384,7 @@ void GameStateDuel::Render()
case DUEL_STATE_BACK_TO_MAIN_MENU:
menu->Render();
}
LOG("End Render\n");
}
void GameStateDuel::ButtonPressed(int controllerId, int controlId)

View File

@@ -152,9 +152,6 @@ void MTGCard::setMTGId(int id){
}else{
sprintf(image_name, "%d.jpg", mtgid);
}
#ifdef WIN32
OutputDebugString(image_name);
#endif
}
int MTGCard::getMTGId(){

View File

@@ -308,10 +308,12 @@ void MTGGuiPlay::RenderPhaseBar(){
}else{
mFont->SetColor(ARGB(255,255,255,255));
}
mFont->SetScale(1.0);
mFont->DrawString(Constants::MTGPhaseNames[currentPhase], 375, 0);
}
void MTGGuiPlay::Render(){
LOG("Start MTGGuiPlay Render\n");
JRenderer * renderer = JRenderer::GetInstance();
//alphaBg[1] = 255;
@@ -367,10 +369,13 @@ void MTGGuiPlay::Render(){
if (mCount && mObjects[mCurr] != NULL){
mObjects[mCurr]->Render();
if (hasFocus && mCurr >= offset && showBigCards){
((CardGui *)mObjects[mCurr])->RenderBig(-1,-1,showBigCards-1);
if (hasFocus && mCurr >= offset && showBigCards && !game->currentlyActing()->isAI() ){
//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(){

View File

@@ -55,9 +55,6 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){
int colors[2];
int values[2];
if (!intvalue && value.size() > 1){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("Hybrid Mana ???\n");
#endif
for (int i = 0; i < 2; i++){
char c = value[i];
if (c >='0' && c <='9'){

View File

@@ -46,8 +46,7 @@ void GuiAvatar::Render(){
JRenderer * r = JRenderer::GetInstance();
int life = player->life;
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetScale(0.75);
mFont->SetScale(1.0);
//Avatar
int lifeDiff = life - currentLife;
if (lifeDiff < 0 && currentLife >0 ){
@@ -112,9 +111,9 @@ void GuiGameZone::Render(){
}
//Number of cards
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
mFont->SetScale(1.0);
char buffer[512];
sprintf(buffer,"%i", zone->nb_cards);
mFont->SetScale(0.75);
mFont->SetColor(ARGB(128,0,0,0));
mFont->DrawString(buffer, x+2, y+2);
mFont->SetColor(ARGB(255,255,255,255));

View File

@@ -223,22 +223,27 @@ void TestSuite::initGame(){
for (int j = 0; j < 4; j++){
MTGGameZone * zone = playerZones[j];
for (int k = 0; k < initState.playerData[i].zones[j].nbitems; k++){
MTGCardInstance * card = getCardByMTGId(initState.playerData[i].zones[j].cards[k]);
if (card && zone != p->game->library){
if (zone == p->game->inPlay){
p->game->putInZone(card, p->game->library, p->game->hand);
Spell * spell = NEW Spell(card);
p->game->putInZone(card, p->game->hand, p->game->stack);
spell->resolve();
card->summoningSickness = 0;
delete spell;
}else{
if (!p->game->library->hasCard(card)){
LOG ("ERROR, CARD NOT FOUND IN LIBRARY\n");
}
p->game->putInZone(card,p->game->library,zone);
}
}
MTGCardInstance * card = getCardByMTGId(initState.playerData[i].zones[j].cards[k]);
char buf[4096];
sprintf(buf, "QUAD : %p\n", card->getQuad());
OutputDebugString(buf);
if (card && zone != p->game->library){
if (zone == p->game->inPlay){
p->game->putInZone(card, p->game->library, p->game->hand);
Spell * spell = NEW Spell(card);
p->game->putInZone(card, p->game->hand, p->game->stack);
spell->resolve();
card->summoningSickness = 0;
delete spell;
}else{
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){
char filename[50096];
char filename[4096];
sprintf(filename, RESPATH"/test/%s", _filename);
std::ifstream file(filename);
std::string s;

View File

@@ -9,6 +9,11 @@ TexturesCache::TexturesCache(){
for (int i=0; i<MAX_CACHE_OBJECTS;i++){
cache[i] = NULL;
}
#ifdef WIN32
char buf [4096];
sprintf(buf, " Init TextureCache : %p\n", this);
OutputDebugString(buf);
#endif
}
TexturesCache::~TexturesCache(){

View File

@@ -553,6 +553,10 @@
RelativePath=".\include\CardGui.h"
>
</File>
<File
RelativePath=".\include\config.h"
>
</File>
<File
RelativePath=".\include\ConstraintResolver.h"
>
@@ -573,10 +577,6 @@
RelativePath=".\include\DamageResolverLayer.h"
>
</File>
<File
RelativePath=".\include\debug.h"
>
</File>
<File
RelativePath=".\include\DeckDataWrapper.h"
>