In F-Zero X's US build, Racer_InitRacer sets a machine's energy and maxEnergy from gBodyHealthValues by its body grade (BODY_STAT): 190 for grade A, 178 for B, 166 for C, 154 for D, and 142 for E, so a racer starts each race with a full meter. In Death Race (GAMEMODE_DEATH_RACE), Racer_Init then halves both values for every racer after gRacers[0], which holds player 1's machine, so the other machines run on half a meter (71 to 95). | src/game/racer.c L440–442include/fzx_racer.h L58–64src/game/racer.c L1660src/game/racer.c L1823–1828src/game/racer.c L862–866 | Code |
In F-Zero X's US build, Racer_ReceiveDamage subtracts the damage it's given from energy, unless the machine is crashed or has finished (RACER_STATE_CRASHED, RACER_STATE_FINISHED). If that takes the energy below 0, a machine whose machineLod is 0 is set to 0.1 instead, and nothing else happens; Racer_Draw sets that field to 0 for a machine outside the camera's view (behind it, more than 2500 ahead, or off the screen's edges), and Racer_Update sets every machine's to 1 when more than one player is racing. Any other machine is set to 0 and, unless already crashed or spinning out, put into the state the decompilers name RACER_STATE_SPINNING_OUT. Racer_HitWall deals 0.7 times the machine's speed into the wall, when that speed is above 0.01, and a landmine (within 30 units of the machine) deals 12.5. | src/game/racer.c L2240src/game/racer.c L2292–2316src/game/racer.c L5609–5618src/game/racer.c L5094–5097src/game/racer.c L2353–2366src/game/racer.c L3641–3646 | Code |
In F-Zero X's US build, pressing B starts a boost only when no boost is running (boostTimer is 0), energy isn't exactly 0, and the machine has RACER_STATE_CAN_BOOST. The boost sets boostTimer to 100 (sInitialBoostTimer), and on each update while it runs, the machine pays boostEnergyUsage, 0.0015 of its maxEnergy, from energy; if that takes the energy below 0, it's set to 0 and the boost ends on that update. A whole boost costs 0.15 of the meter and lasts 100 updates, about 1.7 seconds at 60 updates a second, the rate the race clock counts (computed). In a multiplayer race with the VS handicap on, the cost falls with distance behind the leader, linearly to 0.1 of it at 2000 or more behind. | src/game/racer.c L3598–3603src/game/racer.c L386src/game/racer.c L1661src/game/racer.c L4035–4071src/game/racer.c L343src/game/racer.c L4303–4305 | Code |
In F-Zero X's US build, a machine starts the race without RACER_STATE_CAN_BOOST unless the race is the title demo, Practice, or Death Race, which set it from the start. A machine starts at lap 0 with lapsCompleted 1, and lap counts up at each crossing of the line; when it reaches one more than lapsCompleted (and no more than one past the last lap), the code records the lap and sets the flag. The first crossing, at the start, brings lap to 1 and doesn't set it; completing the first lap does, so in the Grand Prix and VS races boosting opens from the second lap (computed from the counters). | src/game/racer.c L1580–1590src/game/racer.c L1614–1625src/game/racer.c L4309–4314 | Code |
In F-Zero X's US build, on each update that a machine is on a pit surface (COURSE_EFFECT_PIT) and isn't crashed, airborne, or spinning out, it gains energyIncrease, 0.008 of its maxEnergy (sEnergyRefillScale), up to the maximum. An empty meter refills in 125 updates, about 2.1 seconds at 60 updates a second (computed). | src/game/racer.c L387src/game/racer.c L1666src/game/racer.c L4482–4487 | Code |
In F-Zero X's US build, when two machines first touch and one belongs to a human player, the other records that player as its last contact (unk_28C) and resets a counter (unk_288) that counts up on each update while the machine isn't crashed, finished, or falling off the track, the race intro timer (gRaceIntroTimer) is under 40, and the mode isn't GAMEMODE_RECORDS. When damage puts a machine into its spin-out, func_8008DBB8 credits that player if the contact was no more than 60 updates before and the player isn't finished, retired, or spinning out: it adds to gRacersKOd (by the atlas's reading of the name, a count of knock-outs), and in the Grand Prix the fifth (gRacersKOd == 5) gives player 1 a life. The player gains an eighth of their maxEnergy (energyRegain), added on the next update they aren't crashed or spinning out, up to the maximum. | src/game/racer.c L5148–5156src/game/racer.c L4298–4302src/game/racer.c L2315–2320src/game/racer.c L2196–2221src/game/racer.c L5085–5091 | Code |
In F-Zero X's US build, when two machines first touch, the impact is 1.1 times their closing speed along the line between them. If neither is attacking (attackState, whose states the decompilers name side and spin attacks), each takes that impact times the other's share of their two collidingStrengths, a number set from body grade and weight, with a crashed machine's strength counted at a third (0.333). If only one is attacking, the other takes the whole impact, and ten times the impact when the attacker is gRacers[0] in a one-player race; the pair loop always puts the lower-numbered racer second, so player 1's machine is the attacker in that test whenever it attacks. If both attack, each takes its share as if neither were. | src/game/racer.c L5107src/game/racer.c L5132–5144src/game/racer.c L5168–5172src/game/racer.c L5186–5201include/fzx_racer.h L89–91src/game/racer.c L1641–1642 | Code |
In F-Zero X's US build, on each update that a machine isn't crashed and is on a dash surface (COURSE_EFFECT_DASH), and B isn't starting a boost, the code holds A for it, sets RACER_STATE_DASH_PAD_BOOST, and sets boostTimer to 100, so a dash plate starts a boost or tops a running one back up. While that flag is set the boost costs no energy, and the boost multiplies the machine's two acceleration terms by at least unk_1C4, a value set with grade C's boost number (0.204, D_800CF174[2]), where a B boost uses unk_1C0, set with the machine's own boost grade. | src/game/racer.c L3608–3621src/game/racer.c L4035–4043src/game/racer.c L4073–4074src/game/racer.c L1538–1540src/game/racer.c L444–446 | Code |
In F-Zero X's US build, the machine-settings screen holds each player's engine setting (gPlayerEngine) between 0 and 1, set to 0.5 when the screen opens, except in GAMEMODE_LX_GP_RACE_NEXT_MACHINE_SETTINGS, which keeps the previous setting; in one-player races on the built-in courses, player 1's is then set to the character's last setting. The stick moves it by the square of 0.003 times its x position per update; with the stick under that threshold (a square below 0.001), D-pad left or right moves it by 1/128. The screen draws it with a texture the decompilers name aMachineAccelerationMaxSpeedTex. At the race, func_8008960C, x ↦ 1/(1.69/x − 0.69), maps the setting to unk_1A8, keeping 0 and 1 and taking 0.5 to about 0.37 (computed). Racer_InitMachineStats then blends nine machine values (unk_1B0, unk_1B4, unk_1B8, unk_1BC, unk_1C8, unk_1F8, unk_1FC, unk_1CC's divisor, and a term in both boost multipliers) between two ends by unk_1A8; four of the blends add 0.2 times the gap between the ends times 1 − (2s − 1)², which is 0 at either end and largest at the middle. Each end is itself a blend by the machine's weight, (weight − 780)/1560, of two numbers the function reads from fixed offsets of the cartridge ROM, from 0x078 to 0xA20 (ROM_READ), so the repo doesn't hold the values. | src/overlays/ovl_i4/machine.c L615–622src/overlays/ovl_i4/machine.c L840–863src/overlays/ovl_i4/machine.c L426–427src/game/racer.c L836–841src/game/racer.c L865src/game/racer.c L1428–1442src/game/racer.c L1536src/game/racer.c L1640–1649include/macros.h L40–41 | Code |
In F-Zero X's US build, Machine_DrawBlueFalconLod1, by its name a draw routine for the Blue Falcon, reads the word at offset 0x510 of the cartridge ROM until it has read the same value three times in a row (the first read is compared with 0). If its lowest bit is set, it counts the call (D_800CE784), and from the 13th such call it sets all five gBodyHealthValues to 1.0, the maximum energy machines are given when a race is set up, and calls func_i2_801039BC. The atlas hasn't read what the word holds on a retail cartridge. | src/overlays/ovl_i9/machine_draw.c L4941–4969src/game/racer.c L1660 | Code |