diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 2e2e8828..5b2bd86e 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -1,5 +1,6 @@ import os import re +from extract_functions import * from common import * rejects = "" @@ -9,6 +10,46 @@ param_override_build = {} out_filename = 'src/pc/lua/smlua_functions_autogen.c' docs_lua_functions = 'docs/lua/functions.md' +in_files = [ + "src/audio/external.h", + "src/engine/surface_collision.h", + "src/game/camera.h", + "src/game/characters.h", + "src/game/mario_actions_airborne.c", + "src/game/mario_actions_automatic.c", + "src/game/mario_actions_cutscene.c", + "src/game/mario_actions_moving.c", + "src/game/mario_actions_object.c", + "src/game/mario_actions_stationary.c", + "src/game/mario_actions_submerged.c", + "src/game/mario_step.h", + "src/game/mario.h", + "src/game/thread6.c", + "src/pc/djui/djui_popup.h", + "src/pc/network/network_utils.h", +] + +override_allowed_functions = { + "src/audio/external.h": [ " play_", "fade" ], + "src/game/camera.h": [ "set_.*camera_.*shake" ], + "src/game/thread6.c": [ "queue_rumble_"], + "src/pc/djui/djui_popup.h" : [ "create" ], +} + +override_disallowed_functions = { + "src/audio/external.h": [ " func_" ], + "src/engine/surface_collision.h": [ " debug_" ], + "src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ], + "src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ], + "src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_" ], + "src/game/mario_actions_moving.c": [ "^[us]32 act_.*" ], + "src/game/mario_actions_object.c": [ "^[us]32 act_.*" ], + "src/game/mario_actions_stationary.c": [ "^[us]32 act_.*" ], + "src/game/mario_actions_submerged.c": [ "^[us]32 act_.*" ], + "src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed"], + "src/game/mario.h": [ " init_mario" ], +} + ########################################################### template = """/* THIS FILE IS AUTOGENERATED */ @@ -221,7 +262,21 @@ def build_binds(processed_files): ############################################################################ -def process_function(line): +def process_function(fname, line): + if fname in override_allowed_functions: + found_match = False + for pattern in override_allowed_functions[fname]: + if re.search(pattern, line) != None: + found_match = True + break + if not found_match: + return None + + if fname in override_disallowed_functions: + for pattern in override_disallowed_functions[fname]: + if re.search(pattern, line) != None: + return None + function = {} line = line.strip() @@ -246,24 +301,37 @@ def process_function(line): param['type'] = normalize_type(param_str) param['identifier'] = 'arg%d' % param_index else: - match = re.search('[a-zA-Z0-9_]+$', param_str) + match = re.search('[a-zA-Z0-9_\[\]]+$', param_str) + if match == None: + return None param['type'] = normalize_type(param_str[0:match.span()[0]]) param['identifier'] = match.group() + + # override Vec3s/f + if param['identifier'] == 'pos': + if param['type'].replace(' ', '') == 'f32*': + param['type'] = 'Vec3f' + if param['type'].replace(' ', '') == 's16*': + param['type'] = 'Vec3s' + function['params'].append(param) param_index += 1 return function -def process_functions(file_str): +def process_functions(fname, file_str): functions = [] for line in file_str.splitlines(): if reject_line(line): global rejects rejects += line + '\n' continue - functions.append(process_function(line)) + fn = process_function(fname, line) + if fn == None: + continue + functions.append(fn) - functions = sorted(functions, key=lambda d: d['identifier']) + functions = sorted(functions, key=lambda d: d['identifier']) return functions def process_file(fname): @@ -271,17 +339,16 @@ def process_file(fname): processed_file['filename'] = fname.replace('\\', '/').split('/')[-1] processed_file['extern'] = fname.endswith('.c') - with open(fname) as file: - processed_file['functions'] = process_functions(file.read()) + extracted_str = extract_functions(fname) + processed_file['functions'] = process_functions(fname, extracted_str) return processed_file def process_files(): processed_files = [] - dir_path = os.path.dirname(os.path.realpath(__file__)) + '/lua_functions/' - files = sorted(os.listdir(dir_path)) + files = sorted(in_files, key=lambda d: d.split('/')[-1]) for f in files: - processed_files.append(process_file(dir_path + f)) + processed_files.append(process_file(f)) return processed_files ############################################################################ @@ -291,8 +358,11 @@ def doc_function_index(processed_files): for processed_file in processed_files: s += '- %s\n' % processed_file['filename'] for function in processed_file['functions']: + if not function['implemented']: + continue s += ' - [%s](#%s)\n' % (function['identifier'], function['identifier']) s += '\n
\n\n' + return s def doc_function(function): diff --git a/autogen/extract_functions.py b/autogen/extract_functions.py index 11d4b547..86158c4e 100644 --- a/autogen/extract_functions.py +++ b/autogen/extract_functions.py @@ -2,67 +2,70 @@ import os import re import sys -with open('./src/audio/external.h') as file: - lines = file.readlines() +def extract_functions(filename): + with open(filename) as file: + lines = file.readlines() -# strip directives and comments -txt = '' -for line in lines: - if line.strip().startswith('#'): - continue - if '//' in line: - line = line.split('//', 1)[0] - txt += line + # strip directives and comments + in_directive = False + txt = '' + for line in lines: + if line.strip().startswith('#') or in_directive: + in_directive = line.strip().endswith('\\') + continue + if '//' in line: + line = line.split('//', 1)[0] + txt += line -while ('/*' in txt): - s1 = txt.split('/*', 1) - s2 = s1[1].split('*/', 1) - txt = s1[0] + s2[-1] + while ('/*' in txt): + s1 = txt.split('/*', 1) + s2 = s1[1].split('*/', 1) + txt = s1[0] + s2[-1] -# normalize newlines -txt = txt.replace('\n', ' ') -txt = txt.replace(';', ';\n') -txt = txt.replace('{', '{\n') -while (' ' in txt): - txt = txt.replace(' ', ' ') + # normalize newlines + txt = txt.replace('\n', ' ') + txt = txt.replace(';', ';\n') + txt = txt.replace('{', '{\n') + while (' ' in txt): + txt = txt.replace(' ', ' ') -# strip macros -txt = re.sub(r'[^a-zA-Z0-9_][A-Z0-9_]+\(.*\)', '', txt) + # strip macros + txt = re.sub(r'[^a-zA-Z0-9_][A-Z0-9_]+\(.*\)', '', txt) -# strip blocks -tmp = txt -txt = '' -inside = 0 -for character in tmp: - if inside == 0: - txt += character + # strip blocks + tmp = txt + txt = '' + inside = 0 + for character in tmp: + if inside == 0: + txt += character - if character == '{': - txt += '\n' - inside += 1 + if character == '{': + txt += '\n' + inside += 1 - if character == '}': - inside -= 1 + if character == '}': + inside -= 1 -# cull obvious non-functions, statics, and externs -tmp = txt -txt = '' -for line in tmp.splitlines(): - line = line.strip() - if '(' not in line: - continue - if ')' not in line: - continue - if '=' in line: - continue - #if '{' not in line: - # continue - if line.startswith('static '): - continue - if line.startswith('extern '): - continue - txt += line + '\n' + # cull obvious non-functions, statics, and externs + tmp = txt + txt = '' + for line in tmp.splitlines(): + line = line.strip() + if '(' not in line: + continue + if ')' not in line: + continue + if '=' in line: + continue + #if '{' not in line: + # continue + if line.startswith('static '): + continue + if line.startswith('extern '): + continue + txt += line + '\n' -# normalize function ending -txt = txt.replace(' {', ';') -print('-'* 80 + '\n' + txt) + # normalize function ending + txt = txt.replace(' {', ';') + return txt diff --git a/autogen/lua_functions/camera.h b/autogen/lua_functions/camera.h deleted file mode 100644 index bc8dfa24..00000000 --- a/autogen/lua_functions/camera.h +++ /dev/null @@ -1,3 +0,0 @@ -void set_camera_shake_from_hit(s16 shake); -void set_environmental_camera_shake(s16 shake); -void set_camera_shake_from_point(s16 shake, f32 posX, f32 posY, f32 posZ); diff --git a/autogen/lua_functions/characters.h b/autogen/lua_functions/characters.h deleted file mode 100644 index fccaae2d..00000000 --- a/autogen/lua_functions/characters.h +++ /dev/null @@ -1,6 +0,0 @@ -struct Character* get_character(struct MarioState* m); -void play_character_sound(struct MarioState* m, enum CharacterSound characterSound); -void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u32 offset); -void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags); -f32 get_character_anim_offset(struct MarioState* m); -void update_character_anim_offset(struct MarioState* m); diff --git a/autogen/lua_functions/external.h b/autogen/lua_functions/external.h deleted file mode 100644 index 635efa99..00000000 --- a/autogen/lua_functions/external.h +++ /dev/null @@ -1 +0,0 @@ -void play_sound(s32 soundBits, Vec3f pos); diff --git a/autogen/lua_functions/mario.h b/autogen/lua_functions/mario.h deleted file mode 100644 index d46280e5..00000000 --- a/autogen/lua_functions/mario.h +++ /dev/null @@ -1,44 +0,0 @@ -s32 is_anim_at_end(struct MarioState *m); -s32 is_anim_past_end(struct MarioState *m); -s16 set_mario_animation(struct MarioState *m, s32 targetAnimID); -s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel); -void set_anim_to_frame(struct MarioState *m, s16 animFrame); -s32 is_anim_past_frame(struct MarioState *m, s16 animFrame); -s16 find_mario_anim_flags_and_translation(struct Object *o, s32 yaw, Vec3s translation); -void update_mario_pos_for_anim(struct MarioState *m); -s16 return_mario_anim_y_translation(struct MarioState *m); -void play_sound_if_no_flag(struct MarioState *m, u32 soundBits, u32 flags); -void play_mario_jump_sound(struct MarioState *m); -void adjust_sound_for_speed(struct MarioState *m); -void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 waveParticleType); -void play_mario_action_sound(struct MarioState *m, u32 soundBits, u32 waveParticleType); -void play_mario_landing_sound(struct MarioState *m, u32 soundBits); -void play_mario_landing_sound_once(struct MarioState *m, u32 soundBits); -void play_mario_heavy_landing_sound(struct MarioState *m, u32 soundBits); -void play_mario_heavy_landing_sound_once(struct MarioState *m, u32 soundBits); -void play_mario_sound(struct MarioState *m, s32 primarySoundBits, s32 scondarySoundBits); -void mario_set_bubbled(struct MarioState* m); -void mario_set_forward_vel(struct MarioState *m, f32 speed); -s32 mario_get_floor_class(struct MarioState *m); -u32 mario_get_terrain_sound_addend(struct MarioState *m); -struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius); -f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil); -s32 mario_facing_downhill(struct MarioState *m, s32 turnYaw); -u32 mario_floor_is_slippery(struct MarioState *m); -s32 mario_floor_is_slope(struct MarioState *m); -s32 mario_floor_is_steep(struct MarioState *m); -f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f32 distFromMario); -s16 find_floor_slope(struct MarioState *m, s16 yawOffset); -void update_mario_sound_and_camera(struct MarioState *m); -void set_steep_jump_action(struct MarioState *m); -u32 set_mario_action(struct MarioState *m, u32 action, u32 actionArg); -s32 set_jump_from_landing(struct MarioState *m); -s32 set_jumping_action(struct MarioState *m, u32 action, u32 actionArg); -s32 drop_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg); -s32 hurt_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg, s16 hurtCounter); -s32 check_common_action_exits(struct MarioState *m); -s32 check_common_hold_action_exits(struct MarioState *m); -s32 transition_submerged_to_walking(struct MarioState *m); -s32 set_water_plunge_action(struct MarioState *m); -s32 execute_mario_action(UNUSED struct Object *o); -s32 force_idle_state(struct MarioState* m); diff --git a/autogen/lua_functions/mario_actions_airborne.c b/autogen/lua_functions/mario_actions_airborne.c deleted file mode 100644 index 053dda95..00000000 --- a/autogen/lua_functions/mario_actions_airborne.c +++ /dev/null @@ -1,20 +0,0 @@ -void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3); -void play_far_fall_sound(struct MarioState *m); -void play_knockback_sound(struct MarioState *m); -s32 lava_boost_on_wall(struct MarioState *m); -s32 check_fall_damage(struct MarioState *m, u32 hardFallAction); -s32 check_kick_or_dive_in_air(struct MarioState *m); -s32 should_get_stuck_in_ground(struct MarioState *m); -s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction); -s32 check_horizontal_wind(struct MarioState *m); -void update_air_with_turn(struct MarioState *m); -void update_air_without_turn(struct MarioState *m); -void update_lava_boost_or_twirling(struct MarioState *m); -void update_flying_yaw(struct MarioState *m); -void update_flying_pitch(struct MarioState *m); -void update_flying(struct MarioState *m); -u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation, u32 stepArg); -u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFallAction, s32 animation, f32 speed); -s32 check_wall_kick(struct MarioState *m); -s32 check_common_airborne_cancels(struct MarioState *m); -s32 mario_execute_airborne_action(struct MarioState *m); diff --git a/autogen/lua_functions/mario_actions_automatic.c b/autogen/lua_functions/mario_actions_automatic.c deleted file mode 100644 index 21fd9997..00000000 --- a/autogen/lua_functions/mario_actions_automatic.c +++ /dev/null @@ -1,12 +0,0 @@ -void add_tree_leaf_particles(struct MarioState *m); -void play_climbing_sounds(struct MarioState *m, s32 b); -s32 set_pole_position(struct MarioState *m, f32 offsetY); -s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos); -s32 update_hang_moving(struct MarioState *m); -void update_hang_stationary(struct MarioState *m); -s32 let_go_of_ledge(struct MarioState *m); -void climb_up_ledge(struct MarioState *m); -void update_ledge_climb_camera(struct MarioState *m); -void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction); -s32 check_common_automatic_cancels(struct MarioState *m); -s32 mario_execute_automatic_action(struct MarioState *m); diff --git a/autogen/lua_functions/mario_actions_cutscene.c b/autogen/lua_functions/mario_actions_cutscene.c deleted file mode 100644 index a19d1cc8..00000000 --- a/autogen/lua_functions/mario_actions_cutscene.c +++ /dev/null @@ -1,11 +0,0 @@ -void print_displaying_credits_entry(void); -void bhv_end_peach_loop(void); -void bhv_end_toad_loop(void); -void handle_save_menu(struct MarioState *m); -struct Object *spawn_obj_at_mario_rel_yaw(struct MarioState *m, s32 model, BehaviorScript *behavior, s16 relYaw); -void cutscene_take_cap_off(struct MarioState *m); -void cutscene_put_cap_on(struct MarioState *m); -u8 should_start_or_continue_dialog(struct MarioState* m, struct Object* object); -void general_star_dance_handler(struct MarioState *m, s32 isInWater); -void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFrame, s32 target2, s32 target3, s32 endAction); -void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius); diff --git a/autogen/lua_functions/mario_actions_moving.c b/autogen/lua_functions/mario_actions_moving.c deleted file mode 100644 index e49049bb..00000000 --- a/autogen/lua_functions/mario_actions_moving.c +++ /dev/null @@ -1,34 +0,0 @@ -s16 tilt_body_running(struct MarioState *m); -void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2); -void align_with_floor(struct MarioState *m); -s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg); -void check_ledge_climb_down(struct MarioState *m); -void slide_bonk(struct MarioState *m, u32 fastAction, u32 slowAction); -s32 set_triple_jump_action(struct MarioState *m, UNUSED u32 action, UNUSED u32 actionArg); -void update_sliding_angle(struct MarioState *m, f32 accel, f32 lossFactor); -s32 update_sliding(struct MarioState *m, f32 stopSpeed); -void apply_slope_accel(struct MarioState *m); -s32 apply_landing_accel(struct MarioState *m, f32 frictionFactor); -void update_shell_speed(struct MarioState *m); -s32 apply_slope_decel(struct MarioState *m, f32 decelCoef); -s32 update_decelerating_speed(struct MarioState *m); -void update_walking_speed(struct MarioState *m); -s32 should_begin_sliding(struct MarioState *m); -s32 analog_stick_held_back(struct MarioState *m); -s32 check_ground_dive_or_punch(struct MarioState *m); -s32 begin_braking_action(struct MarioState *m); -void anim_and_audio_for_walk(struct MarioState *m); -void anim_and_audio_for_hold_walk(struct MarioState *m); -void anim_and_audio_for_heavy_walk(struct MarioState *m); -void push_or_sidle_wall(struct MarioState *m, Vec3f startPos); -void tilt_body_walking(struct MarioState *m, s16 startYaw); -void tilt_body_ground_shell(struct MarioState *m, s16 startYaw); -void tilt_body_butt_slide(struct MarioState *m); -void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32 animation); -s32 common_slide_action_with_jump(struct MarioState *m, u32 stopAction, u32 jumpAction, u32 airAction, s32 animation); -s32 stomach_slide_action(struct MarioState *m, u32 stopAction, u32 airAction, s32 animation); -s32 common_ground_knockback_action(struct MarioState *m, s32 animation, s32 arg2, s32 arg3, s32 arg4); -u32 common_landing_action(struct MarioState *m, s16 animation, u32 airAction); -s32 quicksand_jump_land_action(struct MarioState *m, s32 animation1, s32 animation2, u32 endAction, u32 airAction); -s32 check_common_moving_cancels(struct MarioState *m); -s32 mario_execute_moving_action(struct MarioState *m); diff --git a/autogen/lua_functions/mario_actions_object.c b/autogen/lua_functions/mario_actions_object.c deleted file mode 100644 index 343942aa..00000000 --- a/autogen/lua_functions/mario_actions_object.c +++ /dev/null @@ -1,4 +0,0 @@ -void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction); -s32 mario_update_punch_sequence(struct MarioState *m); -s32 check_common_object_cancels(struct MarioState *m); -s32 mario_execute_object_action(struct MarioState *m); diff --git a/autogen/lua_functions/mario_actions_stationary.c b/autogen/lua_functions/mario_actions_stationary.c deleted file mode 100644 index 3ccfffbe..00000000 --- a/autogen/lua_functions/mario_actions_stationary.c +++ /dev/null @@ -1,8 +0,0 @@ -s32 check_common_idle_cancels(struct MarioState *m); -s32 check_common_hold_idle_cancels(struct MarioState *m); -void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound); -void stopping_step(struct MarioState *m, s32 animID, u32 action); -s32 landing_step(struct MarioState *m, s32 arg1, u32 action); -s32 check_common_landing_cancels(struct MarioState *m, u32 action); -s32 check_common_stationary_cancels(struct MarioState *m); -s32 mario_execute_stationary_action(struct MarioState *m); diff --git a/autogen/lua_functions/mario_actions_submerged.c b/autogen/lua_functions/mario_actions_submerged.c deleted file mode 100644 index 587461a0..00000000 --- a/autogen/lua_functions/mario_actions_submerged.c +++ /dev/null @@ -1,6 +0,0 @@ -void set_swimming_at_surface_particles(struct MarioState *m, u32 particleFlag); -u32 perform_water_step(struct MarioState *m); -u32 perform_water_full_step(struct MarioState *m, Vec3f nextPos); -s32 mario_execute_submerged_action(struct MarioState *m); -void float_surface_gfx(struct MarioState *m); -void apply_water_current(struct MarioState *m, Vec3f step); diff --git a/autogen/lua_functions/mario_step.h b/autogen/lua_functions/mario_step.h deleted file mode 100644 index 2a634f7e..00000000 --- a/autogen/lua_functions/mario_step.h +++ /dev/null @@ -1,11 +0,0 @@ -f32 get_additive_y_vel_for_jumps(void); -void mario_bonk_reflection(struct MarioState *, u32); -u32 mario_update_quicksand(struct MarioState *, f32); -u32 mario_push_off_steep_floor(struct MarioState *, u32, u32); -u32 mario_update_moving_sand(struct MarioState *); -u32 mario_update_windy_ground(struct MarioState *); -void stop_and_set_height_to_floor(struct MarioState *); -s32 stationary_ground_step(struct MarioState *); -s32 perform_ground_step(struct MarioState *); -s32 perform_air_step(struct MarioState *, u32); -void set_vel_from_pitch_and_yaw(struct MarioState* m); diff --git a/autogen/lua_functions/network_utils.h b/autogen/lua_functions/network_utils.h deleted file mode 100644 index da17db1e..00000000 --- a/autogen/lua_functions/network_utils.h +++ /dev/null @@ -1,3 +0,0 @@ -bool network_is_server(void); -u8 network_global_index_from_local(u8 localIndex); -u8 network_local_index_from_global(u8 globalIndex); diff --git a/autogen/lua_functions/surface_collision.h b/autogen/lua_functions/surface_collision.h deleted file mode 100644 index fc1ba472..00000000 --- a/autogen/lua_functions/surface_collision.h +++ /dev/null @@ -1,9 +0,0 @@ -s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius); -s32 find_wall_collisions(struct WallCollisionData *colData); -f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil); -f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo); -f32 find_floor_height(f32 x, f32 y, f32 z); -f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor); -f32 find_water_level(f32 x, f32 z); -f32 find_poison_gas_level(f32 x, f32 z); -void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Vec3f hit_pos); diff --git a/autogen/lua_functions/thread6.c b/autogen/lua_functions/thread6.c deleted file mode 100644 index 9c8d6f3b..00000000 --- a/autogen/lua_functions/thread6.c +++ /dev/null @@ -1,3 +0,0 @@ -void queue_rumble_data(s16 a0, s16 a1); -void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1); -void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1); diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 8701e127..74287c8e 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -2,14 +2,16 @@ # Supported Functions - camera.h + - [set_camera_pitch_shake](#set_camera_pitch_shake) + - [set_camera_roll_shake](#set_camera_roll_shake) - [set_camera_shake_from_hit](#set_camera_shake_from_hit) - [set_camera_shake_from_point](#set_camera_shake_from_point) + - [set_camera_yaw_shake](#set_camera_yaw_shake) - [set_environmental_camera_shake](#set_environmental_camera_shake)
- characters.h - - [get_character](#get_character) - [get_character_anim_offset](#get_character_anim_offset) - [play_character_sound](#play_character_sound) - [play_character_sound_if_no_flag](#play_character_sound_if_no_flag) @@ -18,8 +20,27 @@
+- djui_popup.h + +
+ - external.h + - [fade_volume_scale](#fade_volume_scale) + - [fadeout_background_music](#fadeout_background_music) + - [play_course_clear](#play_course_clear) + - [play_dialog_sound](#play_dialog_sound) + - [play_music](#play_music) + - [play_peachs_jingle](#play_peachs_jingle) + - [play_power_star_jingle](#play_power_star_jingle) + - [play_puzzle_jingle](#play_puzzle_jingle) + - [play_race_fanfare](#play_race_fanfare) + - [play_secondary_music](#play_secondary_music) - [play_sound](#play_sound) + - [play_sound_with_freq_scale](#play_sound_with_freq_scale) + - [play_star_fanfare](#play_star_fanfare) + - [play_toads_jingle](#play_toads_jingle) + - [sequence_player_fade_out](#sequence_player_fade_out) + - [sequence_player_unlower](#sequence_player_unlower)
@@ -54,7 +75,6 @@ - [play_mario_sound](#play_mario_sound) - [play_sound_and_spawn_particles](#play_sound_and_spawn_particles) - [play_sound_if_no_flag](#play_sound_if_no_flag) - - [resolve_and_return_wall_collisions](#resolve_and_return_wall_collisions) - [return_mario_anim_y_translation](#return_mario_anim_y_translation) - [set_anim_to_frame](#set_anim_to_frame) - [set_jump_from_landing](#set_jump_from_landing) @@ -67,7 +87,6 @@ - [transition_submerged_to_walking](#transition_submerged_to_walking) - [update_mario_pos_for_anim](#update_mario_pos_for_anim) - [update_mario_sound_and_camera](#update_mario_sound_and_camera) - - [vec3f_find_ceil](#vec3f_find_ceil)
@@ -114,14 +133,18 @@ - mario_actions_cutscene.c - [bhv_end_peach_loop](#bhv_end_peach_loop) - [bhv_end_toad_loop](#bhv_end_toad_loop) + - [common_death_handler](#common_death_handler) - [cutscene_put_cap_on](#cutscene_put_cap_on) - [cutscene_take_cap_off](#cutscene_take_cap_off) - [general_star_dance_handler](#general_star_dance_handler) - [generate_yellow_sparkles](#generate_yellow_sparkles) + - [get_star_collection_dialog](#get_star_collection_dialog) - [handle_save_menu](#handle_save_menu) + - [launch_mario_until_land](#launch_mario_until_land) + - [mario_execute_cutscene_action](#mario_execute_cutscene_action) + - [mario_ready_to_speak](#mario_ready_to_speak) - [print_displaying_credits_entry](#print_displaying_credits_entry) - [should_start_or_continue_dialog](#should_start_or_continue_dialog) - - [spawn_obj_at_mario_rel_yaw](#spawn_obj_at_mario_rel_yaw) - [stuck_in_ground_handler](#stuck_in_ground_handler)
@@ -217,13 +240,8 @@
- surface_collision.h - - [f32_find_wall_collision](#f32_find_wall_collision) - - [find_ceil](#find_ceil) - - [find_floor](#find_floor) - [find_floor_height](#find_floor_height) - - [find_floor_height_and_data](#find_floor_height_and_data) - [find_poison_gas_level](#find_poison_gas_level) - - [find_surface_on_ray](#find_surface_on_ray) - [find_wall_collisions](#find_wall_collisions) - [find_water_level](#find_water_level) @@ -243,6 +261,50 @@
+## [set_camera_pitch_shake](#set_camera_pitch_shake) + +### Lua Example +`set_camera_pitch_shake(mag, decay, inc)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mag | integer | +| decay | integer | +| inc | integer | + +### Returns +- None + +### C Prototype +`void set_camera_pitch_shake(s16 mag, s16 decay, s16 inc);` + +[:arrow_up_small:](#) + +
+ +## [set_camera_roll_shake](#set_camera_roll_shake) + +### Lua Example +`set_camera_roll_shake(mag, decay, inc)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mag | integer | +| decay | integer | +| inc | integer | + +### Returns +- None + +### C Prototype +`void set_camera_roll_shake(s16 mag, s16 decay, s16 inc);` + +[:arrow_up_small:](#) + +
+ ## [set_camera_shake_from_hit](#set_camera_shake_from_hit) ### Lua Example @@ -286,6 +348,28 @@
+## [set_camera_yaw_shake](#set_camera_yaw_shake) + +### Lua Example +`set_camera_yaw_shake(mag, decay, inc)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mag | integer | +| decay | integer | +| inc | integer | + +### Returns +- None + +### C Prototype +`void set_camera_yaw_shake(s16 mag, s16 decay, s16 inc);` + +[:arrow_up_small:](#) + +
+ ## [set_environmental_camera_shake](#set_environmental_camera_shake) ### Lua Example @@ -417,12 +501,218 @@
+--- +# functions from djui_popup.h + +
+ + --- # functions from external.h
+## [fade_volume_scale](#fade_volume_scale) + +### Lua Example +`fade_volume_scale(player, targetScale, fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| player | integer | +| targetScale | integer | +| fadeTimer | integer | + +### Returns +- None + +### C Prototype +`void fade_volume_scale(u8 player, u8 targetScale, u16 fadeTimer);` + +[:arrow_up_small:](#) + +
+ +## [fadeout_background_music](#fadeout_background_music) + +### Lua Example +`fadeout_background_music(arg0, fadeOut)` + +### Parameters +| Field | Type | +| ----- | ---- | +| arg0 | integer | +| fadeOut | integer | + +### Returns +- None + +### C Prototype +`void fadeout_background_music(u16 arg0, u16 fadeOut);` + +[:arrow_up_small:](#) + +
+ +## [play_course_clear](#play_course_clear) + +### Lua Example +`play_course_clear()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_course_clear(void);` + +[:arrow_up_small:](#) + +
+ +## [play_dialog_sound](#play_dialog_sound) + +### Lua Example +`play_dialog_sound(dialogID)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dialogID | integer | + +### Returns +- None + +### C Prototype +`void play_dialog_sound(u8 dialogID);` + +[:arrow_up_small:](#) + +
+ +## [play_music](#play_music) + +### Lua Example +`play_music(player, seqArgs, fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| player | integer | +| seqArgs | integer | +| fadeTimer | integer | + +### Returns +- None + +### C Prototype +`void play_music(u8 player, u16 seqArgs, u16 fadeTimer);` + +[:arrow_up_small:](#) + +
+ +## [play_peachs_jingle](#play_peachs_jingle) + +### Lua Example +`play_peachs_jingle()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_peachs_jingle(void);` + +[:arrow_up_small:](#) + +
+ +## [play_power_star_jingle](#play_power_star_jingle) + +### Lua Example +`play_power_star_jingle(arg0)` + +### Parameters +| Field | Type | +| ----- | ---- | +| arg0 | integer | + +### Returns +- None + +### C Prototype +`void play_power_star_jingle(u8 arg0);` + +[:arrow_up_small:](#) + +
+ +## [play_puzzle_jingle](#play_puzzle_jingle) + +### Lua Example +`play_puzzle_jingle()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_puzzle_jingle(void);` + +[:arrow_up_small:](#) + +
+ +## [play_race_fanfare](#play_race_fanfare) + +### Lua Example +`play_race_fanfare()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_race_fanfare(void);` + +[:arrow_up_small:](#) + +
+ +## [play_secondary_music](#play_secondary_music) + +### Lua Example +`play_secondary_music(seqId, bgMusicVolume, volume, fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| seqId | integer | +| bgMusicVolume | integer | +| volume | integer | +| fadeTimer | integer | + +### Returns +- None + +### C Prototype +`void play_secondary_music(u8 seqId, u8 bgMusicVolume, u8 volume, u16 fadeTimer);` + +[:arrow_up_small:](#) + +
+ ## [play_sound](#play_sound) ### Lua Example @@ -438,7 +728,107 @@ - None ### C Prototype -`void play_sound(s32 soundBits, Vec3f pos);` +`void play_sound(s32 soundBits, f32 *pos);` + +[:arrow_up_small:](#) + +
+ +## [play_sound_with_freq_scale](#play_sound_with_freq_scale) + +### Lua Example +`play_sound_with_freq_scale(soundBits, pos, freqScale)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundBits | integer | +| pos | [Vec3f](structs.md#Vec3f) | +| freqScale | number | + +### Returns +- None + +### C Prototype +`void play_sound_with_freq_scale(s32 soundBits, f32* pos, f32 freqScale);` + +[:arrow_up_small:](#) + +
+ +## [play_star_fanfare](#play_star_fanfare) + +### Lua Example +`play_star_fanfare()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_star_fanfare(void);` + +[:arrow_up_small:](#) + +
+ +## [play_toads_jingle](#play_toads_jingle) + +### Lua Example +`play_toads_jingle()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_toads_jingle(void);` + +[:arrow_up_small:](#) + +
+ +## [sequence_player_fade_out](#sequence_player_fade_out) + +### Lua Example +`sequence_player_fade_out(player, fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| player | integer | +| fadeTimer | integer | + +### Returns +- None + +### C Prototype +`void sequence_player_fade_out(u8 player, u16 fadeTimer);` + +[:arrow_up_small:](#) + +
+ +## [sequence_player_unlower](#sequence_player_unlower) + +### Lua Example +`sequence_player_unlower(player, fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| player | integer | +| fadeTimer | integer | + +### Returns +- None + +### C Prototype +`void sequence_player_unlower(u8 player, u16 fadeTimer);` [:arrow_up_small:](#) @@ -2034,6 +2424,28 @@
+## [common_death_handler](#common_death_handler) + +### Lua Example +`local integerValue = common_death_handler(m, animation, frameToDeathWarp)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| animation | integer | +| frameToDeathWarp | integer | + +### Returns +- integer + +### C Prototype +`s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWarp);` + +[:arrow_up_small:](#) + +
+ ## [cutscene_put_cap_on](#cutscene_put_cap_on) ### Lua Example @@ -2118,6 +2530,26 @@
+## [get_star_collection_dialog](#get_star_collection_dialog) + +### Lua Example +`local integerValue = get_star_collection_dialog(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- integer + +### C Prototype +`s32 get_star_collection_dialog(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ ## [handle_save_menu](#handle_save_menu) ### Lua Example @@ -2138,6 +2570,69 @@
+## [launch_mario_until_land](#launch_mario_until_land) + +### Lua Example +`local integerValue = launch_mario_until_land(m, endAction, animation, forwardVel)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| endAction | integer | +| animation | integer | +| forwardVel | number | + +### Returns +- integer + +### C Prototype +`s32 launch_mario_until_land(struct MarioState *m, s32 endAction, s32 animation, f32 forwardVel);` + +[:arrow_up_small:](#) + +
+ +## [mario_execute_cutscene_action](#mario_execute_cutscene_action) + +### Lua Example +`local integerValue = mario_execute_cutscene_action(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- integer + +### C Prototype +`s32 mario_execute_cutscene_action(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ +## [mario_ready_to_speak](#mario_ready_to_speak) + +### Lua Example +`local integerValue = mario_ready_to_speak(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- integer + +### C Prototype +`s32 mario_ready_to_speak(struct MarioState* m);` + +[:arrow_up_small:](#) + +
+ ## [print_displaying_credits_entry](#print_displaying_credits_entry) ### Lua Example diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 9a9b2d9e..9368702e 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -18,6 +18,36 @@ // camera.h // ////////////// +int smlua_func_set_camera_pitch_shake(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + s16 mag = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + s16 decay = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s16 inc = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + set_camera_pitch_shake(mag, decay, inc); + + return 1; +} + +int smlua_func_set_camera_roll_shake(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + s16 mag = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + s16 decay = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s16 inc = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + set_camera_roll_shake(mag, decay, inc); + + return 1; +} + int smlua_func_set_camera_shake_from_hit(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -46,6 +76,21 @@ int smlua_func_set_camera_shake_from_point(lua_State* L) { return 1; } +int smlua_func_set_camera_yaw_shake(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + s16 mag = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + s16 decay = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s16 inc = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + set_camera_yaw_shake(mag, decay, inc); + + return 1; +} + int smlua_func_set_environmental_camera_shake(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -139,10 +184,147 @@ int smlua_func_update_character_anim_offset(lua_State* L) { return 1; } + ////////////////// + // djui_popup.h // +////////////////// + +/* +int smlua_func_djui_popup_create(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + +// const char* message = (const char*)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED + if (!gSmLuaConvertSuccess) { return 0; } + int lines = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + + UNIMPLEMENTED -->(L, djui_popup_create(message, lines)); + + return 1; +} +*/ + //////////////// // external.h // //////////////// +int smlua_func_fade_volume_scale(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + u8 player = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u8 targetScale = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeTimer = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + fade_volume_scale(player, targetScale, fadeTimer); + + return 1; +} + +int smlua_func_fadeout_background_music(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + + u16 arg0 = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeOut = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + + fadeout_background_music(arg0, fadeOut); + + return 1; +} + +int smlua_func_play_course_clear(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + play_course_clear(); + + return 1; +} + +int smlua_func_play_dialog_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + u8 dialogID = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + + play_dialog_sound(dialogID); + + return 1; +} + +int smlua_func_play_music(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + u8 player = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u16 seqArgs = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeTimer = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + play_music(player, seqArgs, fadeTimer); + + return 1; +} + +int smlua_func_play_peachs_jingle(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + play_peachs_jingle(); + + return 1; +} + +int smlua_func_play_power_star_jingle(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + u8 arg0 = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + + play_power_star_jingle(arg0); + + return 1; +} + +int smlua_func_play_puzzle_jingle(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + play_puzzle_jingle(); + + return 1; +} + +int smlua_func_play_race_fanfare(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + play_race_fanfare(); + + return 1; +} + +int smlua_func_play_secondary_music(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + + u8 seqId = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u8 bgMusicVolume = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + u8 volume = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeTimer = smlua_to_integer(L, 4); + if (!gSmLuaConvertSuccess) { return 0; } + + play_secondary_music(seqId, bgMusicVolume, volume, fadeTimer); + + return 1; +} + int smlua_func_play_sound(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } @@ -166,6 +348,75 @@ int smlua_func_play_sound(lua_State* L) { return 1; } +int smlua_func_play_sound_with_freq_scale(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + s32 soundBits = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + + f32* pos = smlua_get_vec3f_from_buffer(); + pos[0] = smlua_get_number_field(2, "x"); + if (!gSmLuaConvertSuccess) { return 0; } + pos[1] = smlua_get_number_field(2, "y"); + if (!gSmLuaConvertSuccess) { return 0; } + pos[2] = smlua_get_number_field(2, "z"); + if (!gSmLuaConvertSuccess) { return 0; } + f32 freqScale = smlua_to_number(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + play_sound_with_freq_scale(soundBits, pos, freqScale); + + smlua_push_number_field(2, "x", pos[0]); + smlua_push_number_field(2, "y", pos[1]); + smlua_push_number_field(2, "z", pos[2]); + + return 1; +} + +int smlua_func_play_star_fanfare(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + play_star_fanfare(); + + return 1; +} + +int smlua_func_play_toads_jingle(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + play_toads_jingle(); + + return 1; +} + +int smlua_func_sequence_player_fade_out(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + + u8 player = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeTimer = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + + sequence_player_fade_out(player, fadeTimer); + + return 1; +} + +int smlua_func_sequence_player_unlower(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + + u8 player = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeTimer = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + + sequence_player_unlower(player, fadeTimer); + + return 1; +} + ///////////// // mario.h // ///////////// @@ -1222,6 +1473,22 @@ int smlua_func_bhv_end_toad_loop(UNUSED lua_State* L) { return 1; } +int smlua_func_common_death_handler(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + s32 animation = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s32 frameToDeathWarp = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWarp); + lua_pushinteger(L, common_death_handler(m, animation, frameToDeathWarp)); + + return 1; +} + int smlua_func_cutscene_put_cap_on(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -1278,6 +1545,32 @@ int smlua_func_generate_yellow_sparkles(lua_State* L) { return 1; } +/* +int smlua_func_get_credits_str_width(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + +// char * str = (char *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 get_credits_str_width(char *str); + lua_pushinteger(L, get_credits_str_width(str)); + + return 1; +} +*/ + +int smlua_func_get_star_collection_dialog(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 get_star_collection_dialog(struct MarioState *m); + lua_pushinteger(L, get_star_collection_dialog(m)); + + return 1; +} + int smlua_func_handle_save_menu(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -1290,6 +1583,48 @@ int smlua_func_handle_save_menu(lua_State* L) { return 1; } +int smlua_func_launch_mario_until_land(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + s32 endAction = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s32 animation = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + f32 forwardVel = smlua_to_number(L, 4); + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 launch_mario_until_land(struct MarioState *m, s32 endAction, s32 animation, f32 forwardVel); + lua_pushinteger(L, launch_mario_until_land(m, endAction, animation, forwardVel)); + + return 1; +} + +int smlua_func_mario_execute_cutscene_action(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 mario_execute_cutscene_action(struct MarioState *m); + lua_pushinteger(L, mario_execute_cutscene_action(m)); + + return 1; +} + +int smlua_func_mario_ready_to_speak(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 mario_ready_to_speak(struct MarioState* m); + lua_pushinteger(L, mario_ready_to_speak(m)); + + return 1; +} + int smlua_func_print_displaying_credits_entry(UNUSED lua_State* L) { if(!smlua_functions_valid_param_count(L, 0)) { return 0; } @@ -1322,12 +1657,12 @@ int smlua_func_spawn_obj_at_mario_rel_yaw(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } s32 model = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } -// BehaviorScript * behavior = (BehaviorScript *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED +// const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { return 0; } s16 relYaw = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { return 0; } - extern struct Object *spawn_obj_at_mario_rel_yaw(struct MarioState *m, s32 model, BehaviorScript *behavior, s16 relYaw); + extern struct Object *spawn_obj_at_mario_rel_yaw(struct MarioState *m, s32 model, const BehaviorScript *behavior, s16 relYaw); UNIMPLEMENTED -->(L, spawn_obj_at_mario_rel_yaw(m, model, behavior, relYaw)); return 1; @@ -1562,6 +1897,28 @@ int smlua_func_common_landing_action(lua_State* L) { return 1; } +/* +int smlua_func_common_landing_cancels(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + struct LandingAction* landingAction = (struct LandingAction*)smlua_to_cobject(L, 2, LOT_LANDINGACTION); + if (!gSmLuaConvertSuccess) { return 0; } +// s32 (*setAPressAction)(structMarioState* arg2 = (s32 (*setAPressAction)(structMarioState*)smlua_to_cobject(L, 3, LVT_???); <--- UNIMPLEMENTED + if (!gSmLuaConvertSuccess) { return 0; } + u32 arg3 = smlua_to_integer(L, 4); + if (!gSmLuaConvertSuccess) { return 0; } +// u32) arg4 = (u32))smlua_to_cobject(L, 5, LOT_???); <--- UNIMPLEMENTED + if (!gSmLuaConvertSuccess) { return 0; } + + extern s32 common_landing_cancels(struct MarioState *m, struct LandingAction *landingAction, s32 (*setAPressAction)(struct MarioState *, u32, u32)); + lua_pushinteger(L, common_landing_cancels(m, landingAction, arg2, arg3, arg4)); + + return 1; +} +*/ + int smlua_func_common_slide_action(lua_State* L) { if(!smlua_functions_valid_param_count(L, 4)) { return 0; } @@ -2533,8 +2890,11 @@ void smlua_bind_functions_autogen(void) { lua_State* L = gLuaState; // camera.h + smlua_bind_function(L, "set_camera_pitch_shake", smlua_func_set_camera_pitch_shake); + smlua_bind_function(L, "set_camera_roll_shake", smlua_func_set_camera_roll_shake); smlua_bind_function(L, "set_camera_shake_from_hit", smlua_func_set_camera_shake_from_hit); smlua_bind_function(L, "set_camera_shake_from_point", smlua_func_set_camera_shake_from_point); + smlua_bind_function(L, "set_camera_yaw_shake", smlua_func_set_camera_yaw_shake); smlua_bind_function(L, "set_environmental_camera_shake", smlua_func_set_environmental_camera_shake); // characters.h @@ -2545,8 +2905,26 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "play_character_sound_offset", smlua_func_play_character_sound_offset); smlua_bind_function(L, "update_character_anim_offset", smlua_func_update_character_anim_offset); + // djui_popup.h + //smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create); <--- UNIMPLEMENTED + // external.h + smlua_bind_function(L, "fade_volume_scale", smlua_func_fade_volume_scale); + smlua_bind_function(L, "fadeout_background_music", smlua_func_fadeout_background_music); + smlua_bind_function(L, "play_course_clear", smlua_func_play_course_clear); + smlua_bind_function(L, "play_dialog_sound", smlua_func_play_dialog_sound); + smlua_bind_function(L, "play_music", smlua_func_play_music); + smlua_bind_function(L, "play_peachs_jingle", smlua_func_play_peachs_jingle); + smlua_bind_function(L, "play_power_star_jingle", smlua_func_play_power_star_jingle); + smlua_bind_function(L, "play_puzzle_jingle", smlua_func_play_puzzle_jingle); + smlua_bind_function(L, "play_race_fanfare", smlua_func_play_race_fanfare); + smlua_bind_function(L, "play_secondary_music", smlua_func_play_secondary_music); smlua_bind_function(L, "play_sound", smlua_func_play_sound); + smlua_bind_function(L, "play_sound_with_freq_scale", smlua_func_play_sound_with_freq_scale); + smlua_bind_function(L, "play_star_fanfare", smlua_func_play_star_fanfare); + smlua_bind_function(L, "play_toads_jingle", smlua_func_play_toads_jingle); + smlua_bind_function(L, "sequence_player_fade_out", smlua_func_sequence_player_fade_out); + smlua_bind_function(L, "sequence_player_unlower", smlua_func_sequence_player_unlower); // mario.h smlua_bind_function(L, "adjust_sound_for_speed", smlua_func_adjust_sound_for_speed); @@ -2633,11 +3011,17 @@ void smlua_bind_functions_autogen(void) { // mario_actions_cutscene.c smlua_bind_function(L, "bhv_end_peach_loop", smlua_func_bhv_end_peach_loop); smlua_bind_function(L, "bhv_end_toad_loop", smlua_func_bhv_end_toad_loop); + smlua_bind_function(L, "common_death_handler", smlua_func_common_death_handler); smlua_bind_function(L, "cutscene_put_cap_on", smlua_func_cutscene_put_cap_on); smlua_bind_function(L, "cutscene_take_cap_off", smlua_func_cutscene_take_cap_off); smlua_bind_function(L, "general_star_dance_handler", smlua_func_general_star_dance_handler); smlua_bind_function(L, "generate_yellow_sparkles", smlua_func_generate_yellow_sparkles); + //smlua_bind_function(L, "get_credits_str_width", smlua_func_get_credits_str_width); <--- UNIMPLEMENTED + smlua_bind_function(L, "get_star_collection_dialog", smlua_func_get_star_collection_dialog); smlua_bind_function(L, "handle_save_menu", smlua_func_handle_save_menu); + smlua_bind_function(L, "launch_mario_until_land", smlua_func_launch_mario_until_land); + smlua_bind_function(L, "mario_execute_cutscene_action", smlua_func_mario_execute_cutscene_action); + smlua_bind_function(L, "mario_ready_to_speak", smlua_func_mario_ready_to_speak); smlua_bind_function(L, "print_displaying_credits_entry", smlua_func_print_displaying_credits_entry); smlua_bind_function(L, "should_start_or_continue_dialog", smlua_func_should_start_or_continue_dialog); //smlua_bind_function(L, "spawn_obj_at_mario_rel_yaw", smlua_func_spawn_obj_at_mario_rel_yaw); <--- UNIMPLEMENTED @@ -2659,6 +3043,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "check_ledge_climb_down", smlua_func_check_ledge_climb_down); smlua_bind_function(L, "common_ground_knockback_action", smlua_func_common_ground_knockback_action); smlua_bind_function(L, "common_landing_action", smlua_func_common_landing_action); + //smlua_bind_function(L, "common_landing_cancels", smlua_func_common_landing_cancels); <--- UNIMPLEMENTED smlua_bind_function(L, "common_slide_action", smlua_func_common_slide_action); smlua_bind_function(L, "common_slide_action_with_jump", smlua_func_common_slide_action_with_jump); smlua_bind_function(L, "mario_execute_moving_action", smlua_func_mario_execute_moving_action);