J :
* Change the name of debug.h into config.h and use the new RESPATH define.
This commit is contained in:
@@ -63,7 +63,7 @@ else
|
||||
|
||||
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(TARGET): $(OBJS) ../../JGE/lib/linux/libjge.a
|
||||
g++ -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR)
|
||||
|
||||
linux: $(TARGET)
|
||||
@@ -71,17 +71,17 @@ linux: $(TARGET)
|
||||
debug: linux
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
$(RM) $(OBJS)
|
||||
|
||||
|
||||
$(OBJS): objs/%.o: src/%.cpp
|
||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
||||
|
||||
$(DEPS): deps/%.d: src/%.cpp
|
||||
@set -e; rm -f $@; \
|
||||
@set -e; $(RM) $@; \
|
||||
$(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
|
||||
sed 's,\($*\)\.o[ :]*,objs/\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||
rm -f $@.$$$$
|
||||
$(RM) $@.$$$$
|
||||
|
||||
include $(DEPS)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ ASFLAGS = $(CXXFLAGS)
|
||||
LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lglut -lhgetools -lfmod-3.75
|
||||
# -lmikmod -lpsppower -lpspmpeg -lpspaudiocodec -lpspaudiolib -lpspaudio -lpspgum -lpspgu -lpsprtc -lpspfpu
|
||||
|
||||
LDFLAGS = $(LIBDIR) $(LIBS)
|
||||
LDFLAGS = $(LIBDIR) $(LIBS) -rdynamic
|
||||
|
||||
all: $(OBJS)
|
||||
$(CXX) -o bin/mtg $(OBJS) $(LDFLAGS)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define OPTIONS_MUSICVOLUME 0
|
||||
#define OPTIONS_SFXVOLUME 1
|
||||
#define OPTIONS_INTERRUPTATENDOFPHASE_OFFSET 2
|
||||
#define OPTIONS_SAVEFILE "Res/settings/options.txt"
|
||||
#define OPTIONS_SAVEFILE RESPATH"/settings/options.txt"
|
||||
class GameOptions {
|
||||
public:
|
||||
int values[MAX_OPTIONS];
|
||||
|
||||
@@ -141,10 +141,10 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
virtual void Start()
|
||||
{
|
||||
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);
|
||||
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;
|
||||
myDeck = NULL;
|
||||
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);
|
||||
char buffer[100];
|
||||
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);
|
||||
if(file){
|
||||
welcome_menu->Add(i, GameState::menuTexts[i]);
|
||||
@@ -733,10 +733,10 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
|
||||
int loadDeck(int deckid){
|
||||
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;
|
||||
char filename[4096];
|
||||
sprintf(filename, "Res/player/deck%i.txt", deckid);
|
||||
sprintf(filename, RESPATH"/player/deck%i.txt", deckid);
|
||||
SAFE_DELETE(myDeck);
|
||||
myDeck = NEW DeckDataWrapper(NEW MTGDeck(filename, mParent->cache,mParent->collection));
|
||||
MTGCard * current = myDeck->getNext();
|
||||
|
||||
@@ -134,7 +134,7 @@ class GameStateMenu: public GameState, public JGuiListener
|
||||
|
||||
virtual void Destroy()
|
||||
{
|
||||
|
||||
|
||||
|
||||
SAFE_DELETE(mGuiController);
|
||||
|
||||
@@ -170,7 +170,7 @@ subMenuController = NULL;
|
||||
if (GameApp::HasMusic && GameApp::music && GameOptions::GetInstance()->values[OPTIONS_MUSICVOLUME] == 0){
|
||||
JSoundSystem::GetInstance()->StopMusic(GameApp::music);
|
||||
SAFE_DELETE(GameApp::music);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -181,11 +181,11 @@ subMenuController = NULL;
|
||||
int nextCardSet(){
|
||||
int found = 0;
|
||||
if (!mDip){
|
||||
mDip = opendir("Res/sets/");
|
||||
mDip = opendir(RESPATH"/sets/");
|
||||
}
|
||||
|
||||
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);
|
||||
if(file){
|
||||
sprintf(mCurrentSetName, "%s", mDit->d_name);
|
||||
@@ -216,7 +216,7 @@ subMenuController = NULL;
|
||||
virtual void Update(float dt)
|
||||
{
|
||||
|
||||
if (GameApp::music){
|
||||
if (GameApp::music){
|
||||
/*if (mVolume < 2*GameOptions::GetInstance()->values[OPTIONS_MUSICVOLUME]){
|
||||
mVolume++;
|
||||
JSoundSystem::GetInstance()->SetVolume(mVolume/2);
|
||||
@@ -234,7 +234,7 @@ subMenuController = NULL;
|
||||
//How many cards total ?
|
||||
sprintf(nbcardsStr, "Database: %i cards", mParent->collection->totalCards());
|
||||
//Check for first time comer
|
||||
std::ifstream file("Res/player/collection.dat");
|
||||
std::ifstream file(RESPATH"/player/collection.dat");
|
||||
if(file){
|
||||
file.close();
|
||||
currentState = STATE_WARNING;
|
||||
@@ -281,7 +281,7 @@ subMenuController = NULL;
|
||||
#ifdef TESTSUITE
|
||||
subMenuController->Add(666, "Test Suite");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ subMenuController = NULL;
|
||||
sprintf(buf, "setID: %i", setId);
|
||||
OutputDebugString(buf);
|
||||
#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
|
||||
if (!mCollection->addRandomCards(10, setId,RARITY_L,"Forest")){
|
||||
mCollection->addRandomCards(10, -1,RARITY_L,"Forest");
|
||||
|
||||
@@ -16,11 +16,11 @@ class Player;
|
||||
|
||||
class GuiLayer: public JGuiController{
|
||||
protected:
|
||||
int modal;
|
||||
GameObserver * game;
|
||||
public:
|
||||
int modal;
|
||||
bool hasFocus;
|
||||
virtual void resetObjects();
|
||||
int hasFocus;
|
||||
int getMaxId();
|
||||
void RenderMessageBackground(float x0, float y0, float width, int height);
|
||||
void RenderMessageBackground(float y0, int height);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define LOG(x)
|
||||
#endif
|
||||
|
||||
#define LOG_FILE "Res/debug.txt"
|
||||
#define LOG_FILE RESPATH"/debug.txt"
|
||||
|
||||
class Logger{
|
||||
public:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _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"
|
||||
|
||||
|
||||
@@ -21,4 +21,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RESPATH
|
||||
#define RESPATH "Res"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <pspdisplay.h>
|
||||
#include <pspctrl.h>
|
||||
#include <pspiofilemgr.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspconfig.h>
|
||||
#include <psputility.h>
|
||||
#include <pspgu.h>
|
||||
#include <psprtc.h>
|
||||
@@ -35,4 +35,10 @@ int lowercase(string source);
|
||||
int filesize(const char * filename);
|
||||
int readfile_to_ints(const char * filename, int * out_buffer);
|
||||
int fileExists(const char * filename);
|
||||
|
||||
#ifdef LINUX
|
||||
void dumpStack();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/AIPlayer.h"
|
||||
#include "../include/CardDescriptor.h"
|
||||
#include "../include/DamageResolverLayer.h"
|
||||
@@ -230,6 +230,7 @@ int AIPlayer::chooseAttackers(){
|
||||
int myForce = getCreaturesInfo(this,INFO_CREATURESPOWER,-1,1);
|
||||
int myCreatures = getCreaturesInfo(this, INFO_NBCREATURES, -1,1);
|
||||
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){
|
||||
CardDescriptor cd;
|
||||
cd.init();
|
||||
@@ -365,7 +366,7 @@ int AIPlayer::combatDamages(){
|
||||
AIStats * AIPlayer::getStats(){
|
||||
if (!stats){
|
||||
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);
|
||||
}
|
||||
return stats;
|
||||
@@ -378,7 +379,7 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, MTGPlayerCa
|
||||
while (found){
|
||||
found = 0;
|
||||
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);
|
||||
if(file){
|
||||
found = 1;
|
||||
@@ -390,10 +391,10 @@ AIPlayer * AIPlayerFactory::createAIPlayer(MTGAllCards * collection, MTGPlayerCa
|
||||
deckid = 1 + rand() % (nbdecks);
|
||||
}
|
||||
char deckFile[512];
|
||||
sprintf(deckFile, "Res/ai/baka/deck%i.txt",deckid);
|
||||
sprintf(deckFile, RESPATH"/ai/baka/deck%i.txt",deckid);
|
||||
char avatarFile[512];
|
||||
sprintf(avatarFile, "ai/baka/avatars/avatar%i.jpg",deckid);
|
||||
|
||||
|
||||
char deckFileSmall[512];
|
||||
sprintf(deckFileSmall, "ai_baka_deck%i",deckid);
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/AIStats.h"
|
||||
#include "../include/GameObserver.h"
|
||||
#include "../include/Player.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/ActionLayer.h"
|
||||
#include "../include/GameObserver.h"
|
||||
#include "../include/Targetable.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
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/MTGAbility.h"
|
||||
#include "../include/GameObserver.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/Blocker.h"
|
||||
|
||||
Blocker::Blocker(int id, MTGCardInstance * card):MTGAbility(id, card){
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/CardDescriptor.h"
|
||||
|
||||
CardDescriptor::CardDescriptor(): MTGCardInstance(){
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/CardDisplay.h"
|
||||
#include "../include/CardGui.h"
|
||||
#include "../include/TargetChooser.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/CardGui.h"
|
||||
#include <Vector2D.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/ConstraintResolver.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../include/Counters.h"
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
|
||||
Counter::Counter(MTGCardInstance * _target, int _power, int _toughness){
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/Damage.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
#include "../include/Counters.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/DamageResolverLayer.h"
|
||||
#include "../include/GameObserver.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/DamagerDamaged.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/DeckStats.h"
|
||||
#include "../include/Player.h"
|
||||
|
||||
DeckStats * DeckStats::mInstance = NULL;
|
||||
|
||||
int DeckStat::percentVictories(){
|
||||
if (nbgames == 0) return 50;
|
||||
return (100 * victories / nbgames);
|
||||
}
|
||||
|
||||
DeckStats * DeckStats::GetInstance(){
|
||||
if (!mInstance) mInstance = NEW DeckStats();
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void DeckStats::cleanStats(){
|
||||
#include "../include/config.h"
|
||||
#include "../include/DeckStats.h"
|
||||
#include "../include/Player.h"
|
||||
|
||||
DeckStats * DeckStats::mInstance = NULL;
|
||||
|
||||
int DeckStat::percentVictories(){
|
||||
if (nbgames == 0) return 50;
|
||||
return (100 * victories / nbgames);
|
||||
}
|
||||
|
||||
DeckStats * DeckStats::GetInstance(){
|
||||
if (!mInstance) mInstance = NEW DeckStats();
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void DeckStats::cleanStats(){
|
||||
map<string,DeckStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++){
|
||||
SAFE_DELETE(it->second);
|
||||
}
|
||||
stats.clear();
|
||||
}
|
||||
|
||||
DeckStats::~DeckStats(){
|
||||
cleanStats();
|
||||
}
|
||||
|
||||
int DeckStats::percentVictories(string opponentsFile){
|
||||
map<string,DeckStat *>::iterator it = stats.find(opponentsFile);
|
||||
if (it == stats.end()){
|
||||
return 50;
|
||||
}else{
|
||||
return (it->second->percentVictories());
|
||||
}
|
||||
}
|
||||
|
||||
void DeckStats::load(Player * player){
|
||||
char filename[512];
|
||||
sprintf(filename, "Res/player/stats/%s.txt",player->deckFile.c_str());
|
||||
load(filename);
|
||||
}
|
||||
|
||||
void DeckStats::load(const char * filename){
|
||||
cleanStats();
|
||||
stats.clear();
|
||||
}
|
||||
|
||||
DeckStats::~DeckStats(){
|
||||
cleanStats();
|
||||
}
|
||||
|
||||
int DeckStats::percentVictories(string opponentsFile){
|
||||
map<string,DeckStat *>::iterator it = stats.find(opponentsFile);
|
||||
if (it == stats.end()){
|
||||
return 50;
|
||||
}else{
|
||||
return (it->second->percentVictories());
|
||||
}
|
||||
}
|
||||
|
||||
void DeckStats::load(Player * player){
|
||||
char filename[512];
|
||||
sprintf(filename, RESPATH"/player/stats/%s.txt",player->deckFile.c_str());
|
||||
load(filename);
|
||||
}
|
||||
|
||||
void DeckStats::load(const char * filename){
|
||||
cleanStats();
|
||||
std::ifstream file(filename);
|
||||
std::string s;
|
||||
|
||||
@@ -55,17 +55,17 @@ void DeckStats::load(const char * filename){
|
||||
int victories = atoi(s.c_str());
|
||||
stats[deckfile] = NEW DeckStat(games,victories);
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void DeckStats::save(Player * player){
|
||||
char filename[512];
|
||||
sprintf(filename, "Res/player/stats/%s.txt",player->deckFile.c_str());
|
||||
save(filename);
|
||||
}
|
||||
|
||||
void DeckStats::save(const char * filename){
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void DeckStats::save(Player * player){
|
||||
char filename[512];
|
||||
sprintf(filename, RESPATH"/player/stats/%s.txt",player->deckFile.c_str());
|
||||
save(filename);
|
||||
}
|
||||
|
||||
void DeckStats::save(const char * filename){
|
||||
std::ofstream file(filename);
|
||||
char writer[512];
|
||||
if (file){
|
||||
@@ -79,25 +79,24 @@ void DeckStats::save(const char * filename){
|
||||
file<<writer;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void DeckStats::saveStats(Player *player, Player *opponent, GameObserver * game){
|
||||
int victory = 1;
|
||||
if (!game->gameOver){
|
||||
if (player->life == opponent->life) return;
|
||||
if (player->life < opponent->life) victory = 0;
|
||||
}else if (game->gameOver == player) {
|
||||
victory = 0;
|
||||
}
|
||||
load(player);
|
||||
map<string,DeckStat *>::iterator it = stats.find(opponent->deckFile);
|
||||
if (it == stats.end()){
|
||||
stats[opponent->deckFile] = NEW DeckStat(1,victory);
|
||||
}else{
|
||||
it->second->victories+=victory;
|
||||
it->second->nbgames+=1;
|
||||
}
|
||||
save(player);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeckStats::saveStats(Player *player, Player *opponent, GameObserver * game){
|
||||
int victory = 1;
|
||||
if (!game->gameOver){
|
||||
if (player->life == opponent->life) return;
|
||||
if (player->life < opponent->life) victory = 0;
|
||||
}else if (game->gameOver == player) {
|
||||
victory = 0;
|
||||
}
|
||||
load(player);
|
||||
map<string,DeckStat *>::iterator it = stats.find(opponent->deckFile);
|
||||
if (it == stats.end()){
|
||||
stats[opponent->deckFile] = NEW DeckStat(1,victory);
|
||||
}else{
|
||||
it->second->victories+=victory;
|
||||
it->second->nbgames+=1;
|
||||
}
|
||||
save(player);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/DuelLayers.h"
|
||||
#include "../include/MTGRules.h"
|
||||
#include "../include/DamageResolverLayer.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include <JGE.h>
|
||||
#include <JRenderer.h>
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
@@ -62,13 +62,13 @@ void GameApp::Create()
|
||||
LOG("starting Game");
|
||||
|
||||
//Test for Music files presence
|
||||
std::ifstream file("Res/sound/Track0.mp3");
|
||||
std::ifstream file(RESPATH"/sound/Track0.mp3");
|
||||
if(file){
|
||||
file.close();
|
||||
}else{
|
||||
HasMusic = 0;
|
||||
}
|
||||
std::ifstream file2("Res/sound/Track1.mp3");
|
||||
std::ifstream file2(RESPATH"/sound/Track1.mp3");
|
||||
if(file2){
|
||||
file2.close();
|
||||
}else{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// 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 <JGameLauncher.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/GameObserver.h"
|
||||
|
||||
#include "../include/GameOptions.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/GameOptions.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/GameStateDuel.h"
|
||||
#include "../include/utils.h"
|
||||
#include "../include/AIPlayer.h"
|
||||
@@ -39,7 +39,7 @@ void GameStateDuel::Start()
|
||||
|
||||
#ifdef TESTSUITE
|
||||
if (testSuite) delete testSuite;
|
||||
testSuite = NEW TestSuite("Res/test/_tests.txt");
|
||||
testSuite = NEW TestSuite(RESPATH"/test/_tests.txt");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void GameStateDuel::Start()
|
||||
deckmenu = NEW SimpleMenu(1,this,mFont, 10 , 10, 100, "Choose a Deck");
|
||||
char buffer[100];
|
||||
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);
|
||||
if(file){
|
||||
deckmenu->Add(j, GameState::menuTexts[j]);
|
||||
@@ -88,7 +88,7 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, int isAI){
|
||||
if (decknb){
|
||||
if (!isAI){ //Human Player
|
||||
char deckFile[255];
|
||||
sprintf(deckFile, "Res/player/deck%i.txt",decknb);
|
||||
sprintf(deckFile, RESPATH"/player/deck%i.txt",decknb);
|
||||
char deckFileSmall[255];
|
||||
sprintf(deckFileSmall, "player_deck%i",decknb);
|
||||
int deck_cards_ids[100];
|
||||
@@ -205,7 +205,7 @@ void GameStateDuel::Update(float dt)
|
||||
char buffer[512];
|
||||
char aiSmallDeckName[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)){
|
||||
found = 1;
|
||||
nbAIDecks++;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/GameStateOptions.h"
|
||||
#include "../include/GameApp.h"
|
||||
#include "../include/OptionItem.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
The shop is where the player can buy cards, decks...
|
||||
*/
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include <JRenderer.h>
|
||||
#include "../include/GameStateShop.h"
|
||||
#include "../include/GameApp.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/GuiCardsController.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/GuiLayers.h"
|
||||
#include "../include/Player.h"
|
||||
|
||||
GuiLayer::GuiLayer(int id, GameObserver* _game):JGuiController(id, NULL){
|
||||
game = _game;
|
||||
modal = 0;
|
||||
hasFocus = 0;
|
||||
hasFocus = false;
|
||||
}
|
||||
|
||||
GuiLayer::~GuiLayer(){
|
||||
@@ -121,21 +121,22 @@ void GuiLayers::Update(float dt, Player * currentPlayer){
|
||||
for (i=0; i<nbitems; i++){
|
||||
if (!isAI){
|
||||
if (0 != key)
|
||||
{
|
||||
objects[i]->hasFocus = 1;
|
||||
if (objects[i]->CheckUserInput(key))
|
||||
break;
|
||||
}
|
||||
if (objects[i]->CheckUserInput(key))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (++i; i<nbitems; ++i) objects[i]->hasFocus = 0;
|
||||
if (isAI){
|
||||
if (isAI)
|
||||
currentPlayer->Act(dt);
|
||||
}
|
||||
}
|
||||
|
||||
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--){
|
||||
objects[i]->Render();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/Logger.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGAbility.h"
|
||||
#include "../include/ManaCost.h"
|
||||
#include "../include/MTGGameZones.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//-------------------------------------------------
|
||||
//TODO Fill BasicAbilities
|
||||
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGCard.h"
|
||||
|
||||
#include "../include/TexturesCache.h"
|
||||
|
||||
@@ -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
|
||||
--------------------------------------------
|
||||
*/
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
#include "../include/CardDescriptor.h"
|
||||
#include "../include/Counters.h"
|
||||
@@ -19,6 +19,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to):
|
||||
LOG("==Creating MTGCardInstance==");
|
||||
initMTGCI();
|
||||
model = card;
|
||||
attacker = 0;
|
||||
lifeOrig = life;
|
||||
belongs_to=_belongs_to;
|
||||
initAttackersDefensers();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGDeck.h"
|
||||
#include "../include/utils.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGGamePhase.h"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void MTGGamePhase::Update(float dt){
|
||||
|
||||
|
||||
if (animation > 0){
|
||||
fprintf(stderr, "animation = %f", animation);
|
||||
// fprintf(stderr, "animation = %f", animation);
|
||||
animation -= dt *5 ;
|
||||
}else{
|
||||
activeState = INACTIVE;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGGameZones.h"
|
||||
#include "../include/Player.h"
|
||||
#include "../include/GameOptions.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGGuiHand.h"
|
||||
#include "../include/CardGui.h"
|
||||
|
||||
@@ -52,6 +52,7 @@ void MTGGuiHand::Update(float dt){
|
||||
if (mAnimState < 0){
|
||||
mAnimState = 0;
|
||||
mShowHand = HAND_HIDE;
|
||||
modal = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +66,7 @@ bool MTGGuiHand::CheckUserInput(u32 key){
|
||||
if (PSP_CTRL_LTRIGGER == key) {
|
||||
if (mShowHand == HAND_HIDE){
|
||||
mShowHand = HAND_SHOW_ANIMATION;
|
||||
modal = true;
|
||||
}
|
||||
if (mShowHand == HAND_SHOW){
|
||||
mShowHand = HAND_HIDE_ANIMATION;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
cards in play, graveyard, library, games phases, Players avatars
|
||||
*/
|
||||
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGGuiPlay.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
#include "../include/CardGui.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MTGRules.h"
|
||||
|
||||
MTGAttackRule::MTGAttackRule(int _id):MTGAbility(_id,NULL){
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/Logger.h"
|
||||
#include "../include/ManaCost.h"
|
||||
#include "../include/ManaCostHybrid.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/MenuItem.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../include/PhaseRing.h"
|
||||
#include "../include/MTGDefinitions.h"
|
||||
#include "../include/Player.h"
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/PlayGuiObject.h"
|
||||
|
||||
#include "../include/Player.h"
|
||||
@@ -20,7 +20,7 @@ void PlayGuiObject::Update(float dt){
|
||||
if (mHasFocus && mHeight < defaultHeight * 1.2)
|
||||
{
|
||||
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)
|
||||
mHeight = defaultHeight * 1.2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/PlayGuiObjectController.h"
|
||||
|
||||
#include "../include/PlayGuiObject.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/Player.h"
|
||||
#include "../include/GameObserver.h"
|
||||
#include "../include/DeckStats.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/PlayerData.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -19,7 +19,7 @@ PlayerData::PlayerData(MTGAllCards * allcards){
|
||||
}
|
||||
|
||||
//COLLECTION
|
||||
collection = NEW MTGDeck("Res/player/collection.dat", allcards->mCache , allcards);
|
||||
collection = NEW MTGDeck(RESPATH"/player/collection.dat", allcards->mCache , allcards);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/PriceList.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/ShopItem.h"
|
||||
#include "../include/CardGui.h"
|
||||
|
||||
@@ -131,7 +131,7 @@ ShopItems::ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y
|
||||
mHeight = 0;
|
||||
showPriceDialog = -1;
|
||||
dialog = NULL;
|
||||
pricelist = NEW PriceList("Res/settings/prices.dat",_collection);
|
||||
pricelist = NEW PriceList(RESPATH"/settings/prices.dat",_collection);
|
||||
playerdata = NEW PlayerData(_collection);
|
||||
display = NULL;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/SimpleMenu.h"
|
||||
#include "../include/SimpleMenuItem.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/SimpleMenuItem.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/Subtypes.h"
|
||||
#include <JGE.h>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/TargetChooser.h"
|
||||
#include "../include/CardDescriptor.h"
|
||||
#include "../include/MTGGameZones.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/TargetsList.h"
|
||||
#include "../include/Player.h"
|
||||
#include "../include/MTGCardInstance.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../include/TestSuiteAI.h"
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
|
||||
#include <string>
|
||||
using std::string;
|
||||
@@ -247,7 +247,7 @@ void TestSuite::initGame(){
|
||||
}
|
||||
|
||||
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){
|
||||
file << text;
|
||||
file << "\n";
|
||||
@@ -334,7 +334,7 @@ TestSuite::TestSuite(const char * filename){
|
||||
file.close();
|
||||
}
|
||||
|
||||
ofstream file2 ("Res/test/results.html");
|
||||
ofstream file2 (RESPATH"/test/results.html");
|
||||
if (file2){
|
||||
file2 << "<html><head>";
|
||||
file2 << "<meta http-equiv=\"refresh\" content=\"10\" >";
|
||||
@@ -405,7 +405,7 @@ void TestSuite::cleanup(){
|
||||
|
||||
void TestSuite::load(const char * _filename){
|
||||
char filename[4096];
|
||||
sprintf(filename, "Res/test/%s", _filename);
|
||||
sprintf(filename, RESPATH"/test/%s", _filename);
|
||||
std::ifstream file(filename);
|
||||
std::string s;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/TexturesCache.h"
|
||||
|
||||
TexturesCache::TexturesCache(){
|
||||
@@ -27,8 +27,7 @@ int TexturesCache::isInCache(MTGCard * card, int type){
|
||||
}
|
||||
|
||||
int TexturesCache::getCacheById(int id, int type){
|
||||
int i;
|
||||
for (i=0; i<nb_textures;i++){
|
||||
for (int i=0; i<nb_textures;i++){
|
||||
if (cache[i]->type == type && cache[i]->getId() == id){
|
||||
return i;
|
||||
}
|
||||
@@ -68,7 +67,7 @@ int TexturesCache::cleanup(){
|
||||
JQuad * TexturesCache::getQuad(MTGCard * card, int type){
|
||||
int cache_id = getCacheById(card->getId(), type);
|
||||
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
|
||||
if (cleanup()){
|
||||
cache_id = nb_textures;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/config.h"
|
||||
#include "../include/utils.h"
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ if(fichier){
|
||||
}
|
||||
|
||||
char alternateFilename[512];
|
||||
sprintf(alternateFilename, "Res/%s",filename);
|
||||
sprintf(alternateFilename, RESPATH"/%s",filename);
|
||||
std::ifstream fichier2(alternateFilename);
|
||||
if(fichier2){
|
||||
fichier2.close();
|
||||
|
||||
Reference in New Issue
Block a user