Anodyne Wiki
Register
Advertisement
Title 50 Cards

Save file showing 50 cards. This can be achieved by saving while the Card 50 glitch is active.

Pause 50 Cards

Pause the menu showing 50 cards.

Card 50 (a.k.a. Card -1) is a glitch that allows your card count to reach 50. Note that even with 50 cards, you cannot open Card Gate 50, because it is always impossible to open, regardless of your card count. When you scroll the screen into view that holds the Card 49 chest, and the chest is empty when you do, you get Card -1. Once you have Card -1, opening the pause menu will recalculate your card count to include Card -1. This increased card count can potentially allow you to open gates earlier than you would be able to. Saving and loading causes Card -1 to be lost, but it can be regained by simply looking at the empty Card 49 chest again. Note that after saving with Card -1, your save file will report the inflated card count, but once you load the game, the card count will be back down to normal.

Technical Explanation[]

When you open a card chest, your card count is increased by 1. On the very next frame, the card is added to your inventory. This is done by running the code: global.Registry.card_states[card_index] = 1; (where card_states is an array of length 49 containing only 0's and 1's, where a 1 means you have the card). The value of card_index is determined by states.PauseState.card_data, which is a database mapping chest locations throughout the game to which card is in each chest. The Card 49 chest is not listed in the database, and so Card 49's card_index is -1, meaning it cannot be found in card_data. However, in the code that runs one frame after opening a card chest, there is a special code to check for Card 49 specifically (by checking if the chest is in the Nexus), and override the card_index to be the proper value (which is 48). In short, opening a chest does the correct thing.

The glitch happens when you scroll the chest into view. Whenever you scroll an open card chest into view, the chest makes doubly sure that you have the card that the chest contained by setting global.Registry.card_states[card_index] = 1; again. The catch is that this time, there is no special code to override card_index for the Card 49 chest, so you end up getting a card with a card_index of -1 stored in card_states. (Since Anodyne is written in Flash/ActionScript, and Array entry at -1 works like a named property with a name of "-1"; it's still there if you look for it, but it won't show up if you're only iterating from 0 to .length.) During this double-checking code, your card count is not incremented, like it is in the chest opening code.

Now you have a 1 stored at card_states[-1], but you haven't increased your card count, which is stored and managed as a separate variable. But if you simply open the pause menu, then your card count will be recalculated. This is because whenever the pause menu is opened (and many, many times while the pause menu is open), your card count is recalculated by doing a for each loop over the key/value pairs stored in card_states. A for each loop will iterate over every property of an object, even properties with names like "-1", so Card -1 is counted.

Now you have an extra card in your card count. However, this card is lost when you save your game. This is because the code that saves your game specifically iterates over the indexes of card_states from 0 to 48; it does not use a for each loop, and so does not notice the property with a name of "-1".

But there's one final catch. Both the card_states array and the card count are stored in the save file as separate values. When you look at your save file after the title screen with the option to continue or start a new game, your card count will be reported as including Card -1, even though once you load the game, the pause menu (even though it never opens) will recalculate your card count, and you will have no trace of Card -1 left.

Advertisement