Coin limit: Difference between revisions

Jump to navigation Jump to search
m
Changed code to match decomp
mNo edit summary
m (Changed code to match decomp)
Line 1: Line 1:
{{rewrite}}
{{rewrite}}
Note: Code shown in this section is recreated and may not be the exact code used by the game
A '''coin limit''' is the maximum number of coins that can be collected or saved in a given area. Some courses allow infinite coins to be collected. However, in the NTSC (American) version, the coin counter is programmed to stay at the maximum of 999.
A '''coin limit''' is the maximum number of coins that can be collected or saved in a given area. Some courses allow infinite coins to be collected. However, in the NTSC (American) version, the coin counter is programmed to stay at the maximum of 999.


Line 8: Line 6:
==The 999 coin limit==
==The 999 coin limit==
The limit is intentionally put in by the programmers to prevent the game to count up coins greater than 999:
The limit is intentionally put in by the programmers to prevent the game to count up coins greater than 999:
 
  if (gMarioState->numCoins > 999) {
  if(coin_counter > 999) {
    gMarioState->numCoins = 999;
coin_counter := 999;
  }
  }
 
When Mario reaches the 999 coin limit, the coins are no longer counted and collecting a coin only makes noise if the value of the global timer is odd.
==The 255 coin limit==
==The 255 coin limit==
Separately, there is an unintentional coin limit involving the saved coin score. This value overflows and is set to 0 if the number of coins Mario collected in the course is a multiple of 256. (Not within the course, but when recording the saved coin score after Mario exits the course.) Thus, the easiest way to obtain the highest possible saved coin score in a level is to simply collect 255 coins. 511 and 767 also produce a saved coin score of 255, but collecting more than 255 coins is not as efficient as collecting a star when 255 coins have been collected. 1,023, 1,279, etc. also save as 255, but these coin scores cannot be obtained in the NTSC version.
Separately, there is an unintentional coin limit involving the saved coin score. This value overflows and is set to 0 if the number of coins Mario collected in the course is a multiple of 256. (Not within the course, but when recording the saved coin score after Mario exits the course.) Thus, the easiest way to obtain the highest possible saved coin score in a level is to simply collect 255 coins. 511 and 767 also produce a saved coin score of 255, but collecting more than 255 coins is not as efficient as collecting a star when 255 coins have been collected. 1,023, 1,279, etc. also save as 255, but these coin scores cannot be obtained in the NTSC version.
Line 27: Line 24:
In the Japanese version, there is no coin limit within the courses. When the coin counter reaches a value of 1,000, the game runs a few lines of code wherein there is a typo:
In the Japanese version, there is no coin limit within the courses. When the coin counter reaches a value of 1,000, the game runs a few lines of code wherein there is a typo:


  if(coin_counter > 999) {
 
lives_counter := 999;
  if (gMarioState->numCoins > 999) {
    gMarioState->numLives = (s8) 999; //! Wrong variable
  }
  }


This should be the following:
This should be the following:


  if(coin_counter > 999) {
  if (gMarioState->numCoins > 999) {
coin_counter := 999;
    gMarioState->numCoins = 999;
  }
  }


Line 43: Line 41:
==References==
==References==
<references/>
<references/>
[[Category:Mechanics]]

Navigation menu