- no more 5 decks limitation for Player
- Player decks can be given a name/description the same way we do for the AI. No PSP Gui for that yet though, has to be done outside of Wagic (PSPWrite ?)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-07-16 11:48:59 +00:00
parent 03530b7e17
commit 951065a59c
9 changed files with 102 additions and 90 deletions

View File

@@ -6,6 +6,8 @@
class JGE;
#include <JSoundSystem.h>
#include <string>
using namespace std;
enum ENUM_GAME_STATE
{
@@ -16,7 +18,10 @@ enum ENUM_GAME_STATE
GAME_STATE_OPTIONS = 0x05,
};
class GameApp;
class SimpleMenu;
class Player;
class GameState
{
@@ -38,6 +43,7 @@ class GameState
virtual void Update(float dt) = 0;
virtual void Render() = 0;
static int fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPrefix = "", Player * statsPlayer = NULL);
};

View File

@@ -184,18 +184,9 @@ class GameStateDeckViewer: public GameState, public JGuiListener
menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
welcome_menu = NEW SimpleMenu(10,this,menuFont,20,20);
char buffer[100];
for (int i=1; i < 6; i++){
sprintf(buffer, RESPATH"/player/deck%i.txt",i);
std::ifstream file(buffer);
if(file){
welcome_menu->Add(i, GameState::menuTexts[i]);
file.close();
}else{
welcome_menu->Add(i, GameState::menuTexts[0]);
}
}
welcome_menu->Add(10, "Cancel");
int nbDecks = fillDeckMenu(welcome_menu,RESPATH"/player");
welcome_menu->Add(nbDecks+1, "--NEW--");
welcome_menu->Add(-1, "Cancel");
if (GameApp::HasMusic && GameOptions::GetInstance()->values[OPTIONS_MUSICVOLUME].getIntValue() > 0){
if (GameApp::music){
@@ -680,8 +671,8 @@ class GameStateDeckViewer: public GameState, public JGuiListener
virtual void Render()
{
// void RenderQuad(JQuad* quad, float xo, float yo, float angle=0.0f, float xScale=1.0f, float yScale=1.0f);
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
JRenderer * r = JRenderer::GetInstance();
r->ClearScreen(ARGB(0,0,0,0));
if(displayed_deck == myDeck){
@@ -718,6 +709,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
if (mStage == STAGE_ONSCREEN_MENU){
renderOnScreenMenu();
}else if (mStage == STAGE_WELCOME){
r->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,ARGB(200,0,0,0));
welcome_menu->Render();
}else{
renderOnScreenBasicInfo();
@@ -755,19 +747,20 @@ class GameStateDeckViewer: public GameState, public JGuiListener
virtual void ButtonPressed(int controllerId, int controlId)
{
switch(controllerId){
case 10:
if (controlId == -1){
mParent->SetNextState(GAME_STATE_MENU);
return;
}
loadDeck(controlId);
mStage = STAGE_WAITING;
return;
}
switch (controlId)
{
case 1:
case 2:
case 3:
case 4:
case 5:
loadDeck(controlId);
mStage = STAGE_WAITING;
break;
case 10:
mParent->SetNextState(GAME_STATE_MENU);
break;
case 11:
myDeck->save();
playerdata->save();

View File

@@ -29,11 +29,11 @@ class GameStateDuel: public GameState, public JGuiListener
SimpleMenu * opponentMenu;
SimpleMenu * menu;
JLBFont* mFont, *opponentMenuFont;
int nbAIDecks;
void loadPlayer(int playerId, int decknb = 0, int isAI = 0);
void loadPlayerMomir(int playerId, int isAI);
public:
GameStateDuel(GameApp* parent);
virtual ~GameStateDuel();

View File

@@ -13,6 +13,7 @@
#include "../include/GameApp.h"
#include "../include/TexturesCache.h"
#include <string>
using std::string;
@@ -102,6 +103,7 @@ class MTGDeck{
int remove(MTGCard * card);
int save();
MTGCard * getCardById(int id);
};