In the NTSC 1.02 version of Super Smash Bros. Melee, ftColl_80079AB0 computes a hit's knockback as capped at c_108. Every c is an unnamed field of p_ftCommonData, which Fighter_LoadCommonData loads from the disc file PlCo.dat, so the constants aren't in the code. Here d is the target's x1830_percent plus x1838_percentTemp, or, while the unnamed flag x2225_b7 is set, c_6D4 (c_6D8 if stamina_dead) plus x1838_percentTemp; n is the hit capsule's unk_count; w is the target's weight attribute times c_F4; g and b are the capsule's unnamed x24 and x2C; r is gm_8016B248(), the match rules' x30, which the VS setup in gm_1601.c sets to 0.1 × the rules' damage_ratio; and A and D are Player_GetAttackRatio for the attacker and Player_GetDefenseRatio for the target. A capsule whose unnamed x28 (k) isn't 0 uses c_118·c_110 + c_114·c_118·k in place of the percent term. The terms sit where Super Smash Bros.'s 0.1, 0.05, 1.4, 18, and its set-knockback 10 and cap 2500 do (ssb64/knockback), and the atlas reads g as the growth and b as the base by that position. Where Super Smash Bros. multiplies by its weight attribute, Melee's weight term equals c_F8 / (1 + w) (computed), so the weight divides. Of the hits a fighter logs in one update, ftColl_8007A06C keeps the largest knockback and writes it to kb_applied; ftCo_Damage_CalcKnockback then multiplies it by kb_squat_mul in ftCo_MS_Squat or ftCo_MS_SquatWait, by kb_ice_mul in ftCo_MS_DamageIce, and by kb_smashcharge_mul while a smash attack charges, rescales it with ftCo_CalcYScaledKnockback when the fighter's vertical scale isn't 1, subtracts the larger of armor0 and armor1 (plus metal_armor for a metal fighter), and raises it to kb_min if it falls below. | src/ft/ftparam.c L1451–1468 | Code |
In the NTSC 1.02 version of Super Smash Bros. Melee, ftCo_8008DCE0, the routine that puts a hit fighter into a Damage status, sets the unnamed count mv.co.damage.x0 to the knockback (kb_applied) times p_ftCommonData->x154, a value from the disc file PlCo.dat, truncated to a whole number, and to 1 if that comes to 0. It also sets the flag x221C_b6, which ftLib_IsInHitstun returns. Where Super Smash Bros. divides the knockback by 1.875 (ssb64/hitstun), Melee multiplies it by a value the code doesn't hold. The animation routines of the Damage statuses (75 to 86) and the DamageFly statuses (87 to 90) take 1 off the count while it's above 0 (ftCo_8008F744) and clear the flag once it's 0 or below; the status ends when its animation has run out with the flag clear. While the flag is set, their interrupt routines run only doIasa, as the decompilers name it, in place of the wait, fall, or hammer checks, so the fighter can't act, with one exception: after a hit whose angle ftColl_8007AC68 accepts (between unk_kb_angle_min and unk_kb_angle_max), once an unnamed countdown from c_7F0 runs out, an airborne fighter moving down can leave through an air up special (ftCo_800D69C4) or an air jump (ftCo_800CB8E0), which the atlas reads as the meteor cancel. A jump pressed in hitstun otherwise only records the count left. While the flag is set an airborne fighter gets gravity and aerial_friction (ft_80084EEC) in place of fast-fall and drift (ft_80084DB0). A change of motion state clears the flag unless the new state is entered with Ft_MF_SkipHitStun. The DamageFlyRoll status's own routines aren't read here. | src/ft/ftparam.c L1505–1508 | Code |
In the NTSC 1.02 version of Super Smash Bros. Melee, a fighter's shield_health is a float that starts at x260_startShieldHealth. Each time Fighter_procCollResolve runs for a fighter that isn't asleep (is_sleeping), a fighter whose unnamed flag x221A_b7 is clear regains c_27C, up to the start value. That flag is set when the guard statuses switch on the shield's collision (ftColl_8007B1B8), and the atlas reads it as "shield up". While it's set, the fighter instead loses c_284 × s × (1 − (l·(c_2E0 − c_2DC) + c_2DC)) + c_288, where s is x19A0_shieldDamageTaken, each shield hit's damage plus its unnamed x34 (a fighter's hit counts only while the flag x221C_b2, set on entering ftCo_MS_GuardReflect, is clear), and l is lightshield_amount. Below 0, the health is set to x280_unkShieldHealth, and on the hit path the shield break (ftCo_80098B20, which enters ftCo_MS_ShieldBreakFly) starts only in the branch taken when the fighter has no knockback to apply (kb_applied is 0), the unnamed x18a0 is 0, and a shield hit is recorded (x19A4). While the fighter holds the shield, the animation routines of ftCo_MS_GuardOn and ftCo_MS_Guard call ftCo_800925A4, which, while x221B_b0 is set, sets l from the analog trigger past its deadzone, (trigger − deadzone) / (1 − deadzone), keeping the old value when that's negative, and takes c_278 × (l·(c_2F0 − c_2EC) + c_2EC) off the health; below 0 it sets the health to 0 and starts the shield break. Every c is a field of p_ftCommonData, from the disc file PlCo.dat, so the numbers aren't in the code. Where Super Smash Bros. counts whole points from a fixed 55 and resets to 30, with no say for how hard the button is pressed (ssb64/shield), Melee's wear while held and its damage from hits both depend on l. | src/ft/ftmanager.c L431src/ft/ftmain.c L3837–3854 | Code |
In the NTSC 1.02 version of Super Smash Bros. Melee, an aerial attack (statuses ftCo_MS_AttackAirN to ftCo_MS_AttackAirLw) that touches down calls ftCo_LandingAir_EnterWithLag from its collision routine ftCo_AttackAir_Coll, through ft_80082C74, which calls it when the unnamed ft_80081D0C returns true. If the move's command script has set cmd_vars[0], which entering the aerial clears, the fighter enters that aerial's LandingAir status with the fighter's landing-lag attribute for it (landingairn_lag and the four like it), and the animation plays at a rate of (ftAnim_8006F484 + 0.1) / lag, where ftAnim_8006F484 returns the animation's end frame. If the unnamed count x67F is below c_E4 at that moment, the lag is first divided by c_E8, truncated to a whole number, and raised to 1 if that's 0; c_E4 and c_E8 are p_ftCommonData fields from PlCo.dat, so the window and divisor aren't in the code. Fighter_procInput sets x67F to 0 on an update where the HSD_PAD_LR bit is newly pressed and otherwise adds 1, up to 255. That bit is on while L or R is held, while the analog trigger is past its deadzone, or while Z is held unless gm_GetDbPauseFlag(0) is true, and it's off while the unnamed gm_8016B0FC is true. Without cmd_vars[0], the fighter takes the basic landing (ftCo_Landing_Enter_Basic). Super Smash Bros. reads the same moment differently (ftCommonAttackAirProcMap): when the aerial's flag1 is clear or Z was pressed no more than 10 counts before (tics_since_last_z ≤ 10), it skips the aerial's landing lag outright, landing in Wait if the air speed is above −20 and in Landing otherwise, where Melee divides the lag. | src/ft/ftcommon/ftcommonattackair.c L53–74src/ft/ftcommon.h L361–362src/ft/ftmain.c L1373–1380src/ft/ftcommon/ftcommonattackair.c L190 | Code |
In the US version of Super Smash Bros., ftParamGetCommonKnockback computes a hit's knockback as times an attacker and a defender factor from a handicap table. Here d is the target's damage percent plus damage_queue, the damage queued against it, which ftMainProcParams adds to the percent and then clears; h is the hit's damage; w is the target's weight attribute, which the decompilers comment "Or, rather, \"knockback multiplier\""; g and b are the hit's knockback_scale and knockback_base; and r is the battle's damage_ratio. A hit with a nonzero knockback_weight k puts 1 + 0.5k in place of the d term, the value that term takes at d = 10 and h = k (computed), so that launch doesn't grow with the percent. The result is capped at 2500. Of the hits a fighter takes together, ftMainProcessHitCollisionStatsMain keeps the largest knockback, and ftMainProcParams multiplies it by 2/3 while the fighter is crouching (nFTCommonStatusSquat or nFTCommonStatusSquatWait) and subtracts the larger of two knockback-resistance values, down to 0. | src/ft/ftparam.c L1451–1468src/ft/ftmain.c L2699–2709src/ft/ftmain.c L2672src/ft/fttypes.h L898src/ft/ftmain.c L2845–2847src/ft/ftmain.c L2990src/ft/ftmain.c L3856–3878src/ft/ftmain.c L3816src/ft/ftmain.c L4007 | Code |
In the US version of Super Smash Bros., when a saved error flag the decompilers name LBBACKUP_ERROR_RANDOMKNOCKBACK is set, ftParamGetCommonKnockback replaces every knockback it computes with a random value below 200. The VS mode menu sets that flag when the save's boot count is above 21 and gSYMainImemOK is false, which syMainSetImemStatus sets when the word it reads at the start of the RSP's instruction memory (SP_IMEM_START) isn't 6103. | src/ft/ftparam.c L1469–1473src/lb/lbdef.h L168src/mn/mnvsmode/mnvsmode.c L1622–1625src/sys/main.c L134–141src/sys/utils.c L172–177 | Code |
In the US version of Super Smash Bros., ftCommonDamageInitDamageVars sets a hit fighter's hitstun_tics, a whole-number count, to its knockback divided by 1.875 (ftParamGetHitStun), and to 1 if that comes to 0. The damage statuses' common update routines take 1 off the count each time they run. Until it reaches 0, their common interrupt routines don't run the standing, falling, or hammer interrupt checks (ftCommonWaitProcInterrupt, ftCommonFallProcInterrupt, and the hammer's), so the fighter can't act, and an airborne fighter gets friction in place of the usual drift and fast-fall. At 0, the status ends once its animation has run out. A knockback of 100 gives 53 counts (computed). | src/ft/ftparam.c L1505–1508src/ft/ftcommon/ftcommondamage.c L482–496src/ft/ftcommon.h L468–470src/ft/ftcommon/ftcommondamage.c L662–674src/ft/ftcommon/ftcommondamage.c L85–123src/ft/ftcommon/ftcommondamage.c L166–199src/ft/ftcommon/ftcommondamage.c L214–224 | Code |
In the US version of Super Smash Bros., ftParamUpdateDamage adds the damage a fighter takes to its percent_damage and caps it at 999. ftMainProcParams calls it with damage_queue, to which ftMainCheckGetUpdateDamage adds each hit's damage, but only inside a branch taken when the fighter's damage_knockback isn't 0, tested before knockback resistance is subtracted; there, queued damage from hits that gave no knockback isn't added. While the fighter has damage resistance (is_damage_resist), a hit's damage goes against damage_resist first, and only what passes it reaches the queue. | src/ft/ftparam.c L1527–1536src/ft/ftmain.c L3856–3878src/ft/ftmain.c L2119–2134src/ft/fttypes.h L1000 | Code |
In the US version of Super Smash Bros., ftCommonDeadCheckInterruptCommon, called from ftMainProcPhysicsMap, checks the fighter's position against the stage's bounds in the order map_bound_bottom, map_bound_right, map_bound_left, map_bound_top, and crossing one starts a Dead status. Below the bottom or past a side, the status calls ftCommonDeadUpdateScore as it starts; above the top, it's DeadUpFall if a random number is below 1/6 and DeadUpStar otherwise, and both call it from their update routines. That routine adds a KO to the score of the player recorded in damage_player, or counts a self-destruct when there is none, and under the stock rule takes one stock. The check skips the boss and fighters flagged is_ignore_dead. A fighter flagged is_limit_map_bounds, ghost or not, is moved 500 units back inside the bound it crossed and its air velocity set to 0. Otherwise ghosts are skipped, and enemy teams in the 1P Game have their own team bounds. | src/ft/ftmain.c L1739src/ft/ftmain.c L1815src/ft/ftcommon/ftcommondead.c L533–554src/ft/ftcommon/ftcommondead.c L580–586src/ft/ftcommon/ftcommondead.c L617–643src/ft/ftcommon/ftcommondead.c L166–181src/ft/ftcommon/ftcommondead.c L194–203src/ft/ftcommon/ftcommondead.c L235–244src/ft/ftcommon/ftcommondead.c L277–286src/ft/ftcommon/ftcommondead.c L318–362src/ft/ftcommon/ftcommondead.c L412–468src/ft/ftcommon/ftcommondead.c L48–78 | Code |
In the US version of Super Smash Bros., a fighter's shield_health starts at 55. In ftMainProcParams, while the fighter isn't shielding and is below 55, it regains 1 each time a 10-count wait runs out; then the damage of the hits its shield took is subtracted, each hit's damage plus its shield_damage, and at 0 or below the health is set to 30, whatever else that update does. The shield break (ftCommonShieldBreakFlyCommonSetStatus) is called only in the branch taken when the fighter has no knockback to apply (damage_knockback is 0) and its shield_damage isn't 0. While the shield is up, ftCommonGuardUpdateShieldVars takes 1 off every 16 counts (FTCOMMON_GUARD_DECAY_INT). | src/ft/ftmanager.c L431src/ft/ftmain.c L3837–3854src/ft/ftmain.c L3856src/ft/ftmain.c L3924–3929src/ft/ftmain.c L2072src/ft/ftmain.c L2264src/ft/ftmain.c L2446src/ft/ftcommon/ftcommonguard1.c L71–88src/ft/ftcommon.h L234 | Code |
In the US version of Super Smash Bros., when a fighter in an air attack lands, ftCommonAttackAirProcMap enters the move's air-landing status only when the motion's flag1 is nonzero and more than 10 counts have passed since Z was last pressed (tics_since_last_z: set to 0 on a Z press, counted up each update, and set to its maximum when the air attack starts, so a press before the attack doesn't count); otherwise it skips that status and enters Wait if the fighter's vertical speed is above −20, or the plain Landing status if not. Reading flag1 as the move's switch for landing lag is the atlas's. | src/ft/ftcommon/ftcommonattackair.c L53–74src/ft/ftcommon.h L361–362src/ft/ftmain.c L1373–1380src/ft/ftcommon/ftcommonattackair.c L202 | Code |