Commit Graph

84 Commits

Author SHA1 Message Date
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
jean.chalard
1317eb0d29 J :
* Add multilingual support for utf-8.
* Use japanese as a test case (removing the old tentative support).
* A number of shortcomings affect this code.
  + Bugs :
    - This splits algorithms used to determine the length of a string
      and to render it in two: either the string starts with an ascii
      char and the monobyte, variable-space algorithm is used, or it
      does not and a multibyte but fixed-space algorithm is used.
      This shortcoming also exists in the code to support chinese.
    - From the above comes the biggest limitation: any string that
      starts with an ascii character but include non-ascii characters
      will not be rendered correctly.
    - This does not and cannot support chars outside the BMP. This
      probably won't matter, ever.
  + Todos, fixmes, wishlist :
    - Single-width characters with diacritics are reported as
      double-space chars. It doesn't matter too much at the moment, but
      should be fixed in the future.
    - Font support currently only includes japanese.
  + Performance and compatibility notes :
    - Chinese code has not been switched to utf-8, to maintain backward
      compatibility. We should switch it at some point in the future,
      but ponder the right way to do it first.
    - Retaining the support for chinese with a non-international
      charset hurts performance (by making some methods uselessly
      virtual).
* Still, this generally works and is extensible (it can be used to
  implement korean, traditional chinese, etc, without any more code).
  Implementing languages with diacritics needs an improvement of the
  bool doubleWidthChar() method.
2010-11-14 16:24:29 +00:00
wrenczes@gmail.com
3eeb8a6465 - renamed WResourceManager::autoResize() to ResetCacheLimits(), since the function doesn't actually resize anything. It's merely setting clamping limits on when we should purge the cache.
- fixed the debug framerate calculation / drawing code (consolidated duplicated functions & variables mDelta vs a win-only mDeltaTime, no reason to have two), repositioned it to draw on the bottom left (it was colliding with other debug text for the cache info).
 - for debug testing purposes, added a #define override to force the image cache to work with less memory (I've picked 8 megs, which is what the psp seems to use - the normal default on win/linux is 20 megs).
2010-11-09 19:01:38 +00:00
wagic.the.homebrew@gmail.com
5d907f5abe Erwan
- Added a possibility to put a file "Res.txt" instead of the folder "Res". The file Res.txt is a simple 1 line text file, telling where to find the Res folder, terminated by "/". For example: "../../wagic_res".
This addresses issue 428 . This could also help us in the future, to develop mods.
2010-11-07 09:26:29 +00:00
linshier
60ef07a025 Added basic Japanese font support. 2010-10-24 07:56:28 +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
wrenczes@gmail.com
832f11c153 Switched the managed JQuad container implementation from a vector to a map. This speeds up the cache lookup time from O(n) to O(log n). Hard to see a noticeable difference on win, but it definitely feels snappier on my psp, for instance, when browsing your library for a card, or your graveyard, etc.
I'm also noticing that the GetQuad(int) variant never seems to get hit, so I suspect that the ID lookup map is redundant.  I left it alone as the JResourceManager base class forces the need for the function; I need to spend more time looking at just how much of JResourceManager we actually use at this point.
2010-10-17 16:54:08 +00:00
wrenczes@gmail.com
def3293fac Fixed my trace - removed the spurious addressof(). 2010-10-07 03:45:57 +00:00
techdragon.nguyen@gmail.com
652358b8c4 commented out last check in as "addressof" is not defined in current code set. Is it possibly out of the boost library? 2010-10-06 16:05:58 +00:00
wrenczes@gmail.com
78f8ff98bb more OutputDebugString() conversions, and removed a useless trace in the base WResource destructor - instead, moved it up to WCachedResource so that we can output the filename of the resource that is being destroyed. 2010-10-06 11:46:10 +00:00
wagic.the.homebrew@gmail.com
ac435980ce Erwan
- Attempt at solving issue 247 (missing background image for trophy room). I think I attempted that a while ago and it caused some crashes, so let's revert this change if this happens
2010-09-26 06:22:46 +00:00
wagic.the.homebrew@gmail.com
bdc43052d3 Erwan
- support for tinyCrops see http://wololo.net/forum/viewtopic.php?f=15&t=2197
- card images can now be named after the card's name (ex: sets/10E/Ancestor's Chosen.jpg , or sets/10E/10E.zip:Ancestor's Chosen.jpg)
- yet another attempt at fixing tokens in the shop
2010-09-20 07:10:21 +00:00
wagic.jeck
8114944db9 Jeck - Added theme substyles, which are chosen dynamically based on the player's deck composition. Also added lazy unit test for booster packs, though there should be a better way to framework this. 2010-08-28 10:51:38 +00:00
linshier
8247c22ff0 Fixed loading/option-saving slowdown brought in by Chinese support to other languages. 2010-08-15 11:57:31 +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
1332842025 Erwan
- bug fix in JGE++ audio (improve HBL compatibility)
- Added new rewards in story mode: random card, card (either by "name" or id), specific set
- Story mode: added possibility to choose music, and bg for duel.
-- See "01. Where it all begins" for examples of new features
2010-07-19 13:44:26 +00:00
wagic.the.homebrew@gmail.com
b1079942af Erwan
- Reward system in Story mode (currently, either credits or random set)
- Rules now accept for player 2 to start (see story mode "block" stage)
- Story mode now has an autosave/autoload mechanism. This is for convenience but also to prevent people from abusing the reward mechanism too easily.
- possibility to choose an avatar for both players through the rules (see example in story mode)
2010-05-09 08:14:01 +00:00
wagic.the.homebrew@gmail.com
a3cbbedd3c Erwan
- fix issue 392 (broken tests)
- Fix a bunch of memory leaks (guys please be careful!)
- Added Logging facility in JGE
- HBL Compatibility (cleaned up some code with MP3 in JGE)
- Added "winGame" ability. Currently used mostly by the story mode, but some cards could probably need it too
- Improved story mode and uncommented it from the source.
-- The current campaign is of course very basic, anybody who wants to improve it or create other ones feel free to do so
-- TODO (short term): save progress, rewards system, improve tutorial campaign
-- I'll talk a bit more about this on the forums/email after a night of sleep
2010-04-26 14:27:34 +00:00
jean.chalard
e31ddd96ae J :
* Change a printf for some architectures.
2010-01-27 14:59:21 +00:00
jean.chalard
f38dbf1746 J :
* Fix another set of 64-bits related problems.
* The code is now expected to compile on linux-64bits, but as I
  can't test, I can't be positive about it really compiling,
  much less working.
2010-01-27 07:25:48 +00:00
wagic.the.homebrew@gmail.com
66a505969e Erwan
- fix issue 215
- added test for purple screen (this is the small white square on top of the loading screen)
2009-11-23 08:25:27 +00:00
wagic.jeck
37ad16d90e Jeck - Basic set metadata support. Also a minor improvement to WGuiImage.
* Metadata is currently only used in exactly one place: the set's "Pretty Name" is displayed when the set is first unlocked. 
* WGuiImage now has a function to set scaling.
2009-11-18 09:27:24 +00:00
wagic.the.homebrew@gmail.com
f33d37d9f2 Erwan
-attempt at fixing shop crash introduced in r1231 (size needed in ram divided by 4)
2009-11-04 13:33:21 +00:00
wagic.the.homebrew@gmail.com
d7dae0dcd9 Erwan
- Added -O2 option in the PSP Makefile. In my tests, this highly increases the probability of getting a purple screen. Fixing this bug is THE priority :)
2009-10-29 13:12:16 +00:00
jean.chalard
0e4832dcd6 J :
* Fix a bug where a variable would be used uninitialized.
2009-10-28 18:51:53 +00:00
wagic.jeck
3347fd020b Jeck - Removed some unused bits of code, added zip support to themes' card overrides. @Jean, please check WResourceManager::dirOK() on Linux.
This needs some impact testing, to be certain it doesn't noticeably slow anything down. In a future version I'd like to memoize checking for zip file existence in each "Res/sets/XXX/" directory once during boot, and in the themed directory whenever switching themes.
2009-10-28 04:06:45 +00:00
wagic.jeck
fea10bdf21 Jeck - Quad locking restored, minor cache fiddling.
* Restored quad locking to textures, but ignore quad locks when Release(JTexture*) is explicitly called. (I just copied and modified the code from the template, rather than do anything elegant). 
* Some minor fiddling with cache error states.
2009-10-27 07:00:16 +00:00
wagic.jeck
fb7f48f26b Jeck - Please review: this makes minor changes to a lot of files, and major changes to the WCache flatten() function.
* Removed all calls to Release(JQuad*).
* Updated flatten(). Prior flatten was buggy beyond belief.
* Done some extensive testing, but if this causes more trouble than it fixes, we'll have to revert. It's too close to release time.
2009-10-27 02:46:39 +00:00
wagic.jeck
8e0bcef6e9 Jeck - Removed a ton of unreached or unused code from the cache, to make debugging easier. None of this actually effects execution at all. Some of these functions (though not many) are potentially useful, but as they aren't actually used there's no reason to have them cluttering up the files. 2009-10-26 05:55:52 +00:00
wagic.jeck
4dc217edcb Jeck - Potential fix to issue 109, issue 112. Looks hopeful so far, please confirm (or confirm failure).
* We only want to record misses when the file doesn't exist. Item can be null if we're out of memory for whatever reason, resulting in an invalid miss.
2009-10-22 09:33:16 +00:00
wagic.jeck
34ef5016f5 Jeck - Possible fix for issue 109, issue 112. Please confirm.
* mError status was being reset properly. What I'm thinking happened is that somewhere along the line, a file would miss and return CACHE_ERROR_404. Then, cache.find() would fail because the file was not in the cache, but because mError wasn't reset it would still report CACHE_ERROR_404. In some cases, this would be overwritten (causing the flickering single frame wrong image), and in others this would erroneously report a miss. 
 * Tested through three demo games and three player games. Shop screen still shows, didn't notice any missing sounds.
2009-10-22 05:54:45 +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
97a0732682 Erwan
- Fix issue 97. Please review. How about performance ?
2009-10-15 13:58:35 +00:00
wagic.the.homebrew@gmail.com
ad1492b888 Erwan
-some small performance enhancements
2009-10-14 14:35:26 +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
wagic.jeck
405a725cd0 Jeck - Quick hack fix for cache miss recording, proving that's the source of the cache speed issue. Runs at full speed with card images and unmanaged textures... but still too slow without. I think I can clear this up in the next six hours. Hopefully :) 2009-10-13 00:43:32 +00:00
wagic.the.homebrew@gmail.com
620ea034b8 Erwan
-Issue 26: added an option for Mana Display. This needs a bit testing, but it should also lower the priority of "manapool slowness" as this mode probably fixes performance issue as well.
-I can't seem to be able to "save" some options (hand position, mana display) ion the windows version, does this change break something ?
2009-10-04 06:01:00 +00:00
wagic.the.homebrew@gmail.com
888edfd5b8 Erwan
-more JGE cleanup
-removed calls to BindTexture that were made out of the Render methods. Please let me know if this has side effects (and let's discuss it in that case)
-Still no luck with the purple screen bug :(
2009-10-03 08:50:44 +00:00
wagic.jeck
f922c21ad2 Jeck - Cache misses report CACHE_ERROR_404. This allows alternate card renders to display steadily (that is, without reverting to cardback) in deck viewer. 2009-09-27 02:55:59 +00:00
wagic.jeck
28cb659a2e Jeck - Restored cache resets between game states, fixed minor issue with deck editor displaying the wrong first 7 cards when starting to edit a deck. 2009-09-27 00:50:30 +00:00
wagic.jeck
2020dce4fd Jeck - unsigned/signed fix, options fixes
* Abstracted out option calls to "f3" behind Constants::OPTION_FONT
 * Added option to disable card image loading.
2009-09-24 23:26:32 +00:00
wagic.jeck
d9786dfdc2 Jeck - (Probable) fix for issue 41. Turns out AttachZipFile is very robust, and already handles all the unattach / reattach optimizing & checking for us. 2009-09-22 05:33:01 +00:00
wagic.jeck
6de4f5612e Jeck - Resource manager zipfile fix.
* Only attaches when necessary.
2009-09-21 06:59:28 +00:00
wagic.jeck
e2adadd1bd Jeck - Re-enable sound effects. 2009-09-21 00:37:31 +00:00
wagic.jeck
8c9374fe1f Jeck - GameStateMenu releases background image from cache, minor cache fixes. 2009-09-20 23:56:08 +00:00
wagic.jeck
e0b225bad9 Jeck - TEMPORARY enabling of exceptions. (~6hrs) Sorry, I've been an idiot lately and coded myself into a corner with stuff that "should only take a minute" to fine tune. I honestly shouldn't have committed r871+, but I'd sworn to high heaven that the damn thing was fixed. In reality getting the cache 100% needs a bit more time, so I'm committing this in the hopes that it'll prevent sloppy cache work from interrupting other people's coding.
Exception handling in the cache means that Wagic runs slightly, but noticeably slower. However, it also means that the cache works the way it was intended to, and should prevent all sorts of awkward errors I introduced because things were half-allocated or worse. 

I've learned my lesson from tonight, and once I get this stuff put back together without exception handling I think I'll self-impose a manditory 24 hours debugging time before any commits. Sorry for the inconvenience. 

If for some reason you can't compile with exceptions, r862 should be completely without them. Again, wow, this was stupid-- I hadn't even realized exceptions were off for like 24 hours, as the compiler wasn't producing warnings. 

Apologies,
—Jeck
2009-09-20 03:10:34 +00:00
wagic.jeck
00c5b8cd7d Jeck - CACHESIZE option does something again. 2009-09-20 00:39:55 +00:00
wagic.jeck
1689edc69b Jeck - Cleanup some debug messages, cache now clears unlocked items between states. 2009-09-20 00:05:23 +00:00