Kuribo64 Wiki
Home | ForumsLogin


Back to listing


1. Power-up IDs
2. Power-up Item IDs
3. 802D2F80 - power_up_collect
4. 80050240 - Power-up Loading Functions
5. 803B6DC0 - power_up_change_id
6. 803B93F0 - store_power
7. Power Up Subclasses
8. 803EE750 - return_current_power_up
9. Power-up Resources

Power-ups are objects in SMG2 that transform Mario into a new form.

1. Power-up IDs

Each power-up in SMG2 has its own ID, which is used by several functions in the game's code. This is a table of all the known Power-up IDs in SMG2.

Power-up ID
Normal Mario 0
Rainbow Mario 1
Fire Mario 2
Ice Mario 3
Bee Mario 4
Spring Mario 5
Boo Mario 6
Flying Mario 7
Cloud Mario 12
Rock Mario 13

2. Power-up Item IDs

Power-up item IDs differ from Mario's power-up IDs. Because all powerups except the invincibility star have the same init function, these IDs are used to determine which models and resources get loaded for a power-up item. They are also used to determine the Mario power-up id that gets loaded when the power-up is collected. Power-up item IDs are retrieved through the 27th function on the power-up's vtable. A table of object name pointers related to each ID can be found at 806495C0.

Power-up Item ID
----- 0
PowerUpHopper 1
PowerUpBee 2
PowerUpTeresa 3
PowerUpIce 4
PowerUpFire 5
PowerUpFoo 6
PowerUpCloud 7
PowerUpRock 8

3. 802D2F80 - power_up_collect

There is a function at 802D2F80 which gets called whenever a power-up is collected. It is a part of the power-up class. The most important part of it is located at 802D33D4:

802D33D4 loc_802D33D4: # CODE XREF: powerup_collect+438j
802D33D4 lwz r12, 0(r28)
802D33D8 mr r3, r28
802D33DC lwz r12, 0x74(r12)
802D33E0 mtctr r12
802D33E4 bctrl # Get the power-up item ID
802D33E8 cmpwi r3, 1
802D33EC beq spring_mushroom_collect
802D33F0 cmpwi r3, 2
802D33F4 beq bee_mushroom_collect
802D33F8 cmpwi r3, 3
802D33FC beq boo_mushroom_collect
802D3400 cmpwi r3, 4
802D3404 beq ice_flower_collect
802D3408 cmpwi r3, 5
802D340C beq fire_flower_collect
802D3410 cmpwi r3, 6
802D3414 beq red_star_collect
802D3418 cmpwi r3, 8
802D341C beq rock_mushroom_collect
802D3420 b loc_802D3458
802D3424 # ---------------------------------------------------------------------------
802D3424 spring_mushroom_collect: # CODE XREF: powerup_collect+46Cj
802D3424 bl spring_mario_load
802D3428 b loc_802D3458
802D342C # ---------------------------------------------------------------------------
802D342C bee_mushroom_collect: # CODE XREF: powerup_collect+474j
802D342C bl bee_mario_load
802D3430 b loc_802D3458
802D3434 # ---------------------------------------------------------------------------
802D3434 boo_mushroom_collect: # CODE XREF: powerup_collect+47Cj
802D3434 bl boo_mario_load
802D3438 b loc_802D3458
802D343C # ---------------------------------------------------------------------------
802D343C ice_flower_collect: # CODE XREF: powerup_collect+484j
802D343C bl ice_mario_load
802D3440 b loc_802D3458
802D3444 # ---------------------------------------------------------------------------
802D3444 fire_flower_collect: # CODE XREF: powerup_collect+48Cj
802D3444 bl fire_mario_load
802D3448 b loc_802D3458
802D344C # ---------------------------------------------------------------------------
802D344C red_star_collect: # CODE XREF: powerup_collect+494j
802D344C bl flying_mario_load
802D3450 b loc_802D3458
802D3454 # ---------------------------------------------------------------------------
802D3454 rock_mushroom_collect: # CODE XREF: powerup_collect+49Cj
802D3454 bl rock_mario_load

This code finds out which power-up Mario has collected. In order to find this information, it loads the 27th method of the power-up into the CTR and branches to it. After the function returns, the code then uses the resulting power-up item ID to index into a jump table that will come up later. If the collected power-up matches the one that it's being checked against, it branches to one of the _collect functions. These functions branch to one of many _load functions.

4. 80050240 - Power-up Loading Functions

There are several functions located at 80050240 that load the power-up that Mario has collected. Each one uses the same IDs that the power_up_collect function uses to check which power-up has been collected. It places the ID into r3 and branches to power_up_change_id.

80050240 bee_mario_load: # CODE XREF: power_up_collect:bee_mushroom_collectp
80050240 li r3, 2
80050244 b power_up_change_id
80050244 # End of function bee_mario_load
80050244 # ---------------------------------------------------------------------------
80050248 .long 0, 0
80050250 # =============== S U B R O U T I N E =======================================
80050250 spring_mario_load: # CODE XREF: power_up_collect:spring_mushroom_collectp
80050250 li r3, 1
80050254 b power_up_change_id
80050254 # End of function spring_mario_load
80050254 # ---------------------------------------------------------------------------
80050258 .long 0, 0
80050260 # =============== S U B R O U T I N E =======================================
80050260 boo_mario_load: # CODE XREF: power_up_collect:boo_mushroom_collectp
80050260 li r3, 3
80050264 b power_up_change_id
80050264 # End of function boo_mario_load
80050264 # ---------------------------------------------------------------------------
80050268 .long 0, 0
80050270 # =============== S U B R O U T I N E =======================================
80050270 ice_mario_load: # CODE XREF: power_up_collect:ice_flower_collectp
80050270 li r3, 4
80050274 b power_up_change_id
80050274 # End of function ice_mario_load
80050274 # ---------------------------------------------------------------------------
80050278 .long 0, 0
80050280 # =============== S U B R O U T I N E =======================================
80050280 fire_mario_load: # CODE XREF: power_up_collect:fire_flower_collectp
80050280 # sub_80345880+2Cp
80050280 li r3, 5
80050284 b power_up_change_id
80050284 # End of function fire_mario_load
80050284 # ---------------------------------------------------------------------------
80050288 .long 0, 0
80050290 # ---------------------------------------------------------------------------
80050290 b loc_803B6FB0
80050290 # ---------------------------------------------------------------------------
80050294 .long 0, 0, 0
800502A0 # =============== S U B R O U T I N E =======================================
800502A0 # Attributes: thunk
800502A0 sub_800502A0: # CODE XREF: sub_8030B500+34p
800502A0 b sub_803B6FF0
800502A0 # End of function sub_800502A0
800502A0 # ---------------------------------------------------------------------------
800502A4 .long 0, 0, 0
800502B0 # =============== S U B R O U T I N E =======================================
800502B0 # Attributes: thunk
800502B0 sub_800502B0: # CODE XREF: power_up_collect:loc_802D3454p
800502B0 b sub_803B7030
800502B0 # End of function sub_800502B0
800502B0 # ---------------------------------------------------------------------------
800502B4 .long 0, 0, 0
800502C0 # =============== S U B R O U T I N E =======================================
800502C0 flying_mario_load: # CODE XREF: power_up_collect:red_star_collectp
800502C0 li r3, 6
800502C4 b power_up_change_id
800502C4 # End of function flying_mario_load
800502C4 # ---------------------------------------------------------------------------
800502C8 .long 0, 0
800502D0 # =============== S U B R O U T I N E =======================================
800502D0 rainbow_mario_load:
800502D0 li r3, 7
800502D4 b power_up_change_id
800502D4 # End of function rainbow_mario_load
800502D4 # ---------------------------------------------------------------------------
800502D8 .long 0, 0
800502E0 # =============== S U B R O U T I N E =======================================
800502E0 sub_800502E0:
800502E0 li r3, 0xA
800502E4 b power_up_change_id
800502E4 # End of function sub_800502E0
800502E4 # ---------------------------------------------------------------------------
800502E8 .long 0, 0
800502F0 # =============== S U B R O U T I N E =======================================
800502F0 normal_mario_load: # CODE XREF: .text1:800723DCp
800502F0 # .text1:801C10C0p
800502F0 .set arg_4, 4
800502F0 li r3, 8
800502F4 b power_up_change_id
800502F4 # End of function normal_mario_load
800502F4 # ---------------------------------------------------------------------------
800502F8 .long 0, 0
80050300 # =============== S U B R O U T I N E =======================================
80050300 sub_80050300: # CODE XREF: .text1:8034585Cp
80050300 li r3, 0xB
80050304 b power_up_change_id
80050304 # End of function sub_80050300

5. 803B6DC0 - power_up_change_id

power_up_change_id is a function at 803B6DC0 that changes Mario's power-up ID. It gets called by the power-up loading functions.

803B6DC0 power_up_change_id: # CODE XREF: bee_mario_load+4j
803B6DC0 # spring_mario_load+4j ...
803B6DC0 stwu r1, -0x10(r1)
803B6DC4 mflr r0
803B6DC8 cmplwi r3, 0xB
803B6DCC stw r0, 0x10+arg_4(r1)
803B6DD0 bgt def_803B6DE8 # jumptable 803B6DE8 default case
803B6DD4 lis r4, jpt_803B6DE8@h
803B6DD8 slwi r0, r3, 2 # Calculate an offset into the jump table
803B6DDC addi r4, r4, jpt_803B6DE8@l
803B6DE0 lwzx r4, r4, r0
803B6DE4 mtctr r4
803B6DE8 bctr # switch 12 cases
803B6DEC normal_803B6DEC: # DATA XREF: .data5:jpt_803B6DE8o
803B6DEC bl sub_803EDFE0 # jumptable 803B6DE8 cases 0,8
803B6DF0 bl sub_803EDFD0
803B6DF4 li r4, 0
803B6DF8 li r5, 1
803B6DFC li r6, 1
803B6E00 bl store_power
803B6E04 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6E08 # ---------------------------------------------------------------------------
803B6E08 spring_803B6E08: # CODE XREF: normal_mario_load+366AF8j
803B6E08 # DATA XREF: .data5:jpt_803B6DE8o
803B6E08 bl sub_803EDFE0 # jumptable 803B6DE8 case 1
803B6E0C bl sub_803EDFD0
803B6E10 li r4, 5
803B6E14 li r5, 1
803B6E18 li r6, 1
803B6E1C bl store_power
803B6E20 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6E24 # ---------------------------------------------------------------------------
803B6E24 bee_803B6E24: # CODE XREF: normal_mario_load+366AF8j
803B6E24 # DATA XREF: .data5:jpt_803B6DE8o
803B6E24 bl sub_803EDFE0 # jumptable 803B6DE8 case 2
803B6E28 bl sub_803EDFD0
803B6E2C li r4, 4
803B6E30 li r5, 1
803B6E34 li r6, 1
803B6E38 bl store_power
803B6E3C b def_803B6DE8 # jumptable 803B6DE8 default case
803B6E40 # ---------------------------------------------------------------------------
803B6E40 boo_803B6E40: # CODE XREF: normal_mario_load+366AF8j
803B6E40 # DATA XREF: .data5:jpt_803B6DE8o
803B6E40 bl sub_803EDFE0 # jumptable 803B6DE8 case 3
803B6E44 bl sub_803EDFD0
803B6E48 li r4, 6
803B6E4C li r5, 1
803B6E50 li r6, 1
803B6E54 bl store_power
803B6E58 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6E5C # ---------------------------------------------------------------------------
803B6E5C ice_803B6E5C: # CODE XREF: normal_mario_load+366AF8j
803B6E5C # DATA XREF: .data5:jpt_803B6DE8o
803B6E5C bl sub_803EDFE0 # jumptable 803B6DE8 case 4
803B6E60 bl sub_803EDFD0
803B6E64 li r4, 3
803B6E68 li r5, 1
803B6E6C li r6, 1
803B6E70 bl store_power
803B6E74 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6E78 # ---------------------------------------------------------------------------
803B6E78 fire_803B6E78: # CODE XREF: normal_mario_load+366AF8j
803B6E78 # DATA XREF: .data5:jpt_803B6DE8o
803B6E78 bl sub_803EDFE0 # jumptable 803B6DE8 case 5
803B6E7C bl sub_803EDFD0
803B6E80 li r4, 2
803B6E84 li r5, 1
803B6E88 li r6, 1
803B6E8C bl store_power
803B6E90 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6E94 # ---------------------------------------------------------------------------
803B6E94 flying_803B6E94: # CODE XREF: normal_mario_load+366AF8j
803B6E94 # DATA XREF: .data5:jpt_803B6DE8o
803B6E94 bl sub_803EDFE0 # jumptable 803B6DE8 case 6
803B6E98 bl sub_803EDFD0
803B6E9C li r4, 7
803B6EA0 li r5, 1
803B6EA4 li r6, 1
803B6EA8 bl store_power
803B6EAC b def_803B6DE8 # jumptable 803B6DE8 default case
803B6EB0 # ---------------------------------------------------------------------------
803B6EB0 rainbow_803B6EB0: # CODE XREF: normal_mario_load+366AF8j
803B6EB0 # DATA XREF: .data5:jpt_803B6DE8o
803B6EB0 bl sub_803EDFE0 # jumptable 803B6DE8 case 7
803B6EB4 bl sub_803EDFD0
803B6EB8 li r4, 1
803B6EBC li r5, 1
803B6EC0 li r6, 1
803B6EC4 bl store_power
803B6EC8 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6ECC # ---------------------------------------------------------------------------
803B6ECC loc_803B6ECC: # CODE XREF: normal_mario_load+366AF8j
803B6ECC # DATA XREF: .data5:jpt_803B6DE8o
803B6ECC bl sub_803EDFE0 # jumptable 803B6DE8 case 9
803B6ED0 bl sub_803EDFD0
803B6ED4 lwz r3, 0x584(r3)
803B6ED8 lwz r0, 0xC(r3)
803B6EDC oris r0, r0, 1
803B6EE0 stw r0, 0xC(r3)
803B6EE4 bl sub_803EDFE0
803B6EE8 bl sub_803EDFD0
803B6EEC lwz r3, 0x584(r3)
803B6EF0 li r0, 3
803B6EF4 sth r0, 0x540(r3)
803B6EF8 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6EFC # ---------------------------------------------------------------------------
803B6EFC loc_803B6EFC: # CODE XREF: normal_mario_load+366AF8j
803B6EFC # DATA XREF: .data5:jpt_803B6DE8o
803B6EFC bl sub_803EDFE0 # jumptable 803B6DE8 case 10
803B6F00 bl sub_803EDFD0
803B6F04 bl sub_803BAE60
803B6F08 cmpwi r3, 0
803B6F0C beq def_803B6DE8 # jumptable 803B6DE8 default case
803B6F10 bl sub_803EDFE0
803B6F14 bl sub_803EDFD0
803B6F18 lwz r0, 0x6B0(r3)
803B6F1C cmplwi r0, 6
803B6F20 bne invalid_803B6F30
803B6F24 li r3, 1
803B6F28 bl sub_80023890
803B6F2C b def_803B6DE8 # jumptable 803B6DE8 default case
803B6F30 # ---------------------------------------------------------------------------
803B6F30 invalid_803B6F30: # CODE XREF: normal_mario_load+366C30j
803B6F30 bl sub_803EDFE0
803B6F34 bl sub_803EDFD0
803B6F38 lwz r0, 0x1AC(r3)
803B6F3C cmplwi r0, 3
803B6F40 ble loc_803B6F74
803B6F44 bl sub_803EDFE0
803B6F48 bl sub_803EDFD0
803B6F4C lis r4, aSe_oj_morph_it@h # "SE_OJ_MORPH_ITEM_INVALID"
803B6F50 li r5, -1
803B6F54 addi r4, r4, aSe_oj_morph_it@l # "SE_OJ_MORPH_ITEM_INVALID"
803B6F58 li r6, -1
803B6F5C bl sub_8005B3A0
803B6F60 bl sub_803EDFE0
803B6F64 bl sub_803EDFD0
803B6F68 li r4, 6
803B6F6C bl sub_803B9280
803B6F70 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6F74 # ---------------------------------------------------------------------------
803B6F74 loc_803B6F74: # CODE XREF: normal_mario_load+366C50j
803B6F74 bl sub_803EDFE0
803B6F78 bl sub_803EDFD0
803B6F7C li r0, 1
803B6F80 stb r0, 0x514(r3)
803B6F84 b def_803B6DE8 # jumptable 803B6DE8 default case
803B6F88 # ---------------------------------------------------------------------------
803B6F88 normal_803B6F88: # CODE XREF: normal_mario_load+366AF8j
803B6F88 # DATA XREF: .data5:jpt_803B6DE8o
803B6F88 bl sub_803EDFE0 # jumptable 803B6DE8 case 11
803B6F8C bl sub_803EDFD0
803B6F90 li r4, 0
803B6F94 li r5, 0
803B6F98 li r6, 0
803B6F9C bl store_power
803B6FA0 def_803B6DE8: # CODE XREF: normal_mario_load+366AE0j
803B6FA0 # normal_mario_load+366B14j ...
803B6FA0 lwz r0, 0x10+arg_4(r1) # jumptable 803B6DE8 default case
803B6FA4 mtlr r0
803B6FA8 addi r1, r1, 0x10
803B6FAC blr
803B6FAC # END OF FUNCTION CHUNK FOR normal_mario_load

This function takes the power-up item ID that was used in the 2 previous functions and uses it to calculate an offset into the jump table. The jump table is most likely a switch statement in C++. The function then loads the address at that offset in the jump table and branches to it. The functions inside the jump table are:

806C4BF8 jpt_803B6DE8: .long normal_803B6DEC # DATA XREF: normal_mario_load+366AE4o
806C4BF8 # normal_mario_load+366AECo
806C4BF8 .long spring_803B6E08 # jump table for switch statement
806C4BF8 .long bee_803B6E24
806C4BF8 .long boo_803B6E40
806C4BF8 .long ice_803B6E5C
806C4BF8 .long fire_803B6E78
806C4BF8 .long flying_803B6E94
806C4BF8 .long rainbow_803B6EB0
806C4BF8 .long normal_803B6DEC
806C4BF8 .long loc_803B6ECC
806C4BF8 .long loc_803B6EFC
806C4BF8 .long normal_803B6F88

These functions are also included in the code above. All of these functions load one of the power up IDs at the top of this page into r4 and call store_power to change Mario's form.

6. 803B93F0 - store_power

store_power is an large function located at 803B93F0. It takes the power up ID in r4 and stores it in the Mario data area. Then it loads the model for Mario's new form and changes Mario's model to that.

7. Power Up Subclasses

Because power-ups are a class, there are also several subclasses for each power-up. They create the Mario object needed and implement the function that returns their power-up item ID and the Appear function. Here is a list of where the subclasses are located.

Constructor Vtable
Fire Flower None, uses base power-up constructor and loads vtable 806A706C
Ice Flower None, uses base power-up constructor and loads vtable 800018EC
Bee Mushroom None, uses base power-up constructor and loads vtable 806B78D0
Boo Mushroom None, uses base power-up constructor and loads vtable 806B784C
Spring Mushroom None, uses base power-up constructor and loads vtable 806A70F0
Red Star None, uses base power-up constructor and loads vtable 80001834
Rock Mushroom 802D45A0 806A6FE8

Most power-up subclasses don't have their own constructor. Their object creation function just calls the base power-up constructor, and then loads the vtable for the power-up. The vtable contains a function that returns the power-up item ID and the Appear function.

However, the Rock Mushroom has its own constructor. The Rock Mushroom's constructor is here.

802D45A0 rock_mushroom_ctor:
802D45A0 .set var_4, -4
802D45A0 .set arg_4, 4
802D45A0 stwu r1, -0x10(r1)
802D45A4 mflr r0
802D45A8 lis r4, dword_806A6FBC@h # "Rock Object" (in Japanese)
802D45AC stw r0, 0x10+arg_4(r1)
802D45B0 addi r4, r4, dword_806A6FBC@l # "Rock Object" (in Japanese)
802D45B4 stw r31, 0x10+var_4(r1)
802D45B8 mr r31, r3
802D45BC bl powerup_ctor
802D45C0 lis r4, rock_mushroom_vtable@h
802D45C4 li r3, 0x128
802D45C8 addi r4, r4, rock_mushroom_vtable@l
802D45CC stw r4, 0(r31)
802D45D0 bl sub_80501850
802D45D4 cmpwi r3, 0
802D45D8 beq loc_802D45E8
802D45DC lis r4, dword_806A6FC8@h # "Rock Mario" (in Japanese)
802D45E0 addi r4, r4, dword_806A6FC8@l # "Rock Mario" (in Japanese)
802D45E4 bl rock_mario_ctor # Create a Rock Mario object
802D45E8 loc_802D45E8: # CODE XREF: rock_mushroom_ctor+38j
802D45E8 stw r3, 0xE4(r31) # Store a pointer to the Rock Mario object in this class
802D45EC mr r3, r31
802D45F0 lwz r31, 0x10+var_4(r1)
802D45F4 lwz r0, 0x10+arg_4(r1)
802D45F8 mtlr r0
802D45FC addi r1, r1, 0x10
802D4600 blr
802D4600 # End of function rock_mushroom_ctor

It calls the power-up constructor, replaces its vtable with the Rock Mushroom vtable, and creates a Rock Mario object. It stores a pointer to the Rock Mario object in its class. Here is the Rock Mushroom's vtable.

806A6FE8 rock_mushroom_vtable:.long 0 # DATA XREF: rock_mushroom_ctor+20o
806A6FE8 # rock_mushroom_ctor+28o
806A6FEC .long 0
806A6FF0 .long sub_802D4860
806A6FF4 .long rock_mushroom_init
806A6FF8 .long sub_802D27E0
806A6FFC .long sub_80237610
806A7000 .long nullsub_37
806A7004 .long sub_80237730
806A7008 .long sub_80237800
806A700C .long nullsub_53
806A7010 .long nullsub_54
806A7014 .long sub_802D28B0
806A7018 .long sub_802D2800
806A701C .long sub_802D29D0
806A7020 .long sub_802D2860
806A7024 .long sub_80237830
806A7028 .long sub_80237A00
806A702C .long sub_80237970
806A7030 .long sub_80237A50
806A7034 .long sub_80237AD0
806A7038 .long sub_802D2A20
806A703C .long sub_802D2B80
806A7040 .long nullsub_55
806A7044 .long nullsub_56
806A7048 .long sub_8004E980
806A704C .long sub_802D2DB0
806A7050 .long sub_8004E970
806A7054 .long call_powerup_collect
806A7058 .long sub_802D39B0
806A705C .long return_rock_mushroom
806A7060 .long rock_mushroom_appear
806A7064 .long sub_802D46C0
806A7068 .long sub_802D46E0

As we can see, the Rock Mushroom has added return_rock_mushroom, which returns its power-up item ID, rock_mushroom_appear, which plays its Appear animation, and a custom init function. Here is its init function.

802D4610 rock_mushroom_init: # DATA XREF: .data5:806A6FF4o
802D4610 .set var_8, -8
802D4610 .set var_4, -4
802D4610 .set arg_4, 4
802D4610 stwu r1, -0x10(r1)
802D4614 mflr r0
802D4618 stw r0, 0x10+arg_4(r1)
802D461C stw r31, 0x10+var_4(r1)
802D4620 mr r31, r4
802D4624 stw r30, 0x10+var_8(r1)
802D4628 mr r30, r3
802D462C lwz r3, 0xE4(r3) # r3 = Rock Mario Object
802D4630 lwz r12, 0(r3)
802D4634 lwz r12, 0xC(r12) # r12 = rock_mario_init
802D4638 mtctr r12
802D463C bctrl # Call rock_mario_init
802D4640 mr r3, r30
802D4644 mr r4, r31
802D4648 bl powerup_init
802D464C lwz r0, 0x10+arg_4(r1)
802D4650 lwz r31, 0x10+var_4(r1)
802D4654 lwz r30, 0x10+var_8(r1)
802D4658 mtlr r0
802D465C addi r1, r1, 0x10
802D4660 blr
802D4660 # End of function rock_mushroom_init

rock_mushroom_init first calls Rock Mario's init function, and then calls powerup_init to initialize the Rock Mushroom.

8. 803EE750 - return_current_power_up

return_current_power_up is an important function in the game. It returns Mario's current power-up ID. The game calls this function in an infinite loop to determine what Mario should be doing at any given moment. return_current_power_up is also the same function that brkirch's Spin to Fly code patches.

803EE750 return_current_powerup: # CODE XREF: sub_80388DB0+168p
803EE750 # sub_8038D2C0+14p ...
803EE750 lwz r3, 4(r3)
803EE754 lhz r3, 0x6F8(r3)
803EE758 blr
803EE758 # End of function return_current_powerup

9. Power-up Resources

Power-ups require multiple resources to be loaded before they can be used. These resources are managed by a group of setup functions that are called before any objects for the level are created. A few setup functions also deal with Mario's general resources.

FunctionAddressResource Objects
setup_FireMario 803C8200 MarioFireball
setup_BeeMario 803C8250 BeeMario, BeeMarioWing
setup_HopperMario 803C83D0 HopperMario
setup_IceMario 803C84B0 IceMario, IceStep
setup_InvincibleMario 803C85F0 InvincibleMario
setup_TeresaMario 803C86E0 TeresaMario
setup_MarioTornado 803C8720 MarioTornado
setup_BoneMario 803C87B0 BoneMario
setup_Yoshi 803C8860 Yoshi, YoshiTongue, YoshiHandL, YoshiHandR, YoshiShadow, WaterColumnSplash, YoshiArrow, YoshiArrowShadow, YoshiBalloon
setup_CloudMario 803C88D0 CloudMario, CloudMarioCap
setup_RockMario 803C89D0 RockMario
setup_MarioFace 803C8D10 MarioFace
setup_MarioHand_objects 803C9A30 MarioHandL, MarioHandR, InvincibleMarioHandL, InvincibleMarioHandR, IceMarioHandL, IceMarioHandR
setup_MarioShadow 803D25F0 MarioShadow

Some of these functions can be enabled or disabled via a set of byte flags in memory. If a function is disabled and the power-up resource objects are not loaded, then the game will crash when trying to load the power-up. Setup functions will also crash if a required file is not found on the disk. A constant pointer to the flag set can be found at [8108249C] + 0x18.

Function Flag Offset
setup_BeeMario 0
setup_HopperMario 1
setup_FireMario 2
setup_IceMario 3
setup_InvincibleMario 4
setup_TeresaMario 5
setup_MarioTornado 6
? 7
setup_Yoshi 8
? 9
setup_CloudMario A
setup_RockMario B

In addition to the resource objects loaded up in the setup functions, all power-ups also require a PowerUp.arc if the actual power-up item is going to appear in the level.

Page rendered in 0.014 seconds. (2048KB of memory used)
MySQL - queries: 17, rows: 66/66, time: 0.009 seconds.