Commit Graph

140 Commits (ede487ddb0e328bb010159a3f4f2123c3767692b)

Author SHA1 Message Date
MysterD 5fc6bb0491 Fix clang/mac compile 2022-05-19 19:42:07 -07:00
PeachyPeach 18503ecc52 Various bug fixes + Added is_game_paused() and more background music functions to lua (#93)
Bug: DynOS models with animations cannot swap animations if they are
     loaded via lua (smlua_model_util_get_id and
     obj_set_model_extended).
Fix: DynOS_Actor_GetActorGfx takes a graph node instead of a georef,
     and checks for DynosValidActors graph nodes if georef is NULL.

Bug: The game can crash when calling obj_set_model_extended inside a
     HOOK_ON_OBJECT_RENDER hook.
Fix: The crash happens in smlua_model_util_load_with_pool_and_cache_id
     due to pool being NULL. If the game can't allocate an
     AllocOnlyPool object, use DynOS to generate the graph node.

Bug: warp_to_level and similar functions don't trigger HOOK_ON_WARP.
Fix: Call HOOK_ON_WARP hooks in DynOS_Warp_UpdateWarp and
     DynOS_Warp_UpdateExit after level and mario initialization.

Bug: The game sometimes calls HOOK_ON_OBJECT_RENDER hooks for
     unintended objects.
Fix: Initialize hookRender field to 0 when creating an object.

Bug: Actions can't apply gfx offsets to characters that have an anim
     offset (Waluigi, Wario)
Fix: Add m->curAnimOffset to gfx.pos[1] instead of setting it to
     m->pos[1] + m->curAnimOffset, except during the jumbo star
     cutscene.
2022-05-14 14:28:25 -07:00
Agent X 90f5fc3a08 djui_hud_get_raw_mouse_x/y, djui_hud_set_mouse_locked (#91) 2022-05-13 19:55:47 -07:00
MysterD 83f441cd4e Add djui_hud_world_pos_to_screen_pos, and render interpolated rect/texture 2022-05-13 19:54:49 -07:00
MysterD 6d6995e5da Make bass sound interface easier to handle 2022-05-08 04:04:14 -07:00
MysterD 99e59dd8c1 Re-ran autogen 2022-05-08 00:29:17 -07:00
Beyley Thomas 20167088d6 Add basic Bass audio engine (#58) 2022-05-08 00:25:09 -07:00
MysterD e1fd969cf3 Add support for custom HUD textures and faster texture packs w/o EXTERNAL_DATA 2022-05-06 22:03:12 -07:00
Agent X cad4930a73 camera_freeze, camera_unfreeze, djui_hud_get_mouse_x, djui_hud_get_mouse_y, set_override_fov, set_override_near, set_override_far (#74) 2022-04-30 17:36:38 -07:00
PeachyPeach 5ddf093c26 HOOK_ALLOW_INTERACT; new HUD functions (#73)
Added new hook: HOOK_ALLOW_INTERACT:
        Called before Mario interacts with an object. Return true to allow the interaction.
        The hook signature is bool function(MarioState, Object, InteractionType)

    Added new HUD constants:
        enum HudDisplayValue:
            HUD_DISPLAY_LIVES
            HUD_DISPLAY_COINS
            HUD_DISPLAY_STARS
            HUD_DISPLAY_WEDGES
            HUD_DISPLAY_KEYS
            HUD_DISPLAY_FLAGS
            HUD_DISPLAY_TIMER
        enum HudDisplayFlags:
            HUD_DISPLAY_FLAGS_NONE
            HUD_DISPLAY_FLAGS_LIVES
            HUD_DISPLAY_FLAGS_COIN_COUNT
            HUD_DISPLAY_FLAGS_STAR_COUNT
            HUD_DISPLAY_FLAGS_CAMERA_AND_POWER
            HUD_DISPLAY_FLAGS_KEYS
            HUD_DISPLAY_FLAGS_UNKNOWN_0020
            HUD_DISPLAY_FLAGS_TIMER
            HUD_DISPLAY_FLAGS_EMPHASIZE_POWER

    Added new HUD functions:
        s32 hud_get_value(enum HudDisplayValue type)
        void hud_set_value(enum HudDisplayValue type, s32 value)
        void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height)
2022-04-30 17:33:38 -07:00
Prince Frizzy 03ee22b232 Add two new LUA util functions. (#72) 2022-04-28 20:42:29 -07:00
PeachyPeach 6d360f259c Changes in level_info; play_transition; dev-only warp command; bug fix for moving sounds played via lua (#69)
Improved level_info.c and added functions to LUA:
        const char *get_level_name_ascii(s16 courseNum, s16 levelNum, s16 areaIndex, s16 charCase):
            Return a level name as an ascii string. If charCase is 1, capitalize all letters.
            If charCase is -1, decapitalize all letters except the first one of each word.
        const u8 *get_level_name_sm64(s16 courseNum, s16 levelNum, s16 areaIndex, s16 charCase):
            Return a level name as an sm64 u8 string.
            If charCase is 1, capitalize all letters.
            If charCase is -1, decapitalize all letters except the first one of each word.
        const char *get_level_name(s16 courseNum, s16 levelNum, s16 areaIndex):
            Shortcut for get_level_name_ascii(courseNum, levelNum, areaIndex, -1).
        const char *get_star_name_ascii(s16 courseNum, s16 starNum, s16 charCase):
            Return a star name as an ascii string.
            If charCase is 1, capitalize all letters.
            If charCase is -1, decapitalize all letters except the first one of each word.
        const u8 *get_star_name_sm64(s16 courseNum, s16 starNum, s16 charCase):
            Return a star name as an sm64 u8 string.
            If charCase is 1, capitalize all letters.
            If charCase is -1, decapitalize all letters except the first one of each word.
        const char *get_star_name(s16 courseNum, s16 starNum):
            Shortcut for get_star_name_ascii(courseNum, starNum, -1).

    Added play_transition function to LUA.
        I chose to copy the function declaration to smlua_misc_utils.h instead of adding area.h
        to the autogen tool, as most structures, variables and functions in area.h aren't meant
        to be used by LUA scripts.

    Added a dev-only warp chat command.
        This command signature is /warp [LEVEL] [AREA] [ACT]. Level can be either a number
            or a shorthand name (bob, wf, ccm...). Area and Act are numbers.
        This command is available only when building the game with DEBUG and DEVELOPMENT.
        This command cannot be used if hosting through Discord.

    Fixed a bug with moving sounds when they are played via a lua script.
        Bug: Moving sounds (including terrain sounds, flying sound, quicksand sound)
            are not played correctly when a lua script play them via a call of
            play_sound or play_sound_with_freq_scale. This is due to how the moving
            sounds are handled internally. They use the f32 pointer provided to the
            play_sound functions to decide if the sound must be kept playing,
            stopped or restarted. Most of the time, the pointer provided is the
            cameraToObject field of Mario's object graph node. Since smlua uses a
            circular buffer for Vec3f conversion, this pointer is lost, and the
            sound engine can't decide what to do with the sound, resulting in a
            weird and incorrect sound effect.
        Fix: play_sound and play_sound_with_freq_scale now calls
            smlua_get_vec3f_for_play_sound before filling the sound request queue,
            to retrieve the correct pointer from the Vec3f provided by smlua.
2022-04-26 13:48:50 -07:00
MysterD 199ca70c86 Split up functions.md into multiple pages 2022-04-22 18:41:42 -07:00
MysterD 2552d22cf9 Added custom mod packets 2022-04-22 00:13:58 -07:00
MysterD 77ca167564 Added HOOK_ON_DEATH 2022-04-21 18:34:12 -07:00
MysterD 647d7c92b9 Fixed player interactions 2022-04-21 00:48:26 -07:00
MysterD b531c30a46 Added passes_pvp_interaction_checks() 2022-04-20 18:27:34 -07:00
PeachyPeach ee9dbc6e80 Added lua profiler; Added useful object functions; Bug fixes (#65)
Added a basic lua profiler
        If the game is compiled with LUA_PROFILER=1, displays on screen the average execution time per frame of each active lua mod, in microseconds.

    Added object functions
        For some reasons, accessing the object fields obj.o* via lua is rather slow, and can drastically increase execution time of custom behaviors. For basic stuff like setting an object's velocity or moving it, some functions, missing from the original code, have been added:
        s32 obj_is_valid_for_interaction(struct Object *o): returns 1 if an object is valid for interaction, i.e. active, tangible and not interacted.
        s32 obj_check_hitbox_overlap(struct Object *o1, struct Object *o2): returns 1 if two objects hitboxes overlap. Doesn't check tangibility, only hitbox values.
        void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz): sets an object's velocity.
        void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz): moves an object position by (dx, dy, dz).

    Bug fixes:
        Disable collisions with walls and ceilings after Mario exits a warp pipe to prevent softlocks in narrow places.
        Make the koopa shell exclamation box respawn after some time.
        Quicksand no longer downwarps and instant-kills Mario if he's shocked while being above it.
2022-04-20 11:20:45 -07:00
MysterD cc4e3c6354 Refactor how objects set their models 2022-04-19 18:47:50 -07:00
MysterD 709a145575 Quick fixes for test 2022-04-10 10:11:13 -07:00
MysterD 208ae3815e Added default volume support for custom sequences 2022-04-10 09:47:17 -07:00
MysterD 18815bff0b Added support for custom music 2022-04-10 09:11:45 -07:00
MysterD fbab32369c Allow ability to disable vanilla course-specific settings for camera 2022-04-10 01:55:11 -07:00
MysterD 2d159af4cc Allow coop mods to use the backup save slot independently of the normal one 2022-04-10 00:30:47 -07:00
MysterD 2e8017a39c Allow course names/acts to be changed from Lua 2022-04-09 23:28:36 -07:00
MysterD 37e2593279 Unhardcoded all behavior dialogs, allowed replacement of dialogs 2022-04-09 19:50:50 -07:00
MysterD 47dd967af5 Added a way to bind to movtexqc ids through lua, added the rest of the object constants 2022-04-09 01:47:20 -07:00
MysterD 38ac873568 Made trajectories overridable from Lua 2022-04-08 23:01:41 -07:00
MysterD d4f462d491 Added custom level script overrides, warps work now 2022-04-08 19:29:16 -07:00
MysterD 57531d7453 Add more bhv functions and a func to ge tthe current save 2022-04-07 01:17:48 -07:00
MysterD 54d958a34d Added behavior actions for rom hacks 2022-04-06 18:36:15 -07:00
MysterD 6dd90100ad Adjustments for Lua/Mods 2022-04-06 18:24:50 -07:00
MysterD 2aeb96cc59 Merge branch 'unstable' into level-scripts 2022-04-06 01:36:33 -07:00
Agent-11 / Agent X 058183d020 Add get/set_environment_region (#56)
Set the water height with a function. Also added an example for it in the documentation.
2022-04-05 15:53:16 -07:00
MysterD 4052347247 More progress toward custom DynOS levels 2022-04-02 15:14:04 -07:00
MysterD 6f00bd7bd0 Ran autogen 2022-03-30 20:03:59 -07:00
MysterD 16aa75ca93 Fix compile errors / run autogen 2022-03-29 21:12:42 -07:00
MysterD 745fce41a8 Add custom collisions to DynOS/Lua 2022-03-28 01:02:33 -07:00
MysterD 7deafce819 Add set_mario_y_vel_based_on_fspeed() to lua 2022-03-26 00:01:13 -07:00
MysterD 2dfb28ddc7 Add gLakituState to Lua 2022-03-25 23:58:10 -07:00
MysterD b38af4b798 Added a bunch of camera functions to Lua 2022-03-25 23:46:37 -07:00
Isaac 4f78f507ee Add save file flag functions to lua api (#41) 2022-03-24 19:30:15 -07:00
MysterD c34ffd90e7 Misc Lua fixes/enhancements
approach_s32 now stays within 32 bits
Fixed SOUND_ARG_LOAD
Added OBJ_COL_FLAGS_*
Added reset_rumble_timers
Added get_hand_foot_pos_*
Added get_water_surface_pseudo_floor
Adjusted new hooks to be called at the appropriate times
2022-03-19 00:56:59 -07:00
MysterD 7a00461333 Added allocate_mario_action() 2022-03-17 01:17:34 -07:00
MysterD d2522cc955 Added ability for mods to load custom geos 2022-03-14 00:11:36 -07:00
Prince Frizzy c62e65d7e8 Fixes for multiple players getting a star cutscene, Even if they didn't spawn it. (#22)
* Fix up star cutscene issues.
2022-03-13 00:22:48 -08:00
Prince Frizzy 43ae67c337 Update to Refresh 13 (#19)
* Refresh 13

Co-authored-by: n64 <n64>
2022-03-13 00:17:10 -08:00
MysterD 12e28f4099 Added Lua definitions for autocomplete in visual studio code 2022-03-12 21:28:57 -08:00
MysterD 19ca2e2040 Fixed saving/loading of DynOS model pack settings 2022-03-12 17:00:06 -08:00
MysterD c1b02e21d0 Added get_temp_object_hitbox() to Lua API 2022-03-11 18:18:41 -08:00
MysterD 2876251fb6 Added DynOS warp functions to Lua API 2022-03-11 18:11:32 -08:00
MysterD d89cb61e04 Added ability for Lua to show/hide SM64 HUD 2022-03-10 18:33:52 -08:00
MysterD 01cd49273e Added the ability to set surface collisions on custom behaviors 2022-03-09 23:02:20 -08:00
MysterD 9334840448 Added ability for Lua to spawn non-synchronized objects 2022-03-09 21:25:34 -08:00
MysterD f92051b3df Added getter for network area timer 2022-03-09 21:25:21 -08:00
MysterD ed95ad3cb7 Added the ability to spawn particles from Lua
Added particles to football
Increased the object cap for particles
2022-03-09 21:25:07 -08:00
PeachyPeach 33d8f2c283 Added obj_has_behavior_id and obj_has_model_extended functions; break bhvBreakableBoxSmall objects without a wall collision by setting some flags in oInteractStatus (#12)
* Added obj_has_behavior_id and obj_has_model_extended functions; break bhvBreakableBoxSmall objects without a wall collision by setting some flags in oInteractStatus
2022-03-05 14:39:55 -08:00
MysterD 37d1d70a59 Add collision_find_surface_on_ray() 2022-03-05 14:24:58 -08:00
MysterD 4405164667 Made adding to behaviors possible in Lua 2022-03-05 01:29:24 -08:00
MysterD b9086f9414 Documented manually created Lua functions 2022-03-04 23:05:23 -08:00
MysterD c82debc7fb More lua doc fixes 2022-03-04 22:38:43 -08:00
MysterD b6004d7358 Update Lua documentation autogeneration 2022-03-04 22:22:31 -08:00
MysterD e6fac87fdc Add networking for custom behaviors 2022-03-04 20:03:00 -08:00
PeachyPeach daef1ee8b4 Added functions: find_ceil_height and obj_set_model_extended (#9)
* Added functions: find_ceil_height and obj_set_model_extended
2022-03-03 16:46:01 -08:00
MysterD 3de0900bbc Initial custom behavior commit 2022-03-03 01:04:15 -08:00
MysterD 394a9feac0 Ran autogen 2022-03-01 12:06:06 -08:00
PeachyPeachSM64 9423be3a3d Added obj_get_* functions; Added set_camera_mode 2022-03-01 12:00:01 -08:00
MysterD 5e3384bdb0 Rename spawn sync object Lua function 2022-02-22 23:50:12 -08:00
MysterD 965e62836f Add support for Lua functions inside parameters 2022-02-22 23:34:22 -08:00
MysterD 3a1ec9c7e2 Add obj_behaviors to the Lua API 2022-02-22 22:39:45 -08:00
MysterD 3852ca19c3 Add Lua wrappers for object_helpers.c 2022-02-22 18:34:51 -08:00
MysterD cba01d0b63 Added BehaviorScript pointer handling to Lua API 2022-02-22 18:29:30 -08:00
MysterD cee83df8c9 Initial Lua support for spawning objects 2022-02-21 22:46:39 -08:00
MysterD 453d494549 Ran autogen after refresh 12 merged 2022-02-18 22:43:38 -08:00
MysterD 3523ceae00 Added player description to player list 2022-02-16 22:30:17 -08:00
MysterD 6af5fb58d9 Added HUD rendering to hide-and-seek 2022-02-16 18:10:06 -08:00
MysterD 6b5f4fce6c Added rect rendering to Lua API 2022-02-15 22:15:49 -08:00
MysterD a73b828106 Created TextureInfo struct 2022-02-15 22:13:10 -08:00
MysterD d84d12a433 Added image drawing to Lua API 2022-02-15 22:12:20 -08:00
MysterD 7dd18aaa2a Added text rendering to Lua API 2022-02-15 22:08:01 -08:00
MysterD 410c10f433 Added a bunch of functions to Lua wrapper 2022-02-04 19:13:15 -08:00
MysterD 75d5211fcf Added network_get_player_text_color_string() to lua api 2022-02-03 19:05:59 -08:00
MysterD 3677a1ac7f Added support for returning structs from C to Lua 2022-02-03 00:43:08 -08:00
MysterD 92c248d728 Added chat message creation to Lua 2022-02-03 00:42:48 -08:00
MysterD f92ac3b472 Added immutable strings to autogen, added djui_popup_create 2022-02-03 00:42:31 -08:00
MysterD 774ae79c2e Adjusted autogen to pull functions directly from src 2022-02-03 00:41:07 -08:00
MysterD 8c9aae228b Added network utils functions to Lua 2022-02-02 20:24:35 -08:00
MysterD a854889fa5 Removed ACT_(MARIO_ACTION) Lua functions from API (useless) 2022-01-29 23:02:36 -08:00
MysterD fd88c77dfa Removed unimplemented functions from documentation 2022-01-29 22:59:36 -08:00
MysterD eefb52880c Autogenerated Lua documentation 2022-01-29 22:47:22 -08:00