* Change the name of debug.h into config.h and use the new RESPATH define.
This commit is contained in:
jean.chalard
2008-12-25 16:28:03 +00:00
parent 161da1d3cb
commit 3e9ff2b580
61 changed files with 191 additions and 178 deletions
+4 -4
View File
@@ -63,7 +63,7 @@ else
$(TARGET): $(OBJS) $(TARGET): $(OBJS) ../../JGE/lib/linux/libjge.a
g++ -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR) g++ -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR)
linux: $(TARGET) linux: $(TARGET)
@@ -71,17 +71,17 @@ linux: $(TARGET)
debug: linux debug: linux
clean: clean:
rm -f $(OBJS) $(RM) $(OBJS)
$(OBJS): objs/%.o: src/%.cpp $(OBJS): objs/%.o: src/%.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
$(DEPS): deps/%.d: src/%.cpp $(DEPS): deps/%.d: src/%.cpp
@set -e; rm -f $@; \ @set -e; $(RM) $@; \
$(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \ $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,objs/\1.o $@ : ,g' < $@.$$$$ > $@; \ sed 's,\($*\)\.o[ :]*,objs/\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$ $(RM) $@.$$$$
include $(DEPS) include $(DEPS)
+1 -1
View File
@@ -12,7 +12,7 @@ ASFLAGS = $(CXXFLAGS)
LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lglut -lhgetools -lfmod-3.75 LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lglut -lhgetools -lfmod-3.75
# -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lpspfpu # -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lpspfpu
LDFLAGS = $(LIBDIR) $(LIBS) LDFLAGS = $(LIBDIR) $(LIBS) -rdynamic
all: $(OBJS) all: $(OBJS)
$(CXX) -o bin/mtg $(OBJS) $(LDFLAGS) $(CXX) -o bin/mtg $(OBJS) $(LDFLAGS)
+1 -1
View File
@@ -6,7 +6,7 @@
#define OPTIONS_MUSICVOLUME 0 #define OPTIONS_MUSICVOLUME 0
#define OPTIONS_SFXVOLUME 1 #define OPTIONS_SFXVOLUME 1
#define OPTIONS_INTERRUPTATENDOFPHASE_OFFSET 2 #define OPTIONS_INTERRUPTATENDOFPHASE_OFFSET 2
#define OPTIONS_SAVEFILE "Res/settings/options.txt" #define OPTIONS_SAVEFILE RESPATH"/settings/options.txt"
class GameOptions { class GameOptions {
public: public:
int values[MAX_OPTIONS]; int values[MAX_OPTIONS];
+5 -5
View File
@@ -141,10 +141,10 @@ class GameStateDeckViewer: public GameState, public JGuiListener
virtual void Start() virtual void Start()
{ {
hudAlpha = 0; hudAlpha = 0;
pricelist = NEW PriceList("Res/settings/prices.dat",mParent->collection); pricelist = NEW PriceList(RESPATH"/settings/prices.dat",mParent->collection);
playerdata = NEW PlayerData(mParent->collection); playerdata = NEW PlayerData(mParent->collection);
sellMenu = NULL; sellMenu = NULL;
myCollection = NEW DeckDataWrapper(NEW MTGDeck("Res/player/collection.dat", mParent->cache,mParent->collection)); myCollection = NEW DeckDataWrapper(NEW MTGDeck(RESPATH"/player/collection.dat", mParent->cache,mParent->collection));
displayed_deck = myCollection; displayed_deck = myCollection;
myDeck = NULL; myDeck = NULL;
menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3"); menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
@@ -188,7 +188,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
welcome_menu = NEW SimpleMenu(10,this,menuFont,20,20,200); welcome_menu = NEW SimpleMenu(10,this,menuFont,20,20,200);
char buffer[100]; char buffer[100];
for (int i=1; i < 6; i++){ for (int i=1; i < 6; i++){
sprintf(buffer, "Res/player/deck%i.txt",i); sprintf(buffer, RESPATH"/player/deck%i.txt",i);
std::ifstream file(buffer); std::ifstream file(buffer);
if(file){ if(file){
welcome_menu->Add(i, GameState::menuTexts[i]); welcome_menu->Add(i, GameState::menuTexts[i]);
@@ -733,10 +733,10 @@ class GameStateDeckViewer: public GameState, public JGuiListener
int loadDeck(int deckid){ int loadDeck(int deckid){
SAFE_DELETE(myCollection); SAFE_DELETE(myCollection);
myCollection = NEW DeckDataWrapper(NEW MTGDeck("Res/player/collection.dat", mParent->cache,mParent->collection)); myCollection = NEW DeckDataWrapper(NEW MTGDeck(RESPATH"/player/collection.dat", mParent->cache,mParent->collection));
displayed_deck = myCollection; displayed_deck = myCollection;
char filename[4096]; char filename[4096];
sprintf(filename, "Res/player/deck%i.txt", deckid); sprintf(filename, RESPATH"/player/deck%i.txt", deckid);
SAFE_DELETE(myDeck); SAFE_DELETE(myDeck);
myDeck = NEW DeckDataWrapper(NEW MTGDeck(filename, mParent->cache,mParent->collection)); myDeck = NEW DeckDataWrapper(NEW MTGDeck(filename, mParent->cache,mParent->collection));
MTGCard * current = myDeck->getNext(); MTGCard * current = myDeck->getNext();
+4 -4
View File
@@ -181,11 +181,11 @@ subMenuController = NULL;
int nextCardSet(){ int nextCardSet(){
int found = 0; int found = 0;
if (!mDip){ if (!mDip){
mDip = opendir("Res/sets/"); mDip = opendir(RESPATH"/sets/");
} }
while (!found && (mDit = readdir(mDip))){ while (!found && (mDit = readdir(mDip))){
sprintf(mCurrentSetFileName, "Res/sets/%s/_cards.dat", mDit->d_name); sprintf(mCurrentSetFileName, RESPATH"/sets/%s/_cards.dat", mDit->d_name);
std::ifstream file(mCurrentSetFileName); std::ifstream file(mCurrentSetFileName);
if(file){ if(file){
sprintf(mCurrentSetName, "%s", mDit->d_name); sprintf(mCurrentSetName, "%s", mDit->d_name);
@@ -234,7 +234,7 @@ subMenuController = NULL;
//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("Res/player/collection.dat"); std::ifstream file(RESPATH"/player/collection.dat");
if(file){ if(file){
file.close(); file.close();
currentState = STATE_WARNING; currentState = STATE_WARNING;
@@ -315,7 +315,7 @@ subMenuController = NULL;
sprintf(buf, "setID: %i", setId); sprintf(buf, "setID: %i", setId);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
MTGDeck *mCollection = NEW MTGDeck("Res/player/collection.dat", mParent->cache, mParent->collection); MTGDeck *mCollection = NEW MTGDeck(RESPATH"/player/collection.dat", mParent->cache, mParent->collection);
//10 lands of each //10 lands of each
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Forest")){ if (!mCollection->addRandomCards(10, setId,RARITY_L,"Forest")){
mCollection->addRandomCards(10, -1,RARITY_L,"Forest"); mCollection->addRandomCards(10, -1,RARITY_L,"Forest");
+2 -2
View File
@@ -16,11 +16,11 @@ class Player;
class GuiLayer: public JGuiController{ class GuiLayer: public JGuiController{
protected: protected:
int modal;
GameObserver * game; GameObserver * game;
public: public:
int modal;
bool hasFocus;
virtual void resetObjects(); virtual void resetObjects();
int hasFocus;
int getMaxId(); int getMaxId();
void RenderMessageBackground(float x0, float y0, float width, int height); void RenderMessageBackground(float x0, float y0, float width, int height);
void RenderMessageBackground(float y0, int height); void RenderMessageBackground(float y0, int height);
+1 -1
View File
@@ -9,7 +9,7 @@
#define LOG(x) #define LOG(x)
#endif #endif
#define LOG_FILE "Res/debug.txt" #define LOG_FILE RESPATH"/debug.txt"
class Logger{ class Logger{
public: public:
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _PLAYER_DATA_H_ #ifndef _PLAYER_DATA_H_
#define _PLAYER_DATA_H_ #define _PLAYER_DATA_H_
#define PLAYER_SAVEFILE "Res/player/data.dat" #define PLAYER_SAVEFILE RESPATH"/player/data.dat"
#include "../include/MTGDeck.h" #include "../include/MTGDeck.h"
@@ -21,4 +21,8 @@
#endif #endif
#endif #endif
#ifndef RESPATH
#define RESPATH "Res"
#endif
#endif #endif
+7 -1
View File
@@ -10,7 +10,7 @@
#include <pspdisplay.h> #include <pspdisplay.h>
#include <pspctrl.h> #include <pspctrl.h>
#include <pspiofilemgr.h> #include <pspiofilemgr.h>
#include <pspdebug.h> #include <pspconfig.h>
#include <psputility.h> #include <psputility.h>
#include <pspgu.h> #include <pspgu.h>
#include <psprtc.h> #include <psprtc.h>
@@ -35,4 +35,10 @@ int lowercase(string source);
int filesize(const char * filename); int filesize(const char * filename);
int readfile_to_ints(const char * filename, int * out_buffer); int readfile_to_ints(const char * filename, int * out_buffer);
int fileExists(const char * filename); int fileExists(const char * filename);
#ifdef LINUX
void dumpStack();
#endif #endif
#endif
+5 -4
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/AIPlayer.h" #include "../include/AIPlayer.h"
#include "../include/CardDescriptor.h" #include "../include/CardDescriptor.h"
#include "../include/DamageResolverLayer.h" #include "../include/DamageResolverLayer.h"
@@ -230,6 +230,7 @@ int AIPlayer::chooseAttackers(){
int myForce = getCreaturesInfo(this,INFO_CREATURESPOWER,-1,1); int myForce = getCreaturesInfo(this,INFO_CREATURESPOWER,-1,1);
int myCreatures = getCreaturesInfo(this, INFO_NBCREATURES, -1,1); int myCreatures = getCreaturesInfo(this, INFO_NBCREATURES, -1,1);
bool attack = ((myCreatures > opponentCreatures) || (myForce > opponentForce) || (myForce > 2*opponent()->life)); bool attack = ((myCreatures > opponentCreatures) || (myForce > opponentForce) || (myForce > 2*opponent()->life));
printf("Choose attackers : %i %i %i %i -> %i\n", opponentForce, opponentCreatures, myForce, myCreatures, attack);
if (attack){ if (attack){
CardDescriptor cd; CardDescriptor cd;
cd.init(); cd.init();
@@ -365,7 +366,7 @@ int AIPlayer::combatDamages(){
AIStats * AIPlayer::getStats(){ AIStats * AIPlayer::getStats(){
if (!stats){ if (!stats){
char statFile[512]; char statFile[512];
sprintf(statFile, "Res/ai/baka/stats/%s.stats", opponent()->deckFile.c_str()); sprintf(statFile, RESPATH"/ai/baka/stats/%s.stats", opponent()->deckFile.c_str());
stats = new AIStats(this, statFile); stats = new AIStats(this, statFile);
} }
return stats; return stats;
@@ -378,7 +379,7 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, MTGPlayerCa
while (found){ while (found){
found = 0; found = 0;
char buffer[512]; char buffer[512];
sprintf(buffer, "Res/ai/baka/deck%i.txt",nbdecks+1); sprintf(buffer, RESPATH"/ai/baka/deck%i.txt",nbdecks+1);
std::ifstream file(buffer); std::ifstream file(buffer);
if(file){ if(file){
found = 1; found = 1;
@@ -390,7 +391,7 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, MTGPlayerCa
deckid = 1 + rand() % (nbdecks); deckid = 1 + rand() % (nbdecks);
} }
char deckFile[512]; char deckFile[512];
sprintf(deckFile, "Res/ai/baka/deck%i.txt",deckid); sprintf(deckFile, RESPATH"/ai/baka/deck%i.txt",deckid);
char avatarFile[512]; char avatarFile[512];
sprintf(avatarFile, "ai/baka/avatars/avatar%i.jpg",deckid); sprintf(avatarFile, "ai/baka/avatars/avatar%i.jpg",deckid);
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/AIStats.h" #include "../include/AIStats.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/Player.h" #include "../include/Player.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/ActionLayer.h" #include "../include/ActionLayer.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/Targetable.h" #include "../include/Targetable.h"
+1 -1
View File
@@ -1,7 +1,7 @@
/* /*
The Action Stack contains all information for Game Events that can be interrupted (Interruptible) The Action Stack contains all information for Game Events that can be interrupted (Interruptible)
*/ */
#include "../include/debug.h" #include "../include/config.h"
#include "../include/ActionStack.h" #include "../include/ActionStack.h"
#include "../include/MTGAbility.h" #include "../include/MTGAbility.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/Blocker.h" #include "../include/Blocker.h"
Blocker::Blocker(int id, MTGCardInstance * card):MTGAbility(id, card){ Blocker::Blocker(int id, MTGCardInstance * card):MTGAbility(id, card){
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/CardDescriptor.h" #include "../include/CardDescriptor.h"
CardDescriptor::CardDescriptor(): MTGCardInstance(){ CardDescriptor::CardDescriptor(): MTGCardInstance(){
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/CardDisplay.h" #include "../include/CardDisplay.h"
#include "../include/CardGui.h" #include "../include/CardGui.h"
#include "../include/TargetChooser.h" #include "../include/TargetChooser.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/CardGui.h" #include "../include/CardGui.h"
#include <Vector2D.h> #include <Vector2D.h>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/ConstraintResolver.h" #include "../include/ConstraintResolver.h"
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../include/Counters.h" #include "../include/Counters.h"
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
Counter::Counter(MTGCardInstance * _target, int _power, int _toughness){ Counter::Counter(MTGCardInstance * _target, int _power, int _toughness){
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/Damage.h" #include "../include/Damage.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
#include "../include/Counters.h" #include "../include/Counters.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/DamageResolverLayer.h" #include "../include/DamageResolverLayer.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/DamagerDamaged.h" #include "../include/DamagerDamaged.h"
+3 -4
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/DeckStats.h" #include "../include/DeckStats.h"
#include "../include/Player.h" #include "../include/Player.h"
@@ -37,7 +37,7 @@ int DeckStats::percentVictories(string opponentsFile){
void DeckStats::load(Player * player){ void DeckStats::load(Player * player){
char filename[512]; char filename[512];
sprintf(filename, "Res/player/stats/%s.txt",player->deckFile.c_str()); sprintf(filename, RESPATH"/player/stats/%s.txt",player->deckFile.c_str());
load(filename); load(filename);
} }
@@ -61,7 +61,7 @@ void DeckStats::load(const char * filename){
void DeckStats::save(Player * player){ void DeckStats::save(Player * player){
char filename[512]; char filename[512];
sprintf(filename, "Res/player/stats/%s.txt",player->deckFile.c_str()); sprintf(filename, RESPATH"/player/stats/%s.txt",player->deckFile.c_str());
save(filename); save(filename);
} }
@@ -99,5 +99,4 @@ void DeckStats::saveStats(Player *player, Player *opponent, GameObserver * game)
it->second->nbgames+=1; it->second->nbgames+=1;
} }
save(player); save(player);
} }
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/DuelLayers.h" #include "../include/DuelLayers.h"
#include "../include/MTGRules.h" #include "../include/MTGRules.h"
#include "../include/DamageResolverLayer.h" #include "../include/DamageResolverLayer.h"
+3 -3
View File
@@ -1,5 +1,5 @@
#include "../include/debug.h" #include "../include/config.h"
#include <JGE.h> #include <JGE.h>
#include <JRenderer.h> #include <JRenderer.h>
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
@@ -62,13 +62,13 @@ void GameApp::Create()
LOG("starting Game"); LOG("starting Game");
//Test for Music files presence //Test for Music files presence
std::ifstream file("Res/sound/Track0.mp3"); std::ifstream file(RESPATH"/sound/Track0.mp3");
if(file){ if(file){
file.close(); file.close();
}else{ }else{
HasMusic = 0; HasMusic = 0;
} }
std::ifstream file2("Res/sound/Track1.mp3"); std::ifstream file2(RESPATH"/sound/Track1.mp3");
if(file2){ if(file2){
file2.close(); file2.close();
}else{ }else{
+1 -1
View File
@@ -7,7 +7,7 @@
// Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com> // Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com>
// //
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#include "../include/debug.h" #include "../include/config.h"
#include <string.h> #include <string.h>
#include <JGameLauncher.h> #include <JGameLauncher.h>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/GameOptions.h" #include "../include/GameOptions.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/GameOptions.h" #include "../include/GameOptions.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
+5 -5
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/GameStateDuel.h" #include "../include/GameStateDuel.h"
#include "../include/utils.h" #include "../include/utils.h"
#include "../include/AIPlayer.h" #include "../include/AIPlayer.h"
@@ -39,7 +39,7 @@ void GameStateDuel::Start()
#ifdef TESTSUITE #ifdef TESTSUITE
if (testSuite) delete testSuite; if (testSuite) delete testSuite;
testSuite = NEW TestSuite("Res/test/_tests.txt"); testSuite = NEW TestSuite(RESPATH"/test/_tests.txt");
#endif #endif
@@ -64,7 +64,7 @@ void GameStateDuel::Start()
deckmenu = NEW SimpleMenu(1,this,mFont, 10 , 10, 100, "Choose a Deck"); deckmenu = NEW SimpleMenu(1,this,mFont, 10 , 10, 100, "Choose a Deck");
char buffer[100]; char buffer[100];
for (int j=1; j<6; j++){ for (int j=1; j<6; j++){
sprintf(buffer, "Res/player/deck%i.txt",j); sprintf(buffer, RESPATH"/player/deck%i.txt",j);
std::ifstream file(buffer); std::ifstream file(buffer);
if(file){ if(file){
deckmenu->Add(j, GameState::menuTexts[j]); deckmenu->Add(j, GameState::menuTexts[j]);
@@ -88,7 +88,7 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, int isAI){
if (decknb){ if (decknb){
if (!isAI){ //Human Player if (!isAI){ //Human Player
char deckFile[255]; char deckFile[255];
sprintf(deckFile, "Res/player/deck%i.txt",decknb); sprintf(deckFile, RESPATH"/player/deck%i.txt",decknb);
char deckFileSmall[255]; char deckFileSmall[255];
sprintf(deckFileSmall, "player_deck%i",decknb); sprintf(deckFileSmall, "player_deck%i",decknb);
int deck_cards_ids[100]; int deck_cards_ids[100];
@@ -205,7 +205,7 @@ void GameStateDuel::Update(float dt)
char buffer[512]; char buffer[512];
char aiSmallDeckName[512]; char aiSmallDeckName[512];
char deckDesc[512]; char deckDesc[512];
sprintf(buffer, "Res/ai/baka/deck%i.txt",nbAIDecks+1); sprintf(buffer, RESPATH"/ai/baka/deck%i.txt",nbAIDecks+1);
if(fileExists(buffer)){ if(fileExists(buffer)){
found = 1; found = 1;
nbAIDecks++; nbAIDecks++;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/GameStateOptions.h" #include "../include/GameStateOptions.h"
#include "../include/GameApp.h" #include "../include/GameApp.h"
#include "../include/OptionItem.h" #include "../include/OptionItem.h"
+1 -1
View File
@@ -1,7 +1,7 @@
/* /*
The shop is where the player can buy cards, decks... The shop is where the player can buy cards, decks...
*/ */
#include "../include/debug.h" #include "../include/config.h"
#include <JRenderer.h> #include <JRenderer.h>
#include "../include/GameStateShop.h" #include "../include/GameStateShop.h"
#include "../include/GameApp.h" #include "../include/GameApp.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/GuiCardsController.h" #include "../include/GuiCardsController.h"
+9 -8
View File
@@ -1,11 +1,11 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/GuiLayers.h" #include "../include/GuiLayers.h"
#include "../include/Player.h" #include "../include/Player.h"
GuiLayer::GuiLayer(int id, GameObserver* _game):JGuiController(id, NULL){ GuiLayer::GuiLayer(int id, GameObserver* _game):JGuiController(id, NULL){
game = _game; game = _game;
modal = 0; modal = 0;
hasFocus = 0; hasFocus = false;
} }
GuiLayer::~GuiLayer(){ GuiLayer::~GuiLayer(){
@@ -121,21 +121,22 @@ void GuiLayers::Update(float dt, Player * currentPlayer){
for (i=0; i<nbitems; i++){ for (i=0; i<nbitems; i++){
if (!isAI){ if (!isAI){
if (0 != key) if (0 != key)
{
objects[i]->hasFocus = 1;
if (objects[i]->CheckUserInput(key)) if (objects[i]->CheckUserInput(key))
break; break;
} }
} }
} }
} if (isAI)
for (++i; i<nbitems; ++i) objects[i]->hasFocus = 0;
if (isAI){
currentPlayer->Act(dt); currentPlayer->Act(dt);
}
} }
void GuiLayers::Render(){ void GuiLayers::Render(){
bool focusMakesItThrough = true;
for (int i = 0; i < nbitems; ++i)
{
objects[i]->hasFocus = focusMakesItThrough;
if (objects[i]->modal) focusMakesItThrough = false;
}
for (int i=nbitems-1; i>=0; i--){ for (int i=nbitems-1; i>=0; i--){
objects[i]->Render(); objects[i]->Render();
} }
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/Logger.h" #include "../include/Logger.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGAbility.h" #include "../include/MTGAbility.h"
#include "../include/ManaCost.h" #include "../include/ManaCost.h"
#include "../include/MTGGameZones.h" #include "../include/MTGGameZones.h"
+1 -1
View File
@@ -3,7 +3,7 @@
//------------------------------------------------- //-------------------------------------------------
//TODO Fill BasicAbilities //TODO Fill BasicAbilities
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGCard.h" #include "../include/MTGCard.h"
#include "../include/TexturesCache.h" #include "../include/TexturesCache.h"
+2 -1
View File
@@ -4,7 +4,7 @@
Although there is only one MTGCard of each type, there can be as much Instances of it as needed in the game Although there is only one MTGCard of each type, there can be as much Instances of it as needed in the game
-------------------------------------------- --------------------------------------------
*/ */
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
#include "../include/CardDescriptor.h" #include "../include/CardDescriptor.h"
#include "../include/Counters.h" #include "../include/Counters.h"
@@ -19,6 +19,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to):
LOG("==Creating MTGCardInstance=="); LOG("==Creating MTGCardInstance==");
initMTGCI(); initMTGCI();
model = card; model = card;
attacker = 0;
lifeOrig = life; lifeOrig = life;
belongs_to=_belongs_to; belongs_to=_belongs_to;
initAttackersDefensers(); initAttackersDefensers();
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGDeck.h" #include "../include/MTGDeck.h"
#include "../include/utils.h" #include "../include/utils.h"
#include <algorithm> #include <algorithm>
+2 -2
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGGamePhase.h" #include "../include/MTGGamePhase.h"
@@ -32,7 +32,7 @@ void MTGGamePhase::Update(float dt){
if (animation > 0){ if (animation > 0){
fprintf(stderr, "animation = %f", animation); // fprintf(stderr, "animation = %f", animation);
animation -= dt *5 ; animation -= dt *5 ;
}else{ }else{
activeState = INACTIVE; activeState = INACTIVE;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGGameZones.h" #include "../include/MTGGameZones.h"
#include "../include/Player.h" #include "../include/Player.h"
#include "../include/GameOptions.h" #include "../include/GameOptions.h"
+3 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGGuiHand.h" #include "../include/MTGGuiHand.h"
#include "../include/CardGui.h" #include "../include/CardGui.h"
@@ -52,6 +52,7 @@ void MTGGuiHand::Update(float dt){
if (mAnimState < 0){ if (mAnimState < 0){
mAnimState = 0; mAnimState = 0;
mShowHand = HAND_HIDE; mShowHand = HAND_HIDE;
modal = false;
} }
} }
@@ -65,6 +66,7 @@ bool MTGGuiHand::CheckUserInput(u32 key){
if (PSP_CTRL_LTRIGGER == key) { if (PSP_CTRL_LTRIGGER == key) {
if (mShowHand == HAND_HIDE){ if (mShowHand == HAND_HIDE){
mShowHand = HAND_SHOW_ANIMATION; mShowHand = HAND_SHOW_ANIMATION;
modal = true;
} }
if (mShowHand == HAND_SHOW){ if (mShowHand == HAND_SHOW){
mShowHand = HAND_HIDE_ANIMATION; mShowHand = HAND_HIDE_ANIMATION;
+1 -1
View File
@@ -2,7 +2,7 @@
cards in play, graveyard, library, games phases, Players avatars cards in play, graveyard, library, games phases, Players avatars
*/ */
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGGuiPlay.h" #include "../include/MTGGuiPlay.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
#include "../include/CardGui.h" #include "../include/CardGui.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MTGRules.h" #include "../include/MTGRules.h"
MTGAttackRule::MTGAttackRule(int _id):MTGAbility(_id,NULL){ MTGAttackRule::MTGAttackRule(int _id):MTGAbility(_id,NULL){
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/Logger.h" #include "../include/Logger.h"
#include "../include/ManaCost.h" #include "../include/ManaCost.h"
#include "../include/ManaCostHybrid.h" #include "../include/ManaCostHybrid.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/MenuItem.h" #include "../include/MenuItem.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#include "../include/PhaseRing.h" #include "../include/PhaseRing.h"
#include "../include/MTGDefinitions.h" #include "../include/MTGDefinitions.h"
#include "../include/Player.h" #include "../include/Player.h"
#include "../include/debug.h" #include "../include/config.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/PlayGuiObject.h" #include "../include/PlayGuiObject.h"
#include "../include/Player.h" #include "../include/Player.h"
@@ -20,7 +20,7 @@ void PlayGuiObject::Update(float dt){
if (mHasFocus && mHeight < defaultHeight * 1.2) if (mHasFocus && mHeight < defaultHeight * 1.2)
{ {
mHeight += defaultHeight*0.8f*dt; mHeight += defaultHeight*0.8f*dt;
fprintf(stderr, "increasing size to %f - %d", mHeight, GetId() ); // fprintf(stderr, "increasing size to %f - %d", mHeight, GetId() );
if (mHeight > defaultHeight * 1.2) if (mHeight > defaultHeight * 1.2)
mHeight = defaultHeight * 1.2; mHeight = defaultHeight * 1.2;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/PlayGuiObjectController.h" #include "../include/PlayGuiObjectController.h"
#include "../include/PlayGuiObject.h" #include "../include/PlayGuiObject.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/Player.h" #include "../include/Player.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/DeckStats.h" #include "../include/DeckStats.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/PlayerData.h" #include "../include/PlayerData.h"
#include <string.h> #include <string.h>
@@ -19,7 +19,7 @@ PlayerData::PlayerData(MTGAllCards * allcards){
} }
//COLLECTION //COLLECTION
collection = NEW MTGDeck("Res/player/collection.dat", allcards->mCache , allcards); collection = NEW MTGDeck(RESPATH"/player/collection.dat", allcards->mCache , allcards);
} }
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/PriceList.h" #include "../include/PriceList.h"
+2 -2
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/ShopItem.h" #include "../include/ShopItem.h"
#include "../include/CardGui.h" #include "../include/CardGui.h"
@@ -131,7 +131,7 @@ ShopItems::ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y
mHeight = 0; mHeight = 0;
showPriceDialog = -1; showPriceDialog = -1;
dialog = NULL; dialog = NULL;
pricelist = NEW PriceList("Res/settings/prices.dat",_collection); pricelist = NEW PriceList(RESPATH"/settings/prices.dat",_collection);
playerdata = NEW PlayerData(_collection); playerdata = NEW PlayerData(_collection);
display = NULL; display = NULL;
} }
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/SimpleMenu.h" #include "../include/SimpleMenu.h"
#include "../include/SimpleMenuItem.h" #include "../include/SimpleMenuItem.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/SimpleMenuItem.h" #include "../include/SimpleMenuItem.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/Subtypes.h" #include "../include/Subtypes.h"
#include <JGE.h> #include <JGE.h>
#include <algorithm> #include <algorithm>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/TargetChooser.h" #include "../include/TargetChooser.h"
#include "../include/CardDescriptor.h" #include "../include/CardDescriptor.h"
#include "../include/MTGGameZones.h" #include "../include/MTGGameZones.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/TargetsList.h" #include "../include/TargetsList.h"
#include "../include/Player.h" #include "../include/Player.h"
#include "../include/MTGCardInstance.h" #include "../include/MTGCardInstance.h"
+4 -4
View File
@@ -1,5 +1,5 @@
#include "../include/TestSuiteAI.h" #include "../include/TestSuiteAI.h"
#include "../include/debug.h" #include "../include/config.h"
#include <string> #include <string>
using std::string; using std::string;
@@ -247,7 +247,7 @@ void TestSuite::initGame(){
} }
int TestSuite::Log(const char * text){ int TestSuite::Log(const char * text){
ofstream file ("Res/test/results.html",ios_base::app); ofstream file (RESPATH"/test/results.html",ios_base::app);
if (file){ if (file){
file << text; file << text;
file << "\n"; file << "\n";
@@ -334,7 +334,7 @@ TestSuite::TestSuite(const char * filename){
file.close(); file.close();
} }
ofstream file2 ("Res/test/results.html"); ofstream file2 (RESPATH"/test/results.html");
if (file2){ if (file2){
file2 << "<html><head>"; file2 << "<html><head>";
file2 << "<meta http-equiv=\"refresh\" content=\"10\" >"; file2 << "<meta http-equiv=\"refresh\" content=\"10\" >";
@@ -405,7 +405,7 @@ void TestSuite::cleanup(){
void TestSuite::load(const char * _filename){ void TestSuite::load(const char * _filename){
char filename[4096]; char filename[4096];
sprintf(filename, "Res/test/%s", _filename); sprintf(filename, RESPATH"/test/%s", _filename);
std::ifstream file(filename); std::ifstream file(filename);
std::string s; std::string s;
+3 -4
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/TexturesCache.h" #include "../include/TexturesCache.h"
TexturesCache::TexturesCache(){ TexturesCache::TexturesCache(){
@@ -27,8 +27,7 @@ int TexturesCache::isInCache(MTGCard * card, int type){
} }
int TexturesCache::getCacheById(int id, int type){ int TexturesCache::getCacheById(int id, int type){
int i; for (int i=0; i<nb_textures;i++){
for (i=0; i<nb_textures;i++){
if (cache[i]->type == type && cache[i]->getId() == id){ if (cache[i]->type == type && cache[i]->getId() == id){
return i; return i;
} }
@@ -68,7 +67,7 @@ int TexturesCache::cleanup(){
JQuad * TexturesCache::getQuad(MTGCard * card, int type){ JQuad * TexturesCache::getQuad(MTGCard * card, int type){
int cache_id = getCacheById(card->getId(), type); int cache_id = getCacheById(card->getId(), type);
if (cache_id == -1){ if (cache_id == -1){
fprintf(stderr, "not found %d\n", card->getId()); fprintf(stderr, "not found %d %i\n", card->getId(), type);
//Not found in the cache, we have to load the file and put it in the cache //Not found in the cache, we have to load the file and put it in the cache
if (cleanup()){ if (cleanup()){
cache_id = nb_textures; cache_id = nb_textures;
+2 -2
View File
@@ -1,4 +1,4 @@
#include "../include/debug.h" #include "../include/config.h"
#include "../include/utils.h" #include "../include/utils.h"
@@ -63,7 +63,7 @@ if(fichier){
} }
char alternateFilename[512]; char alternateFilename[512];
sprintf(alternateFilename, "Res/%s",filename); sprintf(alternateFilename, RESPATH"/%s",filename);
std::ifstream fichier2(alternateFilename); std::ifstream fichier2(alternateFilename);
if(fichier2){ if(fichier2){
fichier2.close(); fichier2.close();