Erwan
- Added splash screen management - fixed a ruling bug (putting sorcery, enchantments, etc.. into play while interrupting)
This commit is contained in:
@@ -17,6 +17,8 @@ class GameStateMenu: public GameState, public JGuiListener
|
|||||||
JTexture * movingWTexture;
|
JTexture * movingWTexture;
|
||||||
JQuad * mBg;
|
JQuad * mBg;
|
||||||
JQuad * mMovingW;
|
JQuad * mMovingW;
|
||||||
|
JTexture * splashTex;
|
||||||
|
JQuad * splashQuad;
|
||||||
float mCreditsYPos;
|
float mCreditsYPos;
|
||||||
int currentState;
|
int currentState;
|
||||||
//JMusic * bgMusic;
|
//JMusic * bgMusic;
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ int AIPlayerBaka::computeActions(){
|
|||||||
if (g->isInterrupting == this){ // interrupting
|
if (g->isInterrupting == this){ // interrupting
|
||||||
selectAbility();
|
selectAbility();
|
||||||
return 1;
|
return 1;
|
||||||
}else if (p == this){ //standard actions
|
}else if (p == this && g->mLayers->stackLayer()->count(0,NOT_RESOLVED) == 0){ //standard actions
|
||||||
CardDescriptor cd;
|
CardDescriptor cd;
|
||||||
MTGCardInstance * card = NULL;
|
MTGCardInstance * card = NULL;
|
||||||
switch(currentGamePhase){
|
switch(currentGamePhase){
|
||||||
@@ -682,6 +682,7 @@ int AIPlayerBaka::computeActions(){
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
int AIPlayerBaka::Act(float dt){
|
int AIPlayerBaka::Act(float dt){
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ GameStateDuel::GameStateDuel(GameApp* parent): GameState(parent) {
|
|||||||
testSuite = NULL;
|
testSuite = NULL;
|
||||||
#endif
|
#endif
|
||||||
showMsg = 0;
|
showMsg = 0;
|
||||||
|
unlockedTex = NULL;
|
||||||
|
unlockedQuad = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStateDuel::~GameStateDuel() {
|
GameStateDuel::~GameStateDuel() {
|
||||||
@@ -75,8 +77,7 @@ void GameStateDuel::Start()
|
|||||||
opponentMenuFont = mFont;
|
opponentMenuFont = mFont;
|
||||||
|
|
||||||
unlocked = -1;
|
unlocked = -1;
|
||||||
unlockedTex = NULL;
|
|
||||||
unlockedQuad = NULL;
|
|
||||||
|
|
||||||
menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, mFont, SCREEN_WIDTH/2-100, 25);
|
menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, mFont, SCREEN_WIDTH/2-100, 25);
|
||||||
menu->Add(12,"Back to main menu");
|
menu->Add(12,"Back to main menu");
|
||||||
@@ -365,7 +366,6 @@ void GameStateDuel::Render()
|
|||||||
JRenderer * r = JRenderer::GetInstance();
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
r->ClearScreen(ARGB(200,0,0,0));
|
r->ClearScreen(ARGB(200,0,0,0));
|
||||||
char buffer[50];
|
char buffer[50];
|
||||||
int unlocked = 0;
|
|
||||||
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]){
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "../include/GameOptions.h"
|
#include "../include/GameOptions.h"
|
||||||
#include "../include/GameApp.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 ALPHA_WARNING 0
|
||||||
|
|
||||||
#define DEFAULT_ANGLE_MULTIPLIER 0.4
|
#define DEFAULT_ANGLE_MULTIPLIER 0.4
|
||||||
@@ -61,6 +61,8 @@ GameStateMenu::GameStateMenu(GameApp* parent): GameState(parent)
|
|||||||
angleMultiplier = MIN_ANGLE_MULTIPLIER;
|
angleMultiplier = MIN_ANGLE_MULTIPLIER;
|
||||||
yW = 55;
|
yW = 55;
|
||||||
mVolume = 0;
|
mVolume = 0;
|
||||||
|
splashTex = NULL;
|
||||||
|
splashQuad = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStateMenu::~GameStateMenu() {}
|
GameStateMenu::~GameStateMenu() {}
|
||||||
@@ -76,6 +78,10 @@ void GameStateMenu::Create()
|
|||||||
movingWTexture = JRenderer::GetInstance()->LoadTexture("graphics/movingW.png", TEX_TYPE_USE_VRAM);
|
movingWTexture = JRenderer::GetInstance()->LoadTexture("graphics/movingW.png", TEX_TYPE_USE_VRAM);
|
||||||
mBg = NEW JQuad(bgTexture, 0, 0, 256, 166); // Create background quad for rendering.
|
mBg = NEW JQuad(bgTexture, 0, 0, 256, 166); // Create background quad for rendering.
|
||||||
mMovingW = NEW JQuad(movingWTexture, 2, 2, 84, 62);
|
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);
|
mBg->SetHotSpot(105,50);
|
||||||
mMovingW->SetHotSpot(72,16);
|
mMovingW->SetHotSpot(72,16);
|
||||||
//load all the icon images
|
//load all the icon images
|
||||||
@@ -198,21 +204,23 @@ void GameStateMenu::Update(float dt)
|
|||||||
{
|
{
|
||||||
case MENU_STATE_MAJOR_LOADING_CARDS :
|
case MENU_STATE_MAJOR_LOADING_CARDS :
|
||||||
if (mReadConf){
|
if (mReadConf){
|
||||||
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
|
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
|
||||||
}else{
|
}else{
|
||||||
mReadConf = 1;
|
mReadConf = 1;
|
||||||
}
|
}
|
||||||
if (!nextCardSet()){
|
if (!nextCardSet()){
|
||||||
//How many cards total ?
|
//How many cards total ?
|
||||||
sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards());
|
sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards());
|
||||||
//Check for first time comer
|
//Check for first time comer
|
||||||
std::ifstream file(RESPATH"/player/collection.dat");
|
std::ifstream file(RESPATH"/player/collection.dat");
|
||||||
if(file){
|
if(file){
|
||||||
file.close();
|
file.close();
|
||||||
currentState = MENU_STATE_MAJOR_WARNING | MENU_STATE_MINOR_NONE;
|
currentState = MENU_STATE_MAJOR_WARNING | MENU_STATE_MINOR_NONE;
|
||||||
}else{
|
}else{
|
||||||
currentState = MENU_STATE_MAJOR_FIRST_TIME | MENU_STATE_MINOR_NONE;
|
currentState = MENU_STATE_MAJOR_FIRST_TIME | MENU_STATE_MINOR_NONE;
|
||||||
}
|
}
|
||||||
|
SAFE_DELETE(splashQuad);
|
||||||
|
SAFE_DELETE(splashTex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_MAJOR_FIRST_TIME :
|
case MENU_STATE_MAJOR_FIRST_TIME :
|
||||||
@@ -347,17 +355,21 @@ void GameStateMenu::Render()
|
|||||||
renderer->ClearScreen(ARGB(0,0,0,0));
|
renderer->ClearScreen(ARGB(0,0,0,0));
|
||||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT);
|
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT);
|
||||||
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
|
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
|
||||||
char text[512];
|
if (splashQuad){
|
||||||
sprintf(text, "LOADING SET: %s", mCurrentSetName);
|
renderer->RenderQuad(splashQuad,0,0);
|
||||||
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
|
}else{
|
||||||
|
char text[512];
|
||||||
|
sprintf(text, "LOADING SET: %s", mCurrentSetName);
|
||||||
|
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||||
PIXEL_TYPE colors[] =
|
PIXEL_TYPE colors[] =
|
||||||
{
|
{
|
||||||
ARGB(255, 3, 2, 0),
|
ARGB(255, 3, 2, 0),
|
||||||
ARGB(255, 8, 3, 0),
|
ARGB(255, 8, 3, 0),
|
||||||
ARGB(255,21,12, 0),
|
ARGB(255,21,12, 0),
|
||||||
ARGB(255,50,34, 0)
|
ARGB(255,50,34, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);
|
renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
|||||||
LOG("CANPUTINPLAY- Land, ok\n");
|
LOG("CANPUTINPLAY- Land, ok\n");
|
||||||
return 1;
|
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");
|
LOG("CANPUTINPLAY- correct time to play\n");
|
||||||
ManaCost * playerMana = player->getManaPool();
|
ManaCost * playerMana = player->getManaPool();
|
||||||
ManaCost * cost = card->getManaCost();
|
ManaCost * cost = card->getManaCost();
|
||||||
|
|||||||
Reference in New Issue
Block a user