Commit Graph

66 Commits (4b84a87c6f4705ba63cee0cf2aea77b3d0ee2646)

Author SHA1 Message Date
Agent X 1241c56ed9
Expose level_trigger_warp and related constants (#197) 2022-09-19 19:51:27 -07:00
Agent X f726fb5d74
HOOK_ON_SCREEN_TRANSITION (#192) 2022-09-18 17:30:29 -07:00
PeachyPeach 6449b7d578
Complete color palettes; gfx macros (#191) 2022-09-18 17:30:13 -07:00
Isaac0-dev c7bdeef8d5
multiple improvements (#176) 2022-09-12 20:00:51 -07:00
Agent X a1953afd1c
SURFACE_RAYCAST (#177)
* SURFACE_RAYCAST

* Exclude from camera collision
2022-09-12 19:56:24 -07:00
wRadion 44bbd23f83
Handle RM_Scroll_Texture and editor_Scroll_Texture behaviors from RM2C hacks (#173) 2022-08-25 17:46:33 -07:00
TheGag96 d87dd73db1
Fix issues Extended Moveset mod (+ extras) (#146)
* Allow Lua action hooks to specify custom functions for more behavior

...like gravity, and update all current mods to match.

Spin jump and wall slide from the Extended Moveset mod now have gravity
code basically matching the original mod.

Currently, any place you'd want to use one of these new action hooks
still requires an O(n) check through all action hook per call. This
should probably be changed.

* Fix some remaining issues with Extended Moveset Lua port

- Remove divergent spin jump code
- Remove divergent roll code
- Remap roll button to Y
- Reimplement dive slide to make dive hop work like the original
- Allow spin from double jump, backflip, side flip

* Fix more issues with Extended Moveset Lua port

- Reimplement all users of update_walking_speed to incorporate the Tight
  Controls edits and modified speed caps
- Fix instances of angle arithmetic to wrap properly across the mod

* Don't chop off group bits of custom action flags; assign missing groups in mods

This fixes the Extended Moveset's underwater actions. Chopping off those
bits was making the game consider the underwater actions to be a part of
the Stationary group, which caused `check_common_stationary_cancels`,
which upwarps Mario to the surface.

* Tweak roll sliding angle tendency

Rolling will now gradually (but fairly quckly) try to tend Mario's
facing angle down the slope.

This is cleaner than my old method that tries to flip Mario's angle
(wrongly) when he begins moving downward, having that logic coexist with
the logic for normal sliding actions that can also tend Mario to face
backward down the slope. Just looks ugly now by comparison.

* Disallow spin jump on slides in Extended Moveset port

This matches the original mod

* Extended Moveset: Crazy Box Bounce check

* Extended Moveset: Fix hugging the wall when spin jumping after wall kick

* Extended Moveset: Fix ledge drop snapping up to ground

Just reimplement `act_air_hit_wall` ourselves.

* Extended Moveset: Add Kaze's walking speed fix

* smlua_hooks.c: Restore option to use old API for hook_mario_action

The intent is to allow mods outside of this repo to continue working.

Co-authored-by: djoslin0 <djoslin0@users.noreply.github.com>
2022-08-07 15:25:00 -07:00
TheGag96 dc3ca7c76d
Arbitrary shirt, pants, glove colors + settings menu (#145)
* Support for more granular player colors

You can now configure RGB values for shirt, pants, gloves, and shoes.
Due to some limitations, configuring shoes does nothing at the moment.

* Remove paletteIndex and friends

Restructured and filled in some remaining code to account for that.

* Add Edit Palette panel to Player panel

* Change PlayerPalette contents to an enum-indexed array, remove shoes

This gets rid of all the hokey code doing switch cases on the
different parts.

* Fix goof with player model selection box

Should actually have affect now even if a custom palette is being used.

* Fix gap in player color display list commands

The extra space was leftover from when I was trying to get shoes
working. Forgot to clean it up.

* Standardize PlayerParts enum, including for lua constants autogen

* djui_panel_player.c: Properly hook sending palette changes on unpause

Editing the palette and then unpausing should send out the packet to
everyone with the new palette changes (and update the palette preset
selection box), but since we weren't hooking that situation before, it
would stay changed only for you. You would have had to press the Back
button for it to work right.

* Allow Lua mods to continue using `paletteIndex`, `overridePaletteIndex`

This lets mod code like this still work unchanged:

if s.team == 2 then
    np.overridePaletteIndex = 7
elseif s.team == 1 then
    np.overridePaletteIndex = 15
else
    np.overridePaletteIndex = np.paletteIndex
end

It's essentially faked, and would work strangely if the value of either
variable was inspected more closely directly. This should at least
handle the typical use case, though.

Every frame, `overridePaletteIndex` is checked to see if it was modified
from its previous value. If so, `overridePalette` is set to the preset
corresponding to the index. `paletteIndex` contains a special value that
when used to assign to `overridePaletteIndex`, it copies `palette` into
`overridePalette` to restore the real colors, which of course may not
follow the presets at all.

* characters.h: Pack `PlayerPalette` to eliminate size differences between computers

* mario_misc.c: Remove remaining "TODO GAG"
2022-08-07 15:13:19 -07:00
MysterD 618f468e06 Add HOOK_USE_ACT_SELECT ; increase MAX_AUDIO_OVERRIDE to 128 2022-08-04 01:12:16 -07:00
MysterD 3b626845e1 Refactor sync objects, move syncIds to u32 2022-06-06 19:13:04 -07:00
Agent X 68d46cdefe
Mouse lock & freeze cam fixes and warp constants (#103) 2022-05-19 17:06:51 -07:00
PeachyPeach 4fbafc2708
Fixed various audio bugs; DynOS can now detect texture duplicates to decrease generated bin files size (#110)
Fixed the following audio bugs:
    Bug: Rom-hacks sequences don't seem to be affected by volume scaling and
         muting
    Fix: Force the BGM sequences to follow the vanilla behavior:
        Volume can't go higher than default volume
        Volume is reduced to 31% when the game is paused
        Audio is stopped when the game is paused outside the Castle levels
    Bug: (Pointed out by Draco) Mario's voice clips are not replaced by the
         player's character's in the following instances: fall to death
         barrier, "here we go" in the ending cutscene, "let's a go"
         after selecting a star, "okey dokey" after starting the game.
    Fix: The first two ones now call
         play_character_sound(m, CHAR_SOUND_...) instead of
         play_sound(SOUND_MARIO_..., pos). The last two ones couldn't be
         fixed the same way for two reasons: First, the corresponding sounds
         were not referenced in the sound table, second, the sound played is
         always cut-off after a few frames (due to how sm64 resets the sound
         banks after loading a level).

Added SOUND_*_LETS_A_GO and SOUND_*_OKEY_DOKEY sounds for each playable
    character as Bass samples.
    Character Bass sounds work the same way as vanilla sounds (i.e. can be
    played with play_character_sound), but they cannot be prematurely stopped
    by sm64 sound banks shenanigans.
    This fixes the cut-off for both the star select and the castle grounds
    entry, plays the sound corresponding to the player's character, and doesn't
    need to extend or edit the sound table.

DynOS can detect texture duplicates when generating a bin or lvl file.
    When a duplicate is detected, the name of the original texture node is
    written instead of the whole PNG data, decreasing significantly the
    resulting file size.
2022-05-19 16:40:45 -07:00
Agent X b972bb1be4
Add surface_terrains.h to constants (#77) 2022-05-02 17:31:55 -07:00
PeachyPeach 8812fbac8b
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
PeachyPeach 6726a6280a
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 bc7821a1e9 Added custom mod packets 2022-04-22 00:13:58 -07:00
MysterD ef7dc41560 Added HOOK_ON_DEATH 2022-04-21 18:34:12 -07:00
MysterD 2347ab61c1 Added HOOK_ON_OBJECT_RENDER 2022-04-19 22:36:47 -07:00
MysterD 6b67c983ec exposed sequence ids to lua 2022-04-15 21:51:18 -07:00
MysterD 9653a19c7d Improve rom hack camera's collisions in tight spaces and focus underwater. Add HOOK_ON_SET_CAMERA_MODE 2022-04-13 00:10:50 -07:00
MysterD 431af75d88 Add a vanilla-like camera for romhacks 2022-04-11 21:04:15 -07:00
MysterD 957e03cd81 Added HOOK_GET_STAR_COLLECTION_DIALOG 2022-04-10 02:44:11 -07:00
MysterD c75e71f24e Unhardcoded all behavior dialogs, allowed replacement of dialogs 2022-04-09 19:50:50 -07:00
MysterD 98f02458e3 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 6751829f91 Adjustments for Lua/Mods 2022-04-06 18:24:50 -07:00
MysterD 52e705c9d8 Merge branch 'unstable' into level-scripts 2022-04-06 01:36:33 -07:00
MysterD de048928ce Added ability for Lua mods to adjust gServerSettings 2022-03-26 01:08:15 -07:00
MysterD 322e4983ae Add HOOK_ON_PAUSE_EXIT 2022-03-25 23:06:14 -07:00
Isaac 65df754b09
Add save file flag functions to lua api (#41) 2022-03-24 19:30:15 -07:00
MysterD c58702df93 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 11649ce1d8 Added HOOK_ON_OBJECT_UNLOAD, HOOK_ON_SYNC_OBJECT_UNLOAD 2022-03-17 01:43:08 -07:00
MysterD 0cd2a91e9c Added allocate_mario_action() 2022-03-17 01:17:34 -07:00
MysterD 7252d836a9 Added hooks: HOOK_ON_LEVEL_INIT, HOOK_ON_WARP, HOOK_ON_SYNC_VALID 2022-03-16 23:53:01 -07:00
MysterD 469e4ac4e4 Load Super Keeberghrh's ERROR model when DynOS can't find the model 2022-03-16 01:34:18 -07:00
MysterD b695cbd55a Merge branch 'unstable' of github.com:sm64ex-coop-dev/sm64ex-coop into unstable 2022-03-13 00:25:22 -08:00
Prince Frizzy 75bb9b7912
Update to Refresh 13 (#19)
* Refresh 13

Co-authored-by: n64 <n64>
2022-03-13 00:17:10 -08:00
MysterD 3ce66ac312 Added hook: HOOK_ALLOW_PVP_ATTACK, disabled friendly fire in football 2022-03-12 23:43:47 -08:00
MysterD 24df92fa48 Added DynOS warp functions to Lua API 2022-03-11 18:11:32 -08:00
MysterD d03aacc144 Added ability for Lua to spawn non-synchronized objects 2022-03-09 21:25:34 -08:00
MysterD 18a5ebafae More lua doc fixes 2022-03-04 22:38:43 -08:00
MysterD d3b9163507 Add missing AreaTimerType to documentation 2022-03-04 22:31:32 -08:00
MysterD 4d4edf152a Fix Lua documentation autogen links 2022-03-04 22:24:21 -08:00
MysterD e740529776 Fixed how constants.md autogen'd links 2022-03-04 22:11:10 -08:00
MysterD 3ad6c721dc Initial custom behavior commit 2022-03-03 01:04:15 -08:00
PeachyPeach 0c42836b81
Added support for X and Y buttons; Re-mapped B button to the actual B button for controllers; Moved particleFlags code so lua scripts can spawn Mario particles with 'before Mario update' and 'after Mario update' hooks (#5) 2022-02-27 14:31:59 -08:00
MysterD d3b4e1c794 Made certain objects use their dynamically assigned model IDs 2022-02-26 02:14:30 -08:00
MysterD fa36ed308e Add more constants to Lua 2022-02-25 22:44:37 -08:00
MysterD 33ced38baa Various Lua object API improvements
Lifted immutablity of most Lua struct fields
Added object constants to Lua API
Added ability to set struct pointers in Lua API
Prevented respawners for Lua-spawned objects
2022-02-25 18:30:05 -08:00
MysterD 091a859104 Added level models to Lua API 2022-02-22 18:04:12 -08:00
MysterD 94bc7940cc Initial Lua support for spawning objects 2022-02-21 22:46:39 -08:00