Commit Graph

48 Commits (aea75678ebdc51424f7cc29737f83169389e53c6)

Author SHA1 Message Date
PeachyPeach f433dbfcf6 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
MysterD 272cac6376 Merge branch 'audio' into unstable 2022-05-08 16:41:05 -07:00
PeachyPeach 82aca5404e More rom-hacks globals to lua; more bug fixes (#84)
New gLevelValues exposed to lua:
        pssSlideStarTime: the time limit in frames for PSS-style levels (default: 630)
        pssSlideStarIndex: the index of the star spawned below the time limit for PSS-style levels (default: 1)
        coinsRequiredForCoinStar: number of coins required to spawn the 7th star of a main course (default: 100)
        wingCapDuration: duration in frames of the wing cap (default: 1800)
        metalCapDuration: duration in frames of the metal cap (default: 600)
        vanishCapDuration: duration in frames of the vanish cap (default: 600)
        wingCapDurationTotwc: duration in frames of the wing cap given to the player at the entrance of TOTWC (default: 1200)
        metalCapDurationCotmc: duration in frames of the metal cap given to the player at the entrance of COTMC (default: 600)
        vanishCapDurationVcutm: duration in frames of the vanish cap given to the player at the entrance of VCUTM (default: 600)
    Fixed a bug preventing the level music from restarting after defeating a Boss.
    Fixed some bugs with 3D coins or any model with the geo_rotate_coin function:
        Disable billboard and cylboard attributes.
        Set the pitch and roll to 0 for the model to rotate properly.
        The model no longer rotates every frame (even when the game is paused), but every time the object is updated.
2022-05-08 12:18:25 -07:00
MysterD 6d6995e5da Make bass sound interface easier to handle 2022-05-08 04:04:14 -07:00
PeachyPeach adc56ff6c5 3-digits orange numbers; Fixed red coins and secrets bugs; Correct red coins display during pause (#82)
Modified number_geo to allow it to display orange numbers from 0 to 999.
    Edited red coins/secrets code:
        Added two fields in the Area struct: numRedCoins and numSecrets
        The number of red coins/secrets in every area is computed during level script processing
        Removed the useless global gRedCoinsCollected
    These changes fix the following bugs:
        Wrong sound effect played and incorrect number displayed when there is more than 8 red coins/5 secrets
        Desynced red coins/secrets counter when going from an area to another
        Remotely spawning red coins/secrets stars in other areas without collecting all red coins/secrets
    Pausing the game now shows the correct number of collected red coins / the total number of red coins in the current area.
2022-05-07 19:09:37 -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 37606faead Made specialTripleJump a field of MarioState instead of a global 2022-04-23 00:35:49 -07:00
MysterD 86889da980 Added gActiveMods global to lua 2022-04-22 18:44:59 -07:00
MysterD b531c30a46 Added passes_pvp_interaction_checks() 2022-04-20 18:27:34 -07:00
MysterD 0db8bde5ab Add headPos to marioBodyState 2022-04-20 18:21:36 -07:00
MysterD 1b291b0941 Added HOOK_ON_OBJECT_RENDER 2022-04-19 22:36:47 -07:00
MysterD f986102dc4 Added ability to set a level to skip credits, fixed SM74 bugs 2022-04-15 18:33:10 -07:00
MysterD 1873148be8 Add exit castle warp params to Lua 2022-04-10 02:29:44 -07:00
MysterD 37e2593279 Unhardcoded all behavior dialogs, allowed replacement of dialogs 2022-04-09 19:50:50 -07:00
MysterD 38ac873568 Made trajectories overridable from Lua 2022-04-08 23:01:41 -07:00
MysterD 18025909c8 Un-hardcoded vanilla trajectories 2022-04-08 21:01:17 -07:00
MysterD d25159fd77 Refactored StarPositions 2022-04-08 19:46:01 -07:00
MysterD 8805ec2a07 Made the entry level configurable by Lua 2022-04-08 19:39:22 -07:00
MysterD 6500173464 Allow Lua to adjust default star spawn positions 2022-04-08 00:37:20 -07:00
MysterD 16aa75ca93 Fix compile errors / run autogen 2022-03-29 21:12:42 -07:00
MysterD 5efd8565eb Added ability for Lua mods to adjust gServerSettings 2022-03-26 01:08:15 -07:00
MysterD f38741ba4a Make new timers immutable 2022-03-25 21:39:03 -07:00
Prince Frizzy b01553200b A load of fixes and cleanup.. (#39)
Red Coins will now properly play the cutscene for who collected the last red coin.
Secrets will now properly play the cutscene for who collected the last secret.
Treasure Chests will now only play the star cutscene for the person who opened the last chest.
Properly named some unknown Treasure Chest fields.
The Chain Chomp Chain should now properly be despawned for late joiners.
Improved the Big Boo's Haunt Merry-Go-Round checks for Mario.
2022-03-22 19:50:13 -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 dacc7d9b9c Allowed Lua mods to override player models and palettes 2022-03-10 18:23:25 -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 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
MysterD 37d1d70a59 Add collision_find_surface_on_ray() 2022-03-05 14:24:58 -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
MysterD a562c4be9b Add object animations to Lua, add CPointer allowlist 2022-03-03 18:31:45 -08:00
MysterD 3de0900bbc Initial custom behavior commit 2022-03-03 01:04:15 -08:00
MysterD a0832d0cfe 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 cba01d0b63 Added BehaviorScript pointer handling to Lua API 2022-02-22 18:29:30 -08:00
MysterD 52f3368756 Added object fields to Lua API 2022-02-19 13:51:02 -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 a9e6cd532a Added global textures 2022-02-15 22:14:55 -08:00
MysterD a73b828106 Created TextureInfo struct 2022-02-15 22:13:10 -08:00
MysterD 2d70b235ff Added CPointers to Lua/autogen 2022-02-15 22:09:21 -08:00
MysterD 369ea12bf4 Update lua docs 2022-02-13 22:18:03 -08:00
MysterD 0831fec716 Added read-only column to Lua struct documentation 2022-02-04 01:32:19 -08:00
MysterD f92ac3b472 Added immutable strings to autogen, added djui_popup_create 2022-02-03 00:42:31 -08:00
MysterD 39cefa6ec4 Added gNetworkPlayers to lua api 2022-02-02 19:24:51 -08:00
MysterD eefb52880c Autogenerated Lua documentation 2022-01-29 22:47:22 -08:00