- Added splash screen management
- fixed a ruling bug (putting sorcery, enchantments, etc.. into play while interrupting)
This commit is contained in:
wagic.the.homebrew
2009-03-17 11:46:39 +00:00
parent fd1c152cb3
commit 415061642d
5 changed files with 40 additions and 25 deletions

View File

@@ -17,6 +17,8 @@ class GameStateMenu: public GameState, public JGuiListener
JTexture * movingWTexture;
JQuad * mBg;
JQuad * mMovingW;
JTexture * splashTex;
JQuad * splashQuad;
float mCreditsYPos;
int currentState;
//JMusic * bgMusic;

View File

@@ -617,7 +617,7 @@ int AIPlayerBaka::computeActions(){
if (g->isInterrupting == this){ // interrupting
selectAbility();
return 1;
}else if (p == this){ //standard actions
}else if (p == this && g->mLayers->stackLayer()->count(0,NOT_RESOLVED) == 0){ //standard actions
CardDescriptor cd;
MTGCardInstance * card = NULL;
switch(currentGamePhase){
@@ -682,6 +682,7 @@ int AIPlayerBaka::computeActions(){
}
return 1;
}
return 1;
};
int AIPlayerBaka::Act(float dt){

View File

@@ -49,6 +49,8 @@ GameStateDuel::GameStateDuel(GameApp* parent): GameState(parent) {
testSuite = NULL;
#endif
showMsg = 0;
unlockedTex = NULL;
unlockedQuad = NULL;
}
GameStateDuel::~GameStateDuel() {
@@ -75,8 +77,7 @@ void GameStateDuel::Start()
opponentMenuFont = mFont;
unlocked = -1;
unlockedTex = NULL;
unlockedQuad = NULL;
menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, mFont, SCREEN_WIDTH/2-100, 25);
menu->Add(12,"Back to main menu");
@@ -365,7 +366,6 @@ void GameStateDuel::Render()
JRenderer * r = JRenderer::GetInstance();
r->ClearScreen(ARGB(200,0,0,0));
char buffer[50];
int unlocked = 0;
int p0life = mPlayers[0]->life;
if (!mPlayers[0]->isAI() && mPlayers[1]->isAI() ){
if (game->gameOver != mPlayers[0]){

View File

@@ -5,7 +5,7 @@
#include "../include/GameOptions.h"
#include "../include/GameApp.h"
static const char* GAME_VERSION = "WTH?! 0.4.1 - by WilLoW";
static const char* GAME_VERSION = "WTH?! 0.5.0 - by WilLoW";
#define ALPHA_WARNING 0
#define DEFAULT_ANGLE_MULTIPLIER 0.4
@@ -61,6 +61,8 @@ GameStateMenu::GameStateMenu(GameApp* parent): GameState(parent)
angleMultiplier = MIN_ANGLE_MULTIPLIER;
yW = 55;
mVolume = 0;
splashTex = NULL;
splashQuad = NULL;
}
GameStateMenu::~GameStateMenu() {}
@@ -76,6 +78,10 @@ void GameStateMenu::Create()
movingWTexture = JRenderer::GetInstance()->LoadTexture("graphics/movingW.png", TEX_TYPE_USE_VRAM);
mBg = NEW JQuad(bgTexture, 0, 0, 256, 166); // Create background quad for rendering.
mMovingW = NEW JQuad(movingWTexture, 2, 2, 84, 62);
if (fileExists("graphics/splash.jpg")){
splashTex = JRenderer::GetInstance()->LoadTexture("graphics/splash.jpg", TEX_TYPE_USE_VRAM);
splashQuad = NEW JQuad(splashTex, 0, 0, 480, 272);
}
mBg->SetHotSpot(105,50);
mMovingW->SetHotSpot(72,16);
//load all the icon images
@@ -198,21 +204,23 @@ void GameStateMenu::Update(float dt)
{
case MENU_STATE_MAJOR_LOADING_CARDS :
if (mReadConf){
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
}else{
mReadConf = 1;
mReadConf = 1;
}
if (!nextCardSet()){
//How many cards total ?
sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards());
//Check for first time comer
std::ifstream file(RESPATH"/player/collection.dat");
if(file){
file.close();
currentState = MENU_STATE_MAJOR_WARNING | MENU_STATE_MINOR_NONE;
}else{
currentState = MENU_STATE_MAJOR_FIRST_TIME | MENU_STATE_MINOR_NONE;
}
//How many cards total ?
sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards());
//Check for first time comer
std::ifstream file(RESPATH"/player/collection.dat");
if(file){
file.close();
currentState = MENU_STATE_MAJOR_WARNING | MENU_STATE_MINOR_NONE;
}else{
currentState = MENU_STATE_MAJOR_FIRST_TIME | MENU_STATE_MINOR_NONE;
}
SAFE_DELETE(splashQuad);
SAFE_DELETE(splashTex);
}
break;
case MENU_STATE_MAJOR_FIRST_TIME :
@@ -347,17 +355,21 @@ void GameStateMenu::Render()
renderer->ClearScreen(ARGB(0,0,0,0));
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT);
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
char text[512];
sprintf(text, "LOADING SET: %s", mCurrentSetName);
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
if (splashQuad){
renderer->RenderQuad(splashQuad,0,0);
}else{
char text[512];
sprintf(text, "LOADING SET: %s", mCurrentSetName);
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
}
}else{
mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
PIXEL_TYPE colors[] =
{
ARGB(255, 3, 2, 0),
ARGB(255, 8, 3, 0),
ARGB(255,21,12, 0),
ARGB(255,50,34, 0)
ARGB(255, 3, 2, 0),
ARGB(255, 8, 3, 0),
ARGB(255,21,12, 0),
ARGB(255,50,34, 0)
};
renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);

View File

@@ -17,7 +17,7 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
LOG("CANPUTINPLAY- Land, ok\n");
return 1;
}
}else if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))){
}else if ((card->hasType("instant")) || card->has(Constants::FLASH) || (player == currentPlayer && !game->isInterrupting && (game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN || game->currentGamePhase == Constants::MTG_PHASE_SECONDMAIN))){
LOG("CANPUTINPLAY- correct time to play\n");
ManaCost * playerMana = player->getManaPool();
ManaCost * cost = card->getManaCost();