Repository navigation
Conversation
The level code's small rumble player next to LevelActuatorCalcPower had slot/queue names. Its table is the eight wave channels the mixer reads: the functions start a list of waves in free channels, play a numbered pattern from the level's table, stop all waves, end looping waves and test one channel. - func_L00_002D6900 actuator_play_pattern (was queue_copy_record_by_index) - func_L00_002D6998 actuator_play_waves (was slot_copy_records_to_free) - func_L00_002D6940 actuator_stop_all (was slot_clear_active_bytes) - func_L00_002D6B70 actuator_end_looping_waves (was slot_reset_active) - func_L00_002D6978 actuator_is_channel_active (was slot_is_entry_nonzero) - D_L00_0025E120 g_actuator_patterns (was g_queue_source_records) - D_L04_001B94C0 g_wave_l04_channels, D_L24_001B8500 g_wave_l24_channels (were g_free_slot_records, g_slot_entry_table): the same channel array as g_wave_l00_channels, by the address the code forms in level 04 / 24. In L00_002D67A8.c the hashed record structs become WaveRecord (a pattern entry, with its peak level) and WaveChannel (the envelope file's layout), with field names, and each function gets a comment: what a pattern index is, that the table holds 48 patterns although the bound is 0x62, that the hero's set-action functions call actuator_stop_all on every action change unless hero halfword 0x1FA is set, and that callers pass a handle actuator_end_looping_waves ignores. Checked: tools/build.py all --version us2 --strict: 28 programs OK; tools/build.py boot --version pal --strict: OK. The object of L00_002D67A8.c is byte-identical to master's; the other 155 changed C files are token-identical to master in address names (comments aside). No USA v1.01 disc to hand, so v1.01 and PAL levels were not built. Tests, tests/check_repository.py, tools/progress.py --check and tools/names.py check pass.
func_L00_002D6FD8 (was math_add_wrapping_counter) runs the level's vibration mixer, LevelActuatorCalcPower (ref_L00_002D6FD8_02 is it in all 27 USA v2.00 levels), and with the option byte set writes the pad's motor bytes at +0x188 (small) and +0x189 (large) of g_pad_state (ref_L00_002D6FD8_03 is 0x138180 in every program). The "wrapping counter" is the small motor's running sum: on each time it reaches 256, which then drops by 255, so the mixed value says how often the small motor is on. The struct view and its fields get readable names (PadMotors, small_motor, large_motor) and the externals a comment each. Checked with the branch's other commits; see the pull request.
Eighteen data symbols named as sound, HUD or effect records are wave lists for the vibration: each is only ever passed to actuator_play_waves (the WaveRecord lists it copies into the wave channels), and the handles the callers keep are what they later give actuator_end_looping_waves. They take g_<user>_rumble_waves after the function that plays them: - blitz_gun_update, bouncer_update, UpdateLockOnWeapon, charging_weapon_update, UpdateSpreadWeapon, gravity_bomb_launcher_update, megarocket_cannon_update, mini_l00_nuke_update, minirocket_tube_update, UpdateScopedWeapon, vaporizer_update; mini_l04_nuke_update's own list (g_mini_nuke_l04_rumble_waves) - lancer_update's two: g_lancer_shot_rumble_waves for a shot of MOBY_CLASS_LANCER and g_lancer_held_rumble_waves for its other class, held until the button is let go - Oozla's ferry (path_ferry_update): g_ferry_rumble_waves_a..c - Feltzin's ship (UpdateTimedTransformState, ResolveLinkedMobyMovementCollisions): g_ship_l05_rumble_waves Checked with the branch's other commits; see the pull request.
Fifteen levels have their own copy of the hero's action change, the function that keeps the last action, stops the vibration (actuator_stop_all unless hero 0x1FA is set) and switches on the new action to set it up. Level 01's is the recovered SetHeroMoveState; the others were named hero_lNN_set_action, _enter_state, _set_state, _change_action and hero_change_action. They take the style's name for a level's copy, hero_lNN_set_move_state, and their PAL and USA v2.00 versions the same plus _pal or _us2 (hero_set_move_state_us2 becomes SetHeroMoveState_us2, beside SetHeroMoveState_pal). 43 names change; the uses follow through tools/names.py rename. Checked with the branch's other commits; see the pull request.
…-all Each copy of SetHeroMoveState stops the vibration on a change of action unless the hero's halfword at 0x1FA is set. It is a timer: state 0x14 (the wrench slam) sets it to 50 as it plays its rumble on striking the ground (L00_002BA7D8.c, L13_002C5760.c, the L22 and L23 copies), and the hero's timer update counts it down (FastDecTimer in the *-timers-g8.c units), so the slam's rumble outlasts the actions that follow it. A comment above the call in all 45 copies (v1.01, PAL, USA v2.00). Checked with the branch's other commits; see the pull request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Readable names and comments for the level code's controller vibration (rumble) pattern player, next to
LevelActuatorCalcPowerinsrc/levels/shared/L00_002D67A8.c. Names and comments only, plus readable struct and field names; no code changes.func_L00_002D6900actuator_play_patternqueue_copy_record_by_indexfunc_L00_002D6998actuator_play_wavesslot_copy_records_to_freefunc_L00_002D6940actuator_stop_allslot_clear_active_bytesfunc_L00_002D6B70actuator_end_looping_wavesslot_reset_activefunc_L00_002D6978actuator_is_channel_activeslot_is_entry_nonzeroD_L00_0025E120g_actuator_patternsg_queue_source_recordsD_L04_001B94C0g_wave_l04_channelsg_free_slot_recordsD_L24_001B8500g_wave_l24_channelsg_slot_entry_tableg_wave_l04_channelsandg_wave_l24_channelsare the same eight-entryWaveChannelarray asg_wave_l00_channels, named by the address the code uses in levels 04 and 24. In every USA v2.00 level program, all five functions and the mixer use one address.Rac2Native_…_src_record/_dst_recordstructs andConditionalResetSlotbecomeWaveRecord(one wave of a pattern:WaveChannel's fields, with the peak level instead of the amplitude) andWaveChannel(the envelope file's layout).< 0x62.actuator_stop_allon every action change unless hero halfword0x1FAis set.actuator_end_looping_wavesthe handleactuator_play_wavesreturned, but it ends every looping wave.tools/names.py renamechanged the call sites (155 files acrosssrc/,src/pal,src/us2).Why: I found this while porting Going Commando's rumble to a Ratchet & Clank 1 mod. With these names, calls such as
actuator_play_pattern(18)in the hero's hit state read as rumble, not as a slot copy.Checked
python3 tools/build.py all --version us2 --strict: 28 of 28 programsOK. The five functions are inplaced.jsonas C in the levels I checked.python3 tools/build.py boot --version pal --strict:pal boot: OK.src/levels/shared/L00_002D67A8.c(the only file with more than name changes) is byte-identical to master's. I compiled both withtools/check.py: 27 of 27 places match.tools/srcnames.pyturns names back into address names, comments aside. So the objects do not depend on the release.python3 -m unittest discover -s testspasses, except three tests that need a C compiler on the host. Those fail on master the same way, and they pass in the build container.python3 tests/check_repository.py,python3 tools/progress.py --checkandpython3 tools/names.py checkpass.progress/report.jsonis unchanged.Added: four more commits
refactor(names): name the vibration's update, actuator_update
func_L00_002D6FD8(wasmath_add_wrapping_counter) is the vibration's update. It callsLevelActuatorCalcPower:ref_L00_002D6FD8_02resolves to it in all 27 USA v2.00 levels. When the option byteref_L00_002D6FD8_01[2]is set, it writes the pad's motor bytes atg_pad_state+0x188 (small) and +0x189 (large);ref_L00_002D6FD8_03is 0x138180 in every program. The "wrapping counter" is the small motor's running sum. The motor turns on each time the sum reaches 256, and the sum then drops by 255, so the mixed value sets how often the small motor is on. The hashed struct view becomesPadMotors { small_motor, large_motor }, and each external gets a comment.refactor(names): name the weapons' and vehicles' rumble wave lists
Eighteen data symbols named as sound, HUD or effect records are
WaveRecordlists. Each is only ever passed toactuator_play_waves, and the handle the caller keeps is what it later givesactuator_end_looping_waves. I checked withgit grep: no other use. They takeg_<user>_rumble_wavesafter the function that plays them:g_blitz_gun_,g_bouncer_,g_lock_on_weapon_,g_charging_weapon_,g_spread_weapon_,g_gravity_bomb_,g_megarocket_,g_mini_nuke_,g_mini_nuke_l04_,g_minirocket_,g_scoped_weapon_andg_vaporizer_rumble_waves.g_lancer_shot_rumble_waves: a shot ofMOBY_CLASS_LANCER.g_lancer_held_rumble_waves: the Lancer's other class, looping until its button is let go.g_ferry_rumble_waves_a..c: Oozla'spath_ferry_update.g_ship_l05_rumble_waves: Feltzin's ship.refactor(names): one name for the levels' copies of SetHeroMoveState
Fifteen levels have their own copy of the hero's action change: the function that ends in a switch on the new action and stops the vibration on its way in. Level 01's copy is the recovered
SetHeroMoveState. The other copies werehero_lNN_set_action,_enter_state,_set_state,_change_actionandhero_change_action; they now take the style's per-level name,hero_lNN_set_move_state. Their PAL and USA v2.00 versions get the same name plus_palor_us2.hero_set_move_state_us2becomesSetHeroMoveState_us2, next to the existingSetHeroMoveState_pal. 43 names change, all throughtools/names.py rename, and no old name is left in the repository.docs(src): say what hero 0x1FA holds back at the action change's stop-all
if (SHORT(0x1FA) == 0) actuator_stop_all();gets a comment in all 45 copies (v1.01, PAL and USA v2.00). Hero 0x1FA is a timer:L00_002BA7D8.cin itscase 0x14,L13_002C5760.c, and the L22 and L23 hero copies).FastDecTimerin the*-timers-g8.cunits).So the slam's rumble outlasts the action changes that follow it.
Checked (the whole branch, at d7bec2e)
python3 tools/build.py all --version us2 --strict: 28 of 28 programsOK.python3 tools/build.py boot --version pal --strict:OK.L00_002D67A8.candL00_002D6FD8.c, the only files with more than name changes, are byte-identical to master's. I compiled both on master and on the branch withtools/check.py; each function matched in 27 of 27 places.tools/srcnames.pyturns names back into address names, comments aside.tests/check_repository.py,tools/progress.py --checkandtools/names.py checkpass.