- Adding (dead) code for Story mode. This is FAR from being ready so it's deactivated in the code. I just don't want to create a branch (I'm lazy) and I'm fed up with synching. My Goal is to have a tutorial ready with this for the release after this one. If you want to test it (Note: the sample story is not interesting at ALL), just look for "Story mode" and uncomment (3 occurrences). PSP Or Linux need additions to the Makefile...
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-02-16 10:55:03 +00:00
parent 8a19b0567b
commit d5be045859
16 changed files with 618 additions and 4 deletions

View File

@@ -40,6 +40,7 @@
#define GAME_TYPE_MOMIR 1
#define GAME_TYPE_RANDOM1 2
#define GAME_TYPE_RANDOM2 3
#define GAME_TYPE_STORY 4
class MTGAllCards;
class TransitionBase;

View File

@@ -18,8 +18,9 @@ enum ENUM_GAME_STATE
GAME_STATE_SHOP = 4,
GAME_STATE_OPTIONS = 5,
GAME_STATE_AWARDS = 6,
GAME_STATE_TRANSITION = 7,
GAME_STATE_MAX = 8,
GAME_STATE_STORY = 7,
GAME_STATE_TRANSITION = 8,
GAME_STATE_MAX = 9,
};
enum ENUM_GS_TRANSITION

View File

@@ -0,0 +1,29 @@
#ifndef _GAME_STATE_STORY_H_
#define _GAME_STATE_STORY_H_
#include "../include/GameState.h"
#include <JGui.h>
class StoryFlow;
class SimpleMenu;
class GameStateStory: public GameState, public JGuiListener {
private:
StoryFlow * flow;
SimpleMenu * menu;
vector<string> stories;
void loadStoriesMenu(const char * root);
public:
GameStateStory(GameApp* parent);
~GameStateStory();
void Start();
void End();
void Update(float dt);
void Render();
void ButtonPressed(int controllerId, int controlId);
};
#endif

View File

@@ -45,6 +45,7 @@ class Player: public Damageable{
class HumanPlayer: public Player{
public:
HumanPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall);
HumanPlayer(string deckFile);
};

View File

@@ -0,0 +1,86 @@
#ifndef _STORYFLOW_H_
#define _STORYFLOW_H_
#include <string>
#include <map>
#include <vector>
using namespace std;
#include "../../../JGE/src/TinyXML/tinyxml.h"
#include <JGui.h>
class GameObserver;
#define CAMPAIGNS_FOLDER "Res/campaigns/"
class StoryChoice:public JGuiObject {
public:
string pageId;
string text;
int mX;
int mY;
bool mHasFocus;
float mScale;
float mTargetScale;
StoryChoice(string id, string text, int JGOid, float mX, float mY, bool hasFocus);
void Render();
void Update(float dt);
void Entering();
bool Leaving(u32 key);
bool ButtonPressed();
bool hasFocus();
virtual ostream& toString(ostream& out) const;
};
class StoryFlow;
class StoryPage {
public:
StoryFlow * mParent;
StoryPage(StoryFlow * mParent);
virtual void Update(float dt)=0;
virtual void Render()=0;
virtual ~StoryPage(){};
};
class StoryDialog:public StoryPage, public JGuiListener,public JGuiController {
private:
string text;
public:
StoryDialog(TiXmlElement* el,StoryFlow * mParent);
void Update(float dt);
void Render();
void ButtonPressed(int,int);
};
class Rules;
class StoryDuel:public StoryPage {
public:
string pageId;
string onWin, onLose;
GameObserver * game;
Rules * rules;
StoryDuel(TiXmlElement* el,StoryFlow * mParent);
virtual ~StoryDuel();
void Update(float dt);
void Render();
void init();
};
class StoryFlow{
private:
map<string,StoryPage *>pages;
bool parse(string filename);
StoryPage * loadPage(TiXmlElement* element);
public:
string currentPageId;
string folder;
StoryFlow(string folder);
~StoryFlow();
bool gotoPage(string id);
void Update(float dt);
void Render();
};
#endif