Commit Graph

70 Commits

Author SHA1 Message Date
Tobias Loose
9ee44ca091 Substitute more char arrays with strings 2013-11-29 11:51:22 +01:00
xawotihs
a695323bc7 Merge pull request #564 from ZobyTwo/cleanup_1
Add a few namespaces and fix header guards.
2013-11-25 15:42:18 -08:00
Tobias Loose
e0428ac7b0 Avoid more conflicts. We could now do unit builds...
and make the linker put every data element and function into its own section.
On linktime, we can output every discarded section and get a list of dead
code (for that build).
2013-11-23 17:04:24 +01:00
citiral
73c2d17080 Updated deckmenu.cpp to properly render deck description and summary
Deck description and statistics were being drawn as black text, this made it invisible as it was rendered over a black background. I made it change the color to white before drawing, so its shown as its suposed to be.(Did the default text color change?)
2013-11-21 20:38:41 +01:00
Xawotihs@gmail.com
26ab65860e Fixed a gazillion of warnings occuring when compiling Wagic with Clang with Werror. 2013-06-09 21:16:39 +00:00
omegablast2002@yahoo.com
eaf4d94a2e this part didnt commit in last rev, it fixes the mana display.
the progress is removed on this though, so you might not notice it until next release when you do a fresh install.
any new decks for both player or ai will show the mana symbols after a match is completed.
2013-01-27 19:35:52 +00:00
techdragon.nguyen@gmail.com
57627849a0 modified font size of text in menus.
Adjusted the spacing between menu items on all menus. They were a little too far apart once I modified the font size.
fixed Hollowhenge Spirit
2012-03-20 08:35:38 +00:00
omegablast2002@yahoo.com
97bd418aac in this commit, if we move a card from the library to the library then we were intending on placing that card on top of the library.
taught ai when not to play a planeswalker, told ai to look for planeswalkers as a card type to play.
fixed a crash related to tokens and cardgui..tokens dont have models....
made a 1 line change to deckveiwer that makes it usable on touch devices and improves the overall look and feel of deckveiwer....
2012-03-13 16:20:19 +00:00
techdragon.nguyen@gmail.com
8468505f1e fixed deck name display for when "Random" player deck is chosen. 2012-02-20 07:32:14 +00:00
techdragon.nguyen@gmail.com
969e6ac5e6 added more buttons to deck editor to cover all the functionality. Need to remove the PSP directions from the slide-in menus 2012-01-30 04:23:11 +00:00
techdragon.nguyen@gmail.com
05e3c350b3 had to undo my refactoring of the menuitem classes. for some reason it broke scrolling on the opponent ai selection screens. 2012-01-29 17:01:48 +00:00
techdragon.nguyen@gmail.com
a36d886dd5 Added first draft of an interactive button. Needs to handle addition of images a little better
refined detailed info window for stats display
removed PSP button for Touch interfaces (currently only iOS and Android) on deck selection screens
to not break the core engine and reduce some more complex code, I created a new vector in the JController object. mButtons.  This vector will contain all the valid buttons for a given screen.  The appropriate Add/Remove methods have been updated to account for this new vector.
2012-01-25 18:35:24 +00:00
techdragon.nguyen@gmail.com
519cd3bd69 refactored DeckMenuItem to be a derived class of SimpleMenuItem. Not sure why I had made them distinct.
TODO: review DeckMenu and SimpleMenu to see if it would be better to have them derive from a base class rather than be distinct.
2012-01-23 08:39:18 +00:00
Xawotihs
f68c106e7e - Modified gameObserver and related classes to be able to work with a precise JGE instance given at construction and not the static global one. That allows to run gameObserver without JGE instance (for example in a worker thread).
- Added an "ACTION_LOGGING_TESTING" mode in the gameObserver. When this is defined, the game reloads itself in every update. I want to use that to track undo problems. Be aware that it kills performances and crashes with the testsuite if you want to activate it.
- Various cleanup/refactor of the game observer.
- Added a gameObserver == operator to compare two games
- Added player mode to the player serialization
- Added a multi-threaded mode to AI_CHANGE_TESTING. For the moment it's only useable with Qt. If you want to use it without, just defined a thread_count higher than 1.
- Refactored random generator class to use list intead of queue
- Defined a specific type for interrupt decision instead of int
2011-11-13 22:36:34 +00:00
Xawotihs
c3dc51aed1 I just played 3 long games and I was able to undo two fully and got an assert on the third one after more than 1000 actions... so I commit what I have:
- Modified undo to stop at "next phase" action
- Added "muligan" and "force library shuffling" to the list of logged action
- Fixed random logging
- Fixed double logging of actions
- Merged all the "next game" functions into a single one
- Created a PlayerType type instead of using int
- Moved the player loading code into the GameObserver and out of GameStateDuel to avoid having player references in both and simplify the initialization and termination. Tweeked a bit the humanplayer class to be able to do that.
- Added a "load" menu available in testsuite mode, I use that to load problematique game. To use it, just copy-paste a game from the traces into Res/test/game/timetwister.txt. Game in traces starts by "rvalues:..." and ends by "[end]"
- Added some untested and commented out code in GuiCombat to use the mouse/touch to setup the damage on the blockers
- Broke the network game ... hoh well, I'll repair it when everything else works !!
- various code cleanup and compilation fixes on Linux
2011-10-26 22:14:12 +00:00
wagic.the.homebrew
9d9db7198e Additional tweak for issue 693: reduce the size of some background images. I think the visual result is still ok. The images go from 480x272 to 450x255, and end up taking twice as less space in ram (512x256 instead of 512x512).
This helps a lot in the deck selection menus (duel and deck editor).
That, added to my previous fix, fixes issue 693 for me.
In general, we should try to avoid 512x512 32bits textures on the PSP. That happens with a 480x272 png image. One solution is to convert the file to a jpeg, and load it in 551 mode whenever possible. Another solution is what I did: use a 450x255 image instead. The best is of course to cumulate both, which divides the size in Ram by 4 on the PSP.
I'm ok with distributing lower res graphics on the psp, and higher res on other platforms, if that helps. Main culprits are 480x272 images (when there's too many of them)
2011-07-11 14:34:12 +00:00
wrenczes@gmail.com
c5963c3c23 Three improvements involving image caching:
1) prevent the textureQuad map from containing references to cards when we're returning a temp (card backdrop) image in the threaded version.
2) we had two copies of the pspicon image in the cache (ie the regular & managed).  Changed the reference in the DeckMenu code to use the managed instance.
3) Fixed a problem with a default constructor param that would set RESOURCE_LOCKED on certain images.  I noticed that the 'NEW' image was locking itself in the cache because no resource modes was being passed in, so the default constructor param was setting it to locked.  This seems like a bad idea - if you're not explicitly locking a resource in the call, that shouldn't be the default behaviour.

Also added an assert safeguard to catch the possibility of 'overlocking' an image resource, as this probably means the image fetching routine is being abused somehow.
2011-07-07 07:37:17 +00:00
techdragon.nguyen@gmail.com
8ed84aa97d Issue 634:
Fixed.  Had to clear the DeckManager whenever the player deck selection screen is displayed.
TODO: Need to implement a caching mechanism that caches the deck information based on deck selection and not a global one.
Currently DeckManager is effectively treating the DeckMetaData as global data.

*some minor tweaks to how deck information is managed/created
2011-04-21 08:32:32 +00:00
omegablast2002@yahoo.com
561054ba34 added a true method to recycle our 100 avatar images, and made sure they stay in line with the menu image if theyre over 100. 2011-04-20 21:21:12 +00:00
wrenczes@gmail.com
f805d195ad Fixed the build. 2011-04-20 21:07:44 +00:00
omegablast2002@yahoo.com
b2ef742ec8 ok made minor changes to mikes last commit, instead of loading "nothing" im making it load a card back instead, that black hole drove me nuts....second instead of loading a premade "evil twin" i made it load what ever the users avatar was flipped horizontally. didn't tint it red becuase i am not that attuned to the graphics side of wagic. 2011-04-20 20:24:53 +00:00
techdragon.nguyen@gmail.com
2fdc80aee1 Synchronized avatar images to be loaded correctly on first display of the opponent selection.
* changed how the avatar images are assigned since how they were before was incorrect.  They are now assigned upon instantiation of the meta file.  Not when the stats are calculated.  
* Added new image for "Evil Twin".  This is a horizontally flipped image of the original player avatar with a red background.  Please feel free to edit the image.
* removed display of avatar image on menu items in deck selection that are not deck related. (ie "Cancel", "Back to Main Menu", etc)  "New Deck" also does not have an image since no deck really exists yet so no avatar.  

Issue: 622
2011-04-20 17:51:40 +00:00
wagic.the.homebrew@gmail.com
1343852bc1 - Update French translation
- Added call to translation function for some parts where it was missing
2011-04-09 10:41:36 +00:00
techdragon.nguyen@gmail.com
16f7d2d675 added conditional to avoid having to ping the stats map all the time. The data
is already cached, but there's no need to spend a function call to check the hashmap
if we have a bool for that reason.
2011-02-14 17:38:57 +00:00
techdragon.nguyen@gmail.com
93c63cef3d reimplemented mana color display for deck selection. This is now totally controlled by
stats generation.  No data needs to be written to the deck master files themselves.
Now the mana colors will only show if you have battled with a particular deck at least once.
This is not retroactive, so you will need to battle the ai again.  This can not be edited manually
either to prevent tampering with the statistical data.  Player deck mana color display is also
covered this way.

Decks will still be saved in the new layout if a disk write is necessary.  So any changes via
the deck editor will result in a deck file rewrite is was always the case.:)
2011-02-10 17:19:11 +00:00
techdragon.nguyen@gmail.com
767983631a * moved deck saving to end of match. It now only saves when you've actually completed a game.
* added additional meta data for decks when saving them back to file.
  - decks saved this way now are split into three regions: creatures, spells and lands.  It's more for a visual sorting if a
     player wanted to look at the deck outside of the game.  It does not impact the deck loading negatively at all.  It may
     increase performance in cases where the deck was previously defined using the canonical names of the cards as the numeric ids
     reduce the work done when looking up the cards by name.
* modified ManaCost toString method.
* added toString method for ManaCostHybrid ( possibly make ManaCostHybrid a subclass of ManaCost)
* added additional operator overloading for ManaCost for printing to cover ManaCost when it's a pointer as well as a copy
   ( TODO: might want to check if making usage of ManaCost as a copy as opposed to a ptr is really necessary in most cases. )
* added alternate version of "trim" to handle trimming temporary strings as returned by things like ostringstream.str().
 - This was necessary since the PSP compiler doesn't do the necessary adjustments for those types of calls.
2011-02-04 12:37:44 +00:00
wrenczes@gmail.com
76cba56a1c Resuming on my threading support work with the card caching mechanism. This change unfortunately touches quite a few files, but I needed to get it out of the way before things got out of hand: one significant hurdle is the assumed lifetime of a JQuad pointer. In a single threaded model, the life time of the pointer is clear: you fetch it into the cache, the cache makes room, you use the pointer immediately. In a multithreaded context however, it's unsafe, as the drawing thread can request a few JQuads, and the cache operating on a separate thread can potentially bounce a JQuad out of the cache before the draw routine is done using it, which ends up in an access violation when you attempt to draw using an invalidated quad pointer. To prevent this, the bulk of this change swaps out the use of naked JQuad* pointers in the code with a JQuadPtr, which is basically a typedef to a boost shared_ptr<JQuad>.
This btw points out another circular dependancy between the texture and the JQuad - a texture owns a bunch of JQuads, yet the renderer uses JQuads and always assumes that the texture is valid.  We're going to need to add more defensiveness to JGE to protect against this.

Other changes in this check-in:  WResourceManager doesn't derive from JResourceManager anymore.  It actually didn't require anything from the base, so I killed the dependency.  Also cleaned up the notion of a WTrackedQuad in the WCachedResource - it didn't need a separate class, just a better container.

I've build this & tested against PSP, win, linux, QT (linux).  I haven't tried against iOS and QT Win, or Maemo.  If these other platforms are broken, I apologize in advance! - I'm hoping it should be fairly simple to put them back into play.
2011-02-01 10:37:21 +00:00
techdragon.nguyen@gmail.com
d9facfb73b * moved deck mana display code into separate method.
* since I rescaled the images down to 50%, I moved the display to the upper right
   info box on the last line to the right of the "# of games played" information.
   Things look like it will fit as long as the number of games is under 1000
2011-02-01 00:48:23 +00:00
techdragon.nguyen@gmail.com
6d50ddcda5 * adjusted mana icons to be 60% of the original size. The rest of the game apparently resizes the mana icons to 40% but
that makes it look a little blurred when viewed that way on the deck selection screen.
* adjusted debug message condition for the mana display
2011-01-31 16:52:01 +00:00
linshier
6bde3d0ee6 moved the translator init code earlier; added some translation support for the code of r2517 and r2907; updated some Chinese translation. 2011-01-31 14:21:46 +00:00
techdragon.nguyen@gmail.com
fdd55dc22e added more debug information to ensure correct string length of MANA meta data 2011-01-31 10:30:20 +00:00
techdragon.nguyen@gmail.com
8af5870d48 * Added new options parameter. "SaveDetailedDeckInfo". This will force the system to save all
deck files in long format.  This is not configurable from the game.  It must be set manually
     inside options.txt.
     ie.  saveDetailedDeckInfo=1

* added extra debug information (line number inside text file) when card parser fails to recognize a line.
    - modified return value from "processConfLine()" to return 0 only when a true error occurs and print out
         "MTGDeck: Bad Line:
         [<line no>]: <line with error>"
    - processConfLine will now return 1 for lines starting with "#".  Previously it returned 0 which is incorrect
         as comments should not be considered as errors.

* removed DeckMetaDataList class from code.  This was duplicating the DeckMetaData storage in DeckManager
* new feature for deck selection screens.
   - player decks will now have an indication of what mana color it consists of.
   - Ai decks will show symbols once the player has played against the AI deck at least once.
   -- This is made possible with a new meta data inside each deck file.
        MANA:<string representing color switches - 0/1 >
2011-01-31 10:04:18 +00:00
wrenczes@gmail.com
6675a7da31 Implemented a lazy load pattern for the deck stats - when the DeckMenu is displaying decks, it calls LoadStats() for only the ones visible in the list. This helps reduces the lag that occurs each time we attempt to load all the AI decks during match selection.
This still could be improved - DeckMetaData's constructor loads an MTGDeck object to parse out the name of a deck from its file.  This means that we crack open 106 files on the first attempt to show the list of opponent decks. I started optimizing this, but reverted, as the list itself is sorted alphabetically.  Currently, with these mods, it's still taking 4 1/2 seconds on my psp to load the opponent list on the first go around.

While at it, did some cleanup - removed the need for passing around a player pointer in some of the DeckStat functions, etc.
2011-01-30 13:06:21 +00:00
wrenczes@gmail.com
32cabc15c2 Forcing LF as the line ending style through SVN properties. No actual code changes here. 2011-01-28 06:00:51 +00:00
techdragon.nguyen@gmail.com
1be97b76f8 code cleanup. No code changes
- removed unused variables
- added line breaks between methods (not everywhere just where i saw it while removing unused variables)
2011-01-16 07:49:34 +00:00
wagic.the.homebrew@gmail.com
70a1a03fee Erwan - reverting r2779 per my comment in that revision 2010-12-08 14:18:41 +00:00
wrenczes@gmail.com
2a442ad2f5 Swapped the DeckMenu background from a png to a jpg, as the transparency wasn't being used at all in the image, so it wasn't buying us anything. Flipped the rendering order so that the background is now truly drawn in the background (ie first), and everything else is drawn on top.
(Make sure you update your res/graphics folder on your psp!)
2010-12-08 11:02:25 +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
96cdb7353a fixed line endings
fixed horizontal scrolling to be controlled by a function of dt as per linshier suggestion.
  * this allows compatibility for multi-byte character sets
2010-11-30 12:15:32 +00:00
techdragon.nguyen@gmail.com
0c9f5cd558 moved word wrap function from Vertical Scroller into utils.
moved MTG specific functions out of utils.cpp into AllAbilities
added word wrapping to descriptions while viewing deck information.
2010-11-29 13:38:36 +00:00
techdragon.nguyen@gmail.com
4badcc374f * modified task window to define what the bracketed numbers mean.
* modified main page banner to use actual deck names and not the filename when
   displaying stats information.
2010-11-29 12:45:48 +00:00
techdragon.nguyen@gmail.com
0856ddaeb2 added missing semicolon. missed it in the check in somehow... 2010-11-29 10:12:39 +00:00
techdragon.nguyen@gmail.com
8fd35ac513 Improved Vertical Scrolling 2010-11-28 23:54:36 +00:00
wagic.the.homebrew@gmail.com
52fce24bf8 Erwan
- Added AI Decks unlock system. Please update your graphics folder, and crossing fingers that Ilya B. is still around as I don't have the correct fonts.
2010-11-28 04:15:58 +00:00
techdragon.nguyen@gmail.com
76dc9a2379 Issue 533: restoring "glowing" effect of stars in menu items. 2010-11-27 16:57:14 +00:00
techdragon.nguyen@gmail.com
5bb435d525 restoring rendering of stars 2010-11-26 11:22:05 +00:00
techdragon.nguyen@gmail.com
e4c8469490 implemented vertical scrolling.
created new class VerticalTextScroller to handle task display in deck selection screens
modified detailed popup placement on deck selection screen to compensate for lack of border
2010-11-24 16:12:18 +00:00
techdragon.nguyen@gmail.com
e39c94756b added border to extra details popup as per design at
http://wololo.net/forum/viewtopic.php?f=37&t=2380
and
http://wololo.net/forum/viewtopic.php?f=37&t=2382
2010-11-23 14:02:02 +00:00
techdragon.nguyen@gmail.com
36d25441e2 * fixed some boundary conditions for menu initialization
* changed # victories to be calculated value
* removed nbVictories accessor
2010-11-20 10:11:06 +00:00
techdragon.nguyen@gmail.com
e0da1b2565 added override to enable details view for Player deck selection screen. 2010-11-19 06:48:51 +00:00