Commit Graph

53 Commits

Author SHA1 Message Date
xawotihs
caec886e22 Fixed issues found by XCode. 2013-12-20 00:24:08 +01:00
Xawotihs@gmail.com
f45c8e1d41 Just won my first Wagic network game :)
In details:
- I removed my player swap idea, it caused tons of issues with randoms
- instead I simply keep both peer on the exact same game and added one single parameter allowing to configure the view on the game. So, each peer is rendering the same game (gameObserver class) from a different player point of view (DuelLayers and related classes).
- a lot of gui stuff are missing to prevent user forbidden interactions but it works fine on Windows
2013-01-26 16:42:16 +00:00
omegablast2002@yahoo.com
4960969640 added {unattach} cost
this can also be used for "equipped creature has unattach and blah" cards using 
auto=teach(creature) {unattach}:blah

also corrected a long standing guiupdating issue. a long long time ago a replace was removed from GuiPlay::Update in hopes to increase performance no amount of performance increase is worth having cards not updating thier position after an event recieve happens. this means curse will finally go to the correctly choosen players battlefield, equipment will no longer just linger after its target dies, auras won't stay on battlefield after a card is exiled. ect. no preformance decrease noticed, if anyone else notices one let me know.
2013-01-05 03:05:53 +00:00
omegablast2002@yahoo.com
71183d23b6 cosmetic bug fix issue854
adjusted the calculation of x for enstack attackers to avoid drawing cards on top of the phase wheel out outside of the red box. adjusted the red box length for uniformity.
the previous calculation only drew cards to the middle of the screen and after about 15 attackers it pushed cards out of the red box, over on top of the phase wheel making it impossible to click or touch requiring alternative methods to advance to damage phase or reduction of the amount of attackers.

the new calculation draws attackers at the start of the red box keeping the enstack a cardwidth and a half from the edge of the screen on both sides instead instacking massive amounts of attackers tighter inside the red box, much how we handle battlefield enstack...attacking with more then 40 creatures no longer pushes attackers off screen.
2012-05-06 09:14:45 +00:00
omegablast2002@yahoo.com
0210ecf28c ok this is the last commit but i had massive issues after chopping it all up, hopefully it doesn't hilight everything that was already commited...if it does i apologize my own patch started giving me conflicts....
im like 7 tries into commiting this part....
2012-03-13 17:54:24 +00:00
Xawotihs
3514476812 - Created a GamePhase type to ease debug.
- Modified the testsuite and gameobserver to be able to replay all the testcases based on the actions logged during the first pass. This allows to test the action logging and replay used during undo. It's only activated in multithreaded mode and it does not work on Momir tests.
-  Modified choice logging and replay to use menuId instead of ability index, as, for some obscur reasons related to Lord, those ability indexes may change.
- Fixed bug in nextphase logging wrongly generating click actions
- Added a "stack" zone to the click ability logging to be able to replay properly interrupt
- Fixed a wonderful bug mixing card names with zone names in the actions execution engine
- Added a "combatok" action logging/execution
- Added a "clone" virtual method to MTGCardInstance and Token to be able to clone correctly the right object type. Used that in MTGGameZones::removeCard
2011-11-29 21:50:16 +00:00
Xawotihs
ad5edc224d Symbian^3 compilation fixes. 2011-11-07 23:32:02 +00:00
Xawotihs
e50fdba648 - Replaced static parts by per-instance parts of of several classes when they were not threadsafe (AIMomirPlayer, SimpleMenu, Trash, AIAction, MTGCardInstance, ATutorialMessage, MTGRules). The direct consequence is that we could consumme more memory. So, tell me if you have problems with low memory devices (PSP), there are some threadsafe optimizations that could be implemented if needed.
- Reworked the testsuite to be able to work multithreaded. This is deactivated by default everywhere except in QT_CONFIG as one testcase still refuses to pass in multithreaded mode. On my 4 cores linux desktop, the 650 tests passes now in 4 seconds (1 fails).
- Replaced usage of CardSelectorSingleton by a card selector per game observer.
- Modified the resource manager to be optionnal and per game observer instance instead of being a singleton. Two reasons here : threading AND Open Gl access. I only updated the crashing parts called from the game observer, so most of the code is still using the single instance. Beware of copy-paste concerning resources ...
- Cleaned up the game observer constructors
- Fixed several problems in action logging code while testing proliferate decks
- Cleaned up Threading implementation based on QThread
2011-11-06 17:31:44 +00:00
Xawotihs
9adb9d625d - reworked the testsuite and the rules (storyflow) to use the same game deserialization code, moved that code to the players and zone classes
- removed every references to the gameobserver singleton. This object can now be instantiated several times as it's needed for minmax. To be able to do that, I mostly added a reference to a gameobserver from any targetable object (cards, players, spells) and abilities.
2011-10-01 13:30:30 +00:00
techdragon.nguyen@gmail.com
82058e97c5 * fixed some formatting
* pruned out unused local variables. 
----  There's no need to define something if it isn't going to be referenced. It consumes extra memory temporarily and more than anything is a potential cause for confusion down the road.
2011-05-08 11:56:25 +00:00
wagic.the.homebrew
cd07248df5 UPDATE YOUR rules FOLDER!!!
- This is some Work in progress to make Wagic less "game" dependent.
This change especially is an attempt at moving away from some dangerous patents owned by some company.
It introduces "modrules.xml", a global configuration file describing dynamic settings for any given Wagic mod. It is very basic for now, but allows to customize a bit. In particular, it allows to remove the concept of shop and deck editor from the game, dynamically generate the main menu, and represent card activation with a mask rather than a rotation.
I have a sample in progress which I hope to submit in the days to come, a proof of concept (nothing fancy yet) for another type of game using these ideas, as well as a few other things I introduced recently.
In the future, I am hoping to extend modrules.xml so that it entirely describes the rules of a given card game. the other files in rules.txt will describe "extensions" to the core rules, just like they do right now, so this new file does not make them obsolete.


- Also fixed minor bugs I stumbled upon while developing
2011-04-29 17:30:57 +00:00
wagic.the.homebrew
6f5919ed06 Reverting r3496 to fix failing tests 2011-04-21 15:16:22 +00:00
techdragon.nguyen@gmail.com
8bf983e2e5 Flagged numerous peices of code that have local variables that are masking either member variables or variables scoped outside the current scope.
I've marked all the ones I found with the following TODO comment:

TODO: C6246: <blah blah>

a few in particular are the ones related to "oneShot" and "_target".  These are local variables that are declared that
mask either a method parameter or a member variable.
2011-04-21 10:04:32 +00:00
wrenczes@gmail.com
99ed83c5e8 Performance improvements/cleanup: card->hasType("foo") performs a string lookup for an integer id. Now that our primitives have over 1000 types (1018, I believe is the number I saw while debugging), this is not the cheapest lookup. Over the course of time, a lot of new rules have crept in the code - support for 'aura', 'equipment', and recently 'planeswalker'. While profiling, I saw an inordinate amount of time being used doing map lookups for these strings. Since they're used so frequently, I've added them to the SubTypes enumeration, and swapped out doing the string lookup in favour of using the int ID directly. I also found a few places where we were using hasType("Creature") or hasType("land") when we already had helper functions to do the int lookup, so I swapped these in as appropriate, as well as a couple of places where we had hasType("instant") instead of hasType(Subtypes::TYPE_INSTANT), etc. 2011-04-10 00:07:34 +00:00
wrenczes@gmail.com
bb2f784489 Refactored Z's last change slightly, eliminated code duplication. 2011-02-05 21:30:28 +00:00
omegablast2002@yahoo.com
7b3d65e984 changed it a little...now now difference while you have less then 10 artifacts/enchantments...after 9 it reorders them into stacks of 5 to save room.... 2011-02-05 13:26:02 +00:00
omegablast2002@yahoo.com
f504051bfd changed the vertstack count of enchantments and artifacts from 3 per stack, to 5 per stack, i wanted to go 6 but i felt it cropped too much off the 6ths card...
reason for this change is that it becames WAY to hard to player decks which contained mostly artifacts to share the feild, give 9 cards half the screen to display just didnt seem like a good choice compared to the creatures horizontal stack which can display almost 200 cards in the same screen width.
2011-02-05 13:05:51 +00:00
wrenczes@gmail.com
d439be4f75 Fixed http://code.google.com/p/wagic/issues/detail?id=572, where a card sometimes might not show its tap status correctly. My fix for 550 was slightly off, in that if a card view's position was updated (ie from a zone change, etc), the pos pointer shouldn't be cleared. Only the pos related to the 'this' pointer is the one that can't be referenced anymore, fixed the destructor code. 2011-01-25 07:52:01 +00:00
omegablast2002@yahoo.com
c6584a9e9d meant hasType...tho im not really sure its needed(?) 2011-01-24 18:26:04 +00:00
omegablast2002@yahoo.com
0b0da78e30 removed a change that wasnt supposed to be there. sorry! 2011-01-24 18:23:02 +00:00
omegablast2002@yahoo.com
beec00c254 2 changes, first fixed the bug where auras were causing the cards to slide to the right, auras always have targets, so i added a conditional to guiplay to ignore adding it to the horizontal shift as these auras should never be just laying in the battlefield with no target.
2nd, started laying some ground work for planeswalkers.
added the planeswalker rule, as per mtg rules, if you have a type=planeswalker subtype=jace already on the battlefield, both are sent to the graveyard. so you can not have a jace mind scuptor and a jace beleren out at the same time. i choose to use subtype= and type= rather then adding another variable to MTGCard...
also, added GuiPlay positioning for planeswalker,
i think theres been a HUGE misunderstanding about planeswalkers which has most going "battlefield is too crowded where would be put them...easy...slap them at the end of the lands ..done...theyre not creatures or artifacts/enchantments..so i moved them to the colum with the lands and have guiplay slap them at the end of that colum...btw this is in no means final...if someone can think of a better solution be my guest, but looking at the planeswalker (workaround) thread, its pretty obvious that no one will care where we slap the planeswalkers, as long as theyre supported. planeswalkers have alot more ground to cover...
2011-01-24 17:58:14 +00:00
wrenczes@gmail.com
1cc516193e Sidecar fix to the CardView change: running the test suite revealed a few other places where bad assumptions were being made that an event's card view pointer was legitimate. Now they properly evaluate whether the view is null and adjust accordingly. 2010-12-16 09:41:14 +00:00
wrenczes@gmail.com
65e38b0694 Another change that looks bigger than it is: changed out the global extern WResourceManager to a real singleton. This means that it's no longer being init'ed at static initialization time, and we can debug construction/destruction properly; it's also safer in a multithreaded context. 2010-12-01 08:22:17 +00:00
techdragon.nguyen@gmail.com
acd7bb1aa4 reformatting code according to guidelines defined at
http://wololo.net/forum/viewtopic.php?f=35&t=2235&start=10
2010-11-16 00:55:16 +00:00
omegablast2002@yahoo.com
0773e9470b seperated a varible that determined the amount of sliding of cards based on how many noncreatures and nonland cards you had.
what this change does is this. if i have 20 enchantments on the battlefield Ai's creatures and lands no longer slide to the right. and vice versa. made no sense that if the other player had no artifacts/enchantments that HIS lands and creatures would slide simply because the OTHER player had artifacts/enchantments.
2010-11-10 19:32:37 +00:00
wrenczes@gmail.com
a053c0d59e More type conversion warning cleanup. 2010-11-07 12:00:23 +00:00
wrenczes@gmail.com
5a1e8e6ffe More reorganization work around CardSelector and the singleton pattern. Broke the source for the singleton into its own separate source file, to keep things clean. Also broke apart a circular header dependency: CardSelector defines and uses a SelectorZone, which is a member inside of CardView. CardView in turn is used heavily by CardSelector. Instead SelectorZone is now defined within CardView (where it's set & controlled anyway).
I've also added my current work on the zone navigation system (class Navigator) - it's currently turned off for now (the override for this is inside of CardSelectorSingleton's Instance() call, simply comment out the NEW CardSelector and uncomment out the NEW Navigator line.)  It's functional, but I want to do more testing before considering wiring it into the game options or something similar.  (Also, note that it currently doesn't support the mouse functionality added by DJardin.)

Lastly, there's a bug crash fix in ActionStack that I tripped across while testing - basically, an illegal index value would have us walk off the bounds of a vector.
2010-10-31 07:50:53 +00:00
wrenczes
d5f3e4cfea Enabled precompiled headers for the build. This cuts the win compile time in debug by at least half on my laptop; on the psp compile, it shaves it down by ~ 45 seconds. I only did a cursory inspection of what to add to PrecompiledHeader.h, there's probably more that we can throw in there for more incremental speed improvements.
Also fixed the project includes so that we don't need to always use the indirect include path, ie:
#include "../include/foo.h" -> #include "foo.h"

I'm don't know much about make files - if I busted the linux build, mea culpa, but I think we're okay on that front too.  For future reference, here's the most straightforward link on the topic of adding pch support to make files:

http://www.mercs-eng.com/~hulud/index.php?2008/06/13/6-writing-a-good-makefile-for-a-c-project
2010-10-24 05:55:24 +00:00
wrenczes@gmail.com
e2de03d987 Some organisational prep work before I start working on a new navigation method (ie replacement for CardSelector). The current design was to allocate a CardSelector and pass in its pointer to a variety of classes via their constructors. To simplify things, now we use a singleton style pattern with an Instance() function - this means that when I implement a new class to replace CardSelector, I only need to modify what's returned by the singleton callback - as long as the new pointer class supports the same function calls, it'll be a straight drop-in. 2010-10-22 08:41:44 +00:00
wagic.the.homebrew@gmail.com
b79c7eea53 Erwan
- fix for issue 462 (graphical glitch when cards come back from graveyard)
- adding Kaioshin's wallpaper
- fixed minor issue in mtg.txt
2010-09-28 13:58:22 +00:00
wagic.the.homebrew@gmail.com
187e108cdb Erwan
-fix issue 192 (graphical issue when tapped card changes controller)
2010-01-15 15:09:41 +00:00
wagic.the.homebrew@gmail.com
60845ee3b3 Erwan
- fix issue 111
2009-10-24 13:06:02 +00:00
wagic.the.homebrew@gmail.com
fb52ea5452 Erwan
- fix for issue 113
2009-10-24 11:52:55 +00:00
jean.chalard
77a00a3c4d J :
* Some cleaning after r1062 code review.
- Remove code that was never reached.
- Remove a useless function.
- Make GuiPlay treat cards that are both spells and creatures as
  creatures and not spells.
2009-10-19 13:36:42 +00:00
wagic.the.homebrew@gmail.com
273b0672e4 Erwan
- various optimization fixes
2009-10-19 11:37:47 +00:00
wagic.the.homebrew@gmail.com
6f159fb39c Erwan - cache fixes - Code review highly appreciated, please criticize my code!
- fix issue 65 (quads when no image  load slowly in shop/deck editor)
- Possibly fix issue 92, please let me know if it reproduces
- Fix issue 97 (Deck editor: weird behavior of deck display)
- Fix issue 39 - please verify
- Issue 56 can probably be closed as well
- Fix issue 86
2009-10-13 14:16:30 +00:00
jean.chalard
38d7a96095 J :
* Change inplay balance.
- Spells now stack three by three.
- Spells try to space a little more.
- Creatures and land stack to the left until they hit the big card,
  at which point they start displaying more compactly. At some point,
  they start using all the screen even if it's under the hand.
2009-10-11 05:47:31 +00:00
wagic.the.homebrew@gmail.com
59eb79fc47 Erwan
- fix issue 94 (enchant enchantments)
2009-10-01 13:33:40 +00:00
wagic.the.homebrew@gmail.com
30ef39d49d Erwan
- "fix" issue 25
- A few AI fixes for Deck 36 (artifact lands deck)
2009-09-27 06:37:24 +00:00
wagic.the.homebrew@gmail.com
bb83817c82 Erwan
-fix potential segfault introduced earlier
2009-09-26 11:32:09 +00:00
wagic.the.homebrew@gmail.com
33c081858e Erwan
- Fix issue 43 (Combat zone sometimes stay open)
2009-09-26 10:50:48 +00:00
wagic.the.homebrew@gmail.com
e5751957dd Erwan
-fix issue 35 - Card duplicated when moved from inplay to inplay
- fix issue 54 - Token not going away - (duplicate of issue 35)
2009-09-25 14:40:49 +00:00
wagic.jeck
8ba34dafca Jeck - WResourceManager / Cache should now be leak free. Demo mode still crashes around EnstackBlocker. 2009-09-18 01:20:46 +00:00
jean.chalard
34d973c60d J :
* Create selection zones to remember the last card the cursor was on.
2009-09-12 12:57:50 +00:00
jean.chalard
b6781e82f1 J :
* Add the Trash facility and use it for CardViews.
* Fix a graphical bug with card shadows.
* Fix a graphical bug with limitors.
* Enhance the graphical appearance of cards going to graveyard.
2009-09-05 11:44:34 +00:00
wagic.the.homebrew@gmail.com
681122f018 Erwan
- prevent a segfault in the test suite (does not fix the root cause)
2009-09-05 04:58:44 +00:00
jean.chalard
01fe3b76f7 J :
* Minor bugfixes (mostly graphical bugs)
2009-09-04 16:58:17 +00:00
wagic.jeck
f220d2e9b9 Jeck - Cache and resource manager merged, streamlined.
This is pretty major, so there'll probably be something wrong with it... even though I did spend a few hours looking.
NOTES:
 * If you've Retrieved it, don't delete it--- Use resources.Release(Whatever). 
    Textures automatically release subordinate quads.
 * Most of the time, use resources.RetrieveQuad to grab a quad. Should handle everything for you.
    RetrieveQuad will load the required texture, if needed.
    Only managed resources have a resource name ("back", "simon", etc). 
    Managed resources can be retrieved with GetTexture/GetQuad/GetWhatever.
    Non managed quads lookup by position/dimensions, defaulting to the whole texture.
 * Use resources.RetrieveTexture only when you need to do something special to it. 
    Calling retrieve texture with RETRIEVE_MANAGE will permanently add a texture to the manager
    RETRIEVE_LOCK and RETRIEVE_VRAM will lock a texture. It will not leave the cache until
    Release(JTexture*) is called, or as a last resort during cache overflow.
 * Try to only store (as a class member) pointers to textures retrieved with RETRIEVE_MANAGE. 
    All others may become invalid, although locked textures do have a high degree of stability. It's
    pretty safe to store a locked texture if you're not going to load much between uses.

There's a lot going on here, so I might have missed something... but it runs through the test suite alright.

TODO: 
 * When called without any arguments, RetrieveQuad sometimes leaves a thin border around the image. 
    This can be bypassed by specifying a quad one or two pixels less than the image size. Why?
 * I've had a crash while runing the Demo mode, something to do with receiveEventMinus? 
    This hasn't exactly reproduced on a clean SVN copy, (being a hang, rather than a crash) so 
    I've probably done something to worsen the problem somehow? I'll look into it tomorrow.
 * Clean up lock/unlock system, memory usage. Streamline interface, consider phasing out calls using GetWhatever() format.
2009-09-03 09:28:16 +00:00
jean.chalard
7214248494 J :
* Some more tweaking for combat.
* This still doesn't work, but it's closer.
2009-09-03 02:16:53 +00:00
jean.chalard
336412f006 J :
* Fix PSP compilation errors
* This does not magically make it work
2009-08-31 16:55:03 +00:00