Erwan
- fixed sfx issues on the psp - removed a few debug strings
This commit is contained in:
@@ -1,50 +1,50 @@
|
||||
0
|
||||
100
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
30
|
||||
100
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
|
||||
@@ -1,92 +1,96 @@
|
||||
1167
|
||||
460
|
||||
1202
|
||||
525
|
||||
1340
|
||||
92
|
||||
1284
|
||||
101
|
||||
1149
|
||||
20
|
||||
1264
|
||||
20
|
||||
1321
|
||||
20
|
||||
1272
|
||||
437
|
||||
1126
|
||||
485
|
||||
1334
|
||||
107
|
||||
1352
|
||||
91
|
||||
1279
|
||||
20
|
||||
1154
|
||||
481
|
||||
1328
|
||||
551
|
||||
1335
|
||||
20
|
||||
1227
|
||||
500
|
||||
1236
|
||||
489
|
||||
1186
|
||||
20
|
||||
1219
|
||||
20
|
||||
1175
|
||||
459
|
||||
1136
|
||||
111
|
||||
1332
|
||||
545
|
||||
1250
|
||||
21
|
||||
1204
|
||||
19
|
||||
1381
|
||||
499
|
||||
1170
|
||||
484
|
||||
1097
|
||||
102
|
||||
1102
|
||||
46
|
||||
1282
|
||||
485
|
||||
1378
|
||||
490
|
||||
1300
|
||||
20
|
||||
1363
|
||||
495
|
||||
129665
|
||||
90
|
||||
1387
|
||||
4
|
||||
129652
|
||||
5
|
||||
174957
|
||||
108
|
||||
175030
|
||||
5
|
||||
130378
|
||||
107
|
||||
175031
|
||||
5
|
||||
1312
|
||||
19
|
||||
130386
|
||||
97
|
||||
1275
|
||||
21
|
||||
1148
|
||||
103
|
||||
135185
|
||||
20
|
||||
1100
|
||||
109
|
||||
153441
|
||||
19
|
||||
1167
|
||||
460
|
||||
1202
|
||||
525
|
||||
1340
|
||||
92
|
||||
1284
|
||||
101
|
||||
1149
|
||||
20
|
||||
1264
|
||||
20
|
||||
1321
|
||||
20
|
||||
1272
|
||||
437
|
||||
1126
|
||||
485
|
||||
1334
|
||||
107
|
||||
1352
|
||||
91
|
||||
1279
|
||||
20
|
||||
1154
|
||||
481
|
||||
1328
|
||||
551
|
||||
1335
|
||||
20
|
||||
1227
|
||||
500
|
||||
1236
|
||||
489
|
||||
1186
|
||||
20
|
||||
1219
|
||||
20
|
||||
1175
|
||||
459
|
||||
1136
|
||||
111
|
||||
1332
|
||||
545
|
||||
1250
|
||||
21
|
||||
1204
|
||||
19
|
||||
1381
|
||||
499
|
||||
1170
|
||||
484
|
||||
1097
|
||||
102
|
||||
1102
|
||||
46
|
||||
1282
|
||||
485
|
||||
1378
|
||||
490
|
||||
1300
|
||||
20
|
||||
1363
|
||||
495
|
||||
129665
|
||||
90
|
||||
1387
|
||||
4
|
||||
129652
|
||||
5
|
||||
174957
|
||||
108
|
||||
175030
|
||||
5
|
||||
130378
|
||||
107
|
||||
175031
|
||||
5
|
||||
1312
|
||||
19
|
||||
130386
|
||||
97
|
||||
1275
|
||||
21
|
||||
1148
|
||||
103
|
||||
135185
|
||||
20
|
||||
1100
|
||||
109
|
||||
153441
|
||||
19
|
||||
1318
|
||||
499
|
||||
146746
|
||||
509
|
||||
|
||||
@@ -480,6 +480,7 @@ other solutions need to be provided for abilities that add mana (ex: mana flare)
|
||||
|
||||
class AManaProducer: public MTGAbility{
|
||||
protected:
|
||||
static int currentlyTapping;
|
||||
ManaCost * cost;
|
||||
ManaCost * output;
|
||||
string menutext;
|
||||
@@ -533,9 +534,10 @@ class AManaProducer: public MTGAbility{
|
||||
if (mParticleSys && animation == 1.f) mParticleSys->Fire();
|
||||
animation -= 4 *dt;
|
||||
if (animation < 0){
|
||||
animation = 0;
|
||||
controller->getManaPool()->add(output);
|
||||
if (mParticleSys) mParticleSys->Stop();
|
||||
animation = 0;
|
||||
currentlyTapping--;
|
||||
controller->getManaPool()->add(output);
|
||||
if (mParticleSys) mParticleSys->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,6 +565,7 @@ class AManaProducer: public MTGAbility{
|
||||
int reactToClick(MTGCardInstance * _card){
|
||||
if (!isReactingToClick( _card)) return 0;
|
||||
source->tapped = 1;
|
||||
currentlyTapping++;
|
||||
if (cost) GameObserver::GetInstance()->currentlyActing()->getManaPool()->pay(cost);
|
||||
animation = 1.f;
|
||||
CardGui * cardg = game->mLayers->playLayer()->getByCard(source);
|
||||
@@ -572,7 +575,7 @@ class AManaProducer: public MTGAbility{
|
||||
}
|
||||
controller = source->controller();
|
||||
|
||||
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME] > 0){
|
||||
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME] > 0 && currentlyTapping < 3){
|
||||
JSample * sample = SampleCache::GetInstance()->getSample("sound/sfx/mana.wav");
|
||||
if (sample) JSoundSystem::GetInstance()->PlaySample(sample);
|
||||
}
|
||||
@@ -630,7 +633,7 @@ class AManaProducer: public MTGAbility{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int AManaProducer::currentlyTapping = 0;
|
||||
|
||||
/* Lifelink Ability */
|
||||
class ALifeLink:public MTGAbility{
|
||||
|
||||
@@ -58,14 +58,25 @@ class TexturesCache{
|
||||
};
|
||||
|
||||
|
||||
class SampleCached{
|
||||
public:
|
||||
int lastTime;
|
||||
JSample * sample;
|
||||
SampleCached(int _lastTime, JSample * _sample):lastTime(_lastTime),sample(_sample){};
|
||||
~SampleCached(){delete sample;};
|
||||
};
|
||||
|
||||
class SampleCache{
|
||||
protected:
|
||||
map<string, JSample *> cache;
|
||||
int lastTime;
|
||||
map<string, SampleCached *> cache;
|
||||
static SampleCache * mInstance;
|
||||
void cleanCache();
|
||||
void cleanOldest();
|
||||
~SampleCache();
|
||||
public:
|
||||
static SampleCache * GetInstance();
|
||||
SampleCache(){lastTime = 0;};
|
||||
JSample * getSample(string filename);
|
||||
|
||||
};
|
||||
|
||||
@@ -55,34 +55,22 @@ void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){
|
||||
|
||||
MTGCardInstance * card = NULL;
|
||||
while((card = cd.nextmatch(game->inPlay, card))){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Found mana card\n");
|
||||
#endif
|
||||
|
||||
int doTap = 1;
|
||||
for (int i=MTG_NB_COLORS-1; i>= 0; i--){
|
||||
if (diff->getCost(i) && card->hasSubtype(MTG_LAND_TEXTS[i]) ){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Not Gonna Tap\n");
|
||||
#endif
|
||||
diff->remove(i,1);
|
||||
doTap = 0;
|
||||
break;
|
||||
diff->remove(i,1);
|
||||
doTap = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (doTap){
|
||||
gameObs->cardClick(card);
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Tapped\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
delete(diff);
|
||||
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("ok land tapped");
|
||||
#endif
|
||||
}
|
||||
//TODO a better function that does not take into account only basic lands
|
||||
ManaCost * AIPlayer::getPotentialMana(){
|
||||
@@ -95,24 +83,12 @@ ManaCost * AIPlayer::getPotentialMana(){
|
||||
while((card = cd.nextmatch(game->inPlay, card))){
|
||||
|
||||
if (card->hasSubtype("plains")){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Found Potential plain\n");
|
||||
#endif
|
||||
potentialMana->add(MTG_COLOR_WHITE,1);
|
||||
}else if(card->hasSubtype("swamp")){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Found Potential swamp\n");
|
||||
#endif
|
||||
potentialMana->add(MTG_COLOR_BLACK,1);
|
||||
}else if(card->hasSubtype("forest")){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Found Potential forestn\n");
|
||||
#endif
|
||||
potentialMana->add(MTG_COLOR_GREEN,1);
|
||||
}else if(card->hasSubtype("mountain")){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("Found Potential Mountain\n");
|
||||
#endif
|
||||
potentialMana->add(MTG_COLOR_RED,1);
|
||||
}else if(card->hasSubtype("island")){
|
||||
potentialMana->add(MTG_COLOR_BLUE,1);
|
||||
@@ -504,21 +480,7 @@ int AIPlayerBaka::Act(float dt){
|
||||
return 0;
|
||||
}
|
||||
initTimer();
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("==========\nNew Act CALL\n================\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("==========\nCombat Damages ?\n================\n");
|
||||
#endif
|
||||
if (combatDamages()) return 0;
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("==========\nChoose Target ?\n================\n");
|
||||
#endif
|
||||
if (chooseTarget()) return 0;
|
||||
|
||||
|
||||
@@ -552,12 +514,6 @@ int AIPlayerBaka::Act(float dt){
|
||||
|
||||
//No mana, try to get some
|
||||
getPotentialMana();
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buffe[4096];
|
||||
|
||||
sprintf(buffe,"potentail mana %i\n",potentialMana->getConvertedCost() );
|
||||
OutputDebugString(buffe);
|
||||
#endif
|
||||
if (potentialMana->getConvertedCost() > 0){
|
||||
|
||||
|
||||
@@ -570,6 +526,7 @@ int AIPlayerBaka::Act(float dt){
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(potentialMana, "sorcery");
|
||||
if (nextCardToPlay){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buffe[4096];
|
||||
sprintf(buffe, "Putting Card Into Play: %s", nextCardToPlay->getName());
|
||||
OutputDebugString(buffe);
|
||||
#endif
|
||||
|
||||
@@ -33,28 +33,16 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card){
|
||||
}
|
||||
|
||||
MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card){
|
||||
#ifdef WIN32
|
||||
OutputDebugString("Match AND\n");
|
||||
#endif
|
||||
|
||||
MTGCardInstance * match = card;
|
||||
for (int i = 0; i< nb_types; i++){
|
||||
|
||||
if (!card->hasSubtype(types[i])){
|
||||
#ifdef WIN32
|
||||
OutputDebugString(card->name.c_str());
|
||||
OutputDebugString("Subtype No Match\n");
|
||||
#endif
|
||||
match = NULL;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i< MTG_NB_COLORS; i++){
|
||||
if ((colors[i] == 1 && !card->hasColor(i))||(colors[i] == -1 && card->hasColor(i))){
|
||||
match = NULL;
|
||||
#ifdef WIN32
|
||||
OutputDebugString(card->name.c_str());
|
||||
OutputDebugString("Color No Match\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return match;
|
||||
@@ -116,11 +104,6 @@ MTGCardInstance * CardDescriptor::nextmatch(MTGGameZone * zone, MTGCardInstance
|
||||
if (NULL == previous) found = 1;
|
||||
for(int i=0; i < zone->nb_cards; i++){
|
||||
if(found && match(zone->cards[i])){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf,"Card Descriptor MATCH!: %s \n" ,(zone->cards[i])->getName());
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
return zone->cards[i];
|
||||
}
|
||||
if (zone->cards[i] == previous){
|
||||
|
||||
@@ -126,22 +126,40 @@ SampleCache * SampleCache::GetInstance(){
|
||||
}
|
||||
|
||||
JSample * SampleCache::getSample(string filename){
|
||||
map<string,JSample *>::iterator it = cache.find(filename);
|
||||
map<string,SampleCached *>::iterator it = cache.find(filename);
|
||||
if (it == cache.end()){
|
||||
if (cache.size() >10) cleanCache(); //Poor man's limit
|
||||
if (cache.size() >10) cleanOldest(); //Poor man's limit
|
||||
JSample * sample = JSoundSystem::GetInstance()->LoadSample(filename.c_str());
|
||||
if (!sample && fileExists(filename.c_str())){ //Out of Ram ??
|
||||
cleanCache();
|
||||
sample = JSoundSystem::GetInstance()->LoadSample(filename.c_str());
|
||||
}
|
||||
lastTime++;
|
||||
cache[filename] = NEW SampleCached(lastTime, sample);
|
||||
return sample;
|
||||
}else{
|
||||
return (it->second);
|
||||
return (it->second->sample);
|
||||
}
|
||||
}
|
||||
|
||||
void SampleCache::cleanOldest(){
|
||||
int smallest = lastTime;
|
||||
map<string,SampleCached *>::iterator found = cache.end();
|
||||
map<string,SampleCached *>::iterator it;
|
||||
for (it = cache.begin(); it != cache.end(); it++){
|
||||
if(it->second->lastTime <= smallest){
|
||||
smallest = it->second->lastTime;
|
||||
found = it;
|
||||
}
|
||||
}
|
||||
if (found != cache.end()){
|
||||
delete (found->second);
|
||||
cache.erase(found);
|
||||
}
|
||||
}
|
||||
|
||||
void SampleCache::cleanCache(){
|
||||
map<string,JSample *>::iterator it;
|
||||
map<string,SampleCached *>::iterator it;
|
||||
for (it = cache.begin(); it != cache.end(); it++){
|
||||
delete(it->second);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user