Displaying the large version of the card being cast

If you have a question about the git repository and the code, or if you have code to propose then please post in this forum.
Do not post request here.
Locked
Waldorf
Posts: 25
Joined: Tue Dec 30, 2008 11:22 pm

Displaying the large version of the card being cast

Post by Waldorf »

I stopped playing Magic around Fallen Empires. Therefore, many of the cards that come into play are new to me. I really need to see every card that is being played, read through the text, and decide what I want to do. Because of this, I have already made the following changes to my version of the code.
  • Added a new option to the Options menu called "Seconds to pause for an Interrupt". It currently ranges from 0 to 100 in three second jumps.
  • Changed the code that renders the Interrupt window to query the new option value and set the Interrupt countdown timer based on the new value.
  • If the "Seconds to pause for an Interrupt" is set to zero (0), the game will wait indefinitely for the player to hit the cross, circle, or square.
I also made a few cosmetic changes to the Interrupt window, like capitalizing Interrupt, removing the timer if it isn't needed, and moving the cross, square, and circle legend right up under the Interrupt prompt. Now the legend doesn't appear in the middle of the ActionStack, if more than one thing is happening. I haven't done anything yet about making the Interrupt window auto size based on the size of the ActionStack, but I plan to.

What I am trying to figure out now though, is how to make it so that a large version of the card being cast in the Interrupt window is displayed on the left side of the screen, so I can decide if I want to interrupt or not.

I notice that when I'm casting a card, since my hand is showing, the MTGGUIHand code is rendering it's large version of the card. Will I need to figure out some way to tell the MTGUIHand class that it shouldn't be rendering it's large version when an ActionStack is being rendered? Or is there some other way to manage the layering of objects such that ActionStack objects will render last, thereby overwritting anything that MTGGUIHand had rendered?
Waldorf
Posts: 25
Joined: Tue Dec 30, 2008 11:22 pm

Re: Displaying the large version of the card being cast

Post by Waldorf »

I actually managed to get this working. I did add a new public method to show and hide the GUI Hand (void MTGGUIHand::showHand(bool show)). However, I ended up not using it because when I render the card over top of the big GUI hand card, you really can't tell.

I ended up modifying Spell:Render() in ActionStack.cpp.

I'm still tweaking the code a bit and deciding how I want to handle whether or not the big card should be shown.
PiXY
Posts: 4
Joined: Wed Dec 17, 2008 7:35 pm

Re: Displaying the large version of the card being cast

Post by PiXY »

NICE changes!
The most interesting thing is the repositioning of the promps for square, triange and circle! :-)
Wolo? Would you mind importing them into the main code?
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Displaying the large version of the card being cast

Post by wololo »

Hey Waldorf, can you please PM me your changes ? Or send them to me at wagic.the.homebrew at gmail dot com ?
If they look good, I'll integrate them into the code, and/or give you write access to the SVN to do it yourself.
Waldorf
Posts: 25
Joined: Tue Dec 30, 2008 11:22 pm

Re: Displaying the large version of the card being cast

Post by Waldorf »

I don't have a problem sending you the changes, but I'd like to clean up a few things first. For example, I always display the big card no matter whether the user has big cards turned on or off. I tired making it dependent oh showBigCrads, but apparently, the class I'm trying access it in, isn't derived from the class that contains the member. I was thinking that showBigCards should probably be removed from the class and made into a Game Option that gets saved to the file every time it changes. That way, when you start a new game, it remembers your settings from last time.

Also, the Interrupt window is really bugging me that it doesn't size correctly based on the number of items in it. I finally used the Dump command to understand exactly what the mObjects[] array in ActionStack::Render(). I though it had contained a list of all the things that needed to be render, boy was I wrong. It now seems like the code that draws the window and displays the Interrupt prompt, really needs to be moved to each of the Render functions for the different types of actions, since only those classes really know how many things are going to be rendered.

I never used versions before 0.3.1, so I'm, not sure if the Interrupt window was always scr..ed up, or if it only broke after you switched your phases code from using and array to using a list.

If you don't mind that big cards always show when you cast a spell, and/or if someone else is already working on fixing the Interrupt window, then I can just send you what I have. You'll have to parse though the code and ignore all of the others changes I have been making to
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Displaying the large version of the card being cast

Post by wololo »

don't send me your code if you're not satisfied with it, we're not in a hurry anyways.

The interrupt window is messy, and definitely not very good OO design, my apologies for that. Making it a beautiful piece of OO code is in the todo list, but has not a high priority because it works with loads of black magic, and attempting to correct it will definitely mess up the game :/
One big problem is that the mObjects array contains ALL actions that happened/are going to happen this turn. This means spells that have been cancelled as well as those that have been cast correctly, and of course, those that are currently being cast. So some of them have to be displayed, others don't. This is made more complicated with the fact that what we want to display depends on the context (offer to interrupt OR spells that can target abilities)
The interrupt window size has always been bugged.
Waldorf
Posts: 25
Joined: Tue Dec 30, 2008 11:22 pm

Re: Displaying the large version of the card being cast

Post by Waldorf »

I'm glad to hear you saying it isn't good OO design. I was having trouble following the logic behind it. I know how hard it is to do good OO, that is why I believe there are very few people that should actually be allowed to create classes. I'll see what I can do about getting the window to work correctly under the current design. I'll probably duplicate code in a bunch of classes, but it seems like we do that anyways already.

Edit: One other question, what was the thinking behind the whole modal/non-modal code in the ActionStack::Render? When would each case be used?
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Displaying the large version of the card being cast

Post by wololo »

initially, modal/non modal was used to say which layer of the game was listening to user input.
The input system has changed (a lot) recently, and the changes have not be done by me so I cannot tell you anymore, but the initial system was like this (pseudo code):

So if a layer is modal, layers beyond it won't receive any user input. Again, this was the initial design, but it changed a lot

bool check_input = true
for all layers
render layer
if (check_input) check user input for this layer
if (layer->modal) check_input = false;
end

Waldorf, I contacted you by PM a few days ago and didn't get any reply... is there any chance I can see your code ? We definitely need more programmers like you and I'd like to see your code and add you to the svn write group. Thanks in advance :)
Locked