Commit graph

271 commits

Author SHA1 Message Date
PeachyPeach
94c531272f
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
725e26fe83 Make bass sound interface easier to handle 2022-05-08 04:04:14 -07:00
MysterD
034ada738c Re-ran autogen 2022-05-08 00:29:17 -07:00
Beyley Thomas
b8553162c2
Add basic Bass audio engine (#58) 2022-05-08 00:25:09 -07:00
PeachyPeach
68e1b72b99
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
MysterD
cdcbdabb37 Allow Lua to get any vanilla texture 2022-05-07 03:05:25 -07:00
MysterD
ad6642a4bd Add support for custom HUD textures and faster texture packs w/o EXTERNAL_DATA 2022-05-06 22:03:12 -07:00
Agent X
b972bb1be4
Add surface_terrains.h to constants (#77) 2022-05-02 17:31:55 -07:00
Agent X
6466fbe457
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
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
Prince Frizzy
2a405b3233
Add two new LUA util functions. (#72) 2022-04-28 20:42:29 -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
71105833c5 Made specialTripleJump a field of MarioState instead of a global 2022-04-23 00:35:49 -07:00
MysterD
5cfef9abb3 Added gActiveMods global to lua 2022-04-22 18:44:59 -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
c8a0e6da10 Fixed player interactions 2022-04-21 00:48:26 -07:00
MysterD
4b63a16056 Added passes_pvp_interaction_checks() 2022-04-20 18:27:34 -07:00
MysterD
186149b2dd Merge branch 'unstable' of github.com:sm64ex-coop-dev/sm64ex-coop into unstable 2022-04-20 11:22:18 -07:00
MysterD
18d7140954 Add headPos to marioBodyState 2022-04-20 18:21:36 -07:00
PeachyPeach
9e5a45ecdd
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
2347ab61c1 Added HOOK_ON_OBJECT_RENDER 2022-04-19 22:36:47 -07:00
MysterD
dd6f6c430e Refactor how objects set their models 2022-04-19 18:47:50 -07:00
MysterD
6b67c983ec exposed sequence ids to lua 2022-04-15 21:51:18 -07:00
MysterD
fbce5f23c6 Added ability to set a level to skip credits, fixed SM74 bugs 2022-04-15 18:33:10 -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
ef4a83dc88 Quick fixes for test 2022-04-10 10:11:13 -07:00
MysterD
2c187bba45 Added default volume support for custom sequences 2022-04-10 09:47:17 -07:00
MysterD
9dc78a0971 Added support for custom music 2022-04-10 09:11:45 -07:00
MysterD
957e03cd81 Added HOOK_GET_STAR_COLLECTION_DIALOG 2022-04-10 02:44:11 -07:00
MysterD
958b04378c Add exit castle warp params to Lua 2022-04-10 02:29:44 -07:00
MysterD
15d6dc3a9c Allow ability to disable vanilla course-specific settings for camera 2022-04-10 01:55:11 -07:00
MysterD
3db42f1700 Allow coop mods to use the backup save slot independently of the normal one 2022-04-10 00:30:47 -07:00
MysterD
653ab58a5d Allow course names/acts to be changed from Lua 2022-04-09 23:28:36 -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
defb7dc830 Made trajectories overridable from Lua 2022-04-08 23:01:41 -07:00
MysterD
ef63435bc1 Un-hardcoded vanilla trajectories 2022-04-08 21:01:17 -07:00
MysterD
72584d5552 Refactored StarPositions 2022-04-08 19:46:01 -07:00
MysterD
37367a9756 Made the entry level configurable by Lua 2022-04-08 19:39:22 -07:00
MysterD
403bf30be9 Added custom level script overrides, warps work now 2022-04-08 19:29:16 -07:00
MysterD
6a7712b1c8 Allow Lua to adjust default star spawn positions 2022-04-08 00:37:20 -07:00
MysterD
3731ab31af Add more bhv functions and a func to ge tthe current save 2022-04-07 01:17:48 -07:00
MysterD
2187e7b4b3 Added behavior actions for rom hacks 2022-04-06 18:36:15 -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
Agent-11 / Agent X
746dd50c5c
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
046c595f92 More progress toward custom DynOS levels 2022-04-02 15:14:04 -07:00
MysterD
34d28ffb3c Ran autogen 2022-03-30 20:03:59 -07:00
MysterD
2115e4358d Fix compile errors / run autogen 2022-03-29 21:12:42 -07:00
MysterD
d74f5cfe61 Add custom collisions to DynOS/Lua 2022-03-28 01:02:33 -07:00
MysterD
de048928ce Added ability for Lua mods to adjust gServerSettings 2022-03-26 01:08:15 -07:00
MysterD
4a9e618efe Add set_mario_y_vel_based_on_fspeed() to lua 2022-03-26 00:01:13 -07:00
MysterD
b7be386200 Add gLakituState to Lua 2022-03-25 23:58:10 -07:00
MysterD
4d9ff3a3b1 Added a bunch of camera functions to Lua 2022-03-25 23:46:37 -07:00
MysterD
322e4983ae Add HOOK_ON_PAUSE_EXIT 2022-03-25 23:06:14 -07:00
MysterD
033b11ac22 Make new timers immutable 2022-03-25 21:39:03 -07:00
Isaac
65df754b09
Add save file flag functions to lua api (#41) 2022-03-24 19:30:15 -07:00
Prince Frizzy
a89aa6ced8
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
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
edf06bede0 Added ability for mods to load custom geos 2022-03-14 00:11:36 -07:00
MysterD
85d4012e89 Re-ran autogen 2022-03-13 00:25:36 -08: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
84aa5ad890
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
MysterD
3ce66ac312 Added hook: HOOK_ALLOW_PVP_ATTACK, disabled friendly fire in football 2022-03-12 23:43:47 -08:00
MysterD
08d4818ba7 Added Lua definitions for autocomplete in visual studio code 2022-03-12 21:28:57 -08:00