Commit Graph

32 Commits

Author SHA1 Message Date
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
wrenczes@gmail.com
e74c0fcc7c Moved a few more common shared includes into the precompiled header. 2010-10-24 06:55:40 +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
5aa3dc6fd3 Refactoring of some of the font management in WResourceManager. This change looks bigger than it actually is - most of the touched files are simply renaming of some font enums that I moved out of MTGDefinitions into the resource manager header files. The main points of this change: collapsing the font containers into a single map, eliminating duplicated functions, and migrating the font building logic into the resource manager class. GameApp doesn't need to know anything about the fonts it uses, and likewise, font users don't need to know what the name of their chosen font is, just the FONT_TYPE enum.
(I did a cursory check to make sure chinese still displays correctly - at a glance, I'm seeing what looks correct to someone who doesn't read the language :) )
2010-10-19 07:51:32 +00:00
omegablast2002@yahoo.com
d13e8904b5 massive update, additions and changelog in first comment. 2010-10-18 10:46:36 +00:00
wrenczes@gmail.com
5d26989f2c Force the line endings to Unix on this file. 2010-10-14 10:02:16 +00:00
wrenczes@gmail.com
847ec5b7c5 Reinstate the MillExileCost pay variant, as pointed out by Z. 2010-10-14 08:14:49 +00:00
wrenczes@gmail.com
356ce1b8ba Giant refactor of all the ExtraCost variants. Reduced the .cpp code by literally half (~350 lines!)
Some of the things refactored to the base class:
- isPaymentSet()
- canPay()
- Render()
- setSource()
- setPayment()
- the target instance
- duplicated constructor initialization crap

I'm not interested in pointing fingers as to how the code got this way, but I'll ask that everyone who's altered this code in one fashion or another to carefully diff this change and understand what I refactored.  This code is a poster child for neglect & what happens when people start blindly copy & pasting code instead of paying attention to the commonality between code paths.  If you see the same lines of code happening over & over, and you're about to make yet another copy, please stop yourself & think about how you can refactor the code to be in a single shared function (or, more explicitly, a shared base member function when possible).

If you don't understand what I mean by a shared base member function, then I would suggest at the very least reading up on this topic:

http://www.cplusplus.com/doc/tutorial/inheritance/

(And, after all that, if you're still unsure how to proceed, ping someone else for advice!)
2010-10-14 04:45:10 +00:00
wrenczes@gmail.com
33e45c9635 More incremental work of converting code to use DebugTrace(). 2010-10-10 07:30:18 +00:00
omegablast2002@yahoo.com
b507053a1d fixed storm spellcount, affinity/manaredux invis mana, added true "retrace" added 3 new extra cost types. 2010-09-14 17:15:33 +00:00
omegablast2002@yahoo.com
c408e5d588 added support for {X}{X} in cost, added support for token(creature, X/X or XX/XX)*XX or X or #. added discard card at random as cost type {d} 2010-09-12 16:15:24 +00:00
omegablast2002@yahoo.com
99da45f400 Added support for "buyback" and "flashback" with optional auto=buyback/flashback line support. 2010-09-10 18:00:37 +00:00
omegablast2002@yahoo.com
0b4dde558b added support for alternative casting cost, evoke, added support for phantom cycle,hydras, added support for exile/bounce as casting cost 2010-08-30 18:45:38 +00:00
wagic.the.homebrew@gmail.com
47c9ad1b65 Erwan
- new features by Zethfox:
-- "oneshot" optional parameters for lords (helps fixing issues with bouncelands)
-- Life as a cost (avoids using a dirty trick of paying life as an effect)
-- set life total abilitiy (lifeset
-- new auto lines: autostack, autoexile

The test suite passes with these changes, also no test using these abilities has been added yet
2010-08-08 14:04:37 +00:00
wagic.the.homebrew@gmail.com
ce69e23357 Erwan
- minor fix in Zethfox cards addon (Bad lines error from parser)
- Zethfox's patch for {t(target)} as an extra Cost. Works the same way as sacrifice, check Azami, Lady of Scrolls for an example
- fixed compilation on the PSP (sorry!)
2010-08-01 03:21:59 +00:00
wagic.the.homebrew@gmail.com
f40af0b1cb Erwan
- Chinese patch by linshier
2010-07-31 14:41:04 +00:00
wagic.the.homebrew@gmail.com
22a35d2265 Erwan
- Added remove/add counters as a cost, patch by Salmelo, thanks man!. See primitives/mtg.txt -> Thallid to see how it works
- added test for i286 by salmelo
- added basic display for counters (this needs improvement) by salmelo
2010-03-22 04:26:42 +00:00
jean.chalard
0a083f4385 J :
* Fixes for compilation on 64-bit architectures :
  string position-returning functions return size_t, not uint.
  Fix that.
* Fixes warnings with new gcc about non-fixed string AND no arguments.

NOTE : 64-bit architectures still do not compile. There are 2 different places
where printf is used with a specifier that is not large enough on 64-bit because
size_t is now a ulong and not a uint. The solution on GNU systems is the %zu
specifier, but as I'm not sure it is supported on windows I don't want to
introduce a huge hard-to-notice bug, so I'll do it at a time when I got a
windowser to back me up.
2010-01-25 09:58:30 +00:00
wagic.the.homebrew@gmail.com
bd6c1a2407 Erwan
- fix compilation issues introduced in r1727
2010-01-18 12:43:30 +00:00
wagic.the.homebrew@gmail.com
ee3286ff2a Erwan
-Fix issue 206 (rain of filth)
2009-12-13 09:33:51 +00:00
wagic.the.homebrew@gmail.com
6f1772e938 Erwan
-fix issue mentioned at http://wololo.net/forum/viewtopic.php?f=4&t=371&p=6296#p6296 . I touched a very sensitive area of the code so please let me know if something goes wrong with this revision with spells or abilities that involve targets and/or sacrifice
2009-10-24 14:15:08 +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
wagic.the.homebrew@gmail.com
d8ac4a49b1 Erwan
-translation updates (including fr.txt)
2009-07-05 09:06:51 +00:00
wagic.the.homebrew@gmail.com
ddc4636bf6 Erwan
-fixed "lord changes controller" bug
2009-07-05 04:49:21 +00:00
wagic.the.homebrew@gmail.com
910401a2e5 Erwan
- Lord+Regenerate (zombie master) memory leak fix
- "... All" memory leak fix
- Sacrifice target memory leak fix
2009-06-26 11:38:53 +00:00
wagic.the.homebrew@gmail.com
3d414f74b3 Erwan
- Fix a memory leak with Sacrifice costs
2009-06-25 13:20:27 +00:00
wagic.the.homebrew
d10f8ddff7 Erwan
- Fixed a bug with sacrifice and shroud
2009-03-01 13:14:01 +00:00
wagic.the.homebrew
6d1d5d751a Erwan
- new Ability : ALifeGiver (bottle gnomes)
- Added a few cards from Tempest
- Hybrid mana fix for hybrid mana involving uncolored mana costs (see tests/generic/hybridmana2.txt - spectral possession)
- Fixed bugs with targetting for TargetAbilities
- Fixed multiple sacrifice abilities cost (Siege gang commander, see tests)
- Fixed a small font issue
2009-02-11 09:38:20 +00:00
jean.chalard
1ab9af85a6 J :
* Fix warnings
2009-02-01 08:20:42 +00:00
wagic.the.homebrew
2d37fafe53 Erwan
-fixed psp compilation
2009-01-29 13:49:00 +00:00
wagic.the.homebrew
b6a17098a4 Erwan
- Added Dr Solomat's TEMPEST expansion
- Added Sacrifice as part of the cost of activated abilities. Making it work as an extra cost for "put in play" still requires some work though. "Render" methods need to be written correctly
- Added cards with sacrifice in the existing sets. Most of them need testing...
2009-01-25 09:20:01 +00:00