Allows modders to play audio streams on channels other than level background music.
4 constants have been added for this purpose:
- `MOD_AUDIO_CHANNEL_MASTER` - sound is only affected by master volume
- `MOD_AUDIO_CHANNEL_MUSIC` - sound is affected by music volume, same as previous behaviour
- `MOD_AUDIO_CHANNEL_SFX` - sound is affected by sfx volume, same as sample behaviour
- `MOD_AUDIO_CHANNEL_ENV` - sound is affected by env volume
This was done instead of using the existing `SEQ_PLAYER_*` constants to avoid confusion and because there isn't a `NONE`/`MASTER` option.
Additionally, sets the default to `MOD_AUDIO_CHANNEL_MUSIC` as to not break compatibility.
```lua
audio_stream_set_volume_channel(stream, MOD_AUDIO_CHANNEL_SFX) -- wow its just like a sample
audio_stream_get_volume_channel(stream) -- returns MOD_AUDIO_CHANNEL_SFX (its actually 2)
```
- Add `smlua_collision_add_surface`, `_move_surface`, `_delete_surface` Lua APIs
- Add `remove_static_object_collision` to fully free a SOC and its surfaces
- Split surface pools into separate static, SOC, and dynamic pools
- Replace index-based SOC tracking with unique ID counter (`sSOCIdCounter`)
- Invalidate Lua CObjects for recycled surfaces on pool clear
- Expose `SURFACE_POOL_STATIC/DYNAMIC/SOC` constants to Lua
- Add `growing_array_swap_and_pop` and `growing_array_swap_and_pop_index` to memory utils
Co-authored-by: MysterD <myster@d>
* Fix nametags color and rendering order
* make growing_array_init reuse array and buffer if they were already allocated
* use prim color for text color
* isaac review
* update text color descriptions
* small optimization
- Drastically improve and optimize display list usage for text
- Add text alignment with and without interpolation, and color codes, new lines and tabs are now handled properly
- Restored alpha color code (`#RGBA` or `#RRGGBBAA`) for `djui_print_text` functions (regular DJUI text allows alpha color codes, but ignores the alpha component)
- Add constants for common text alignment and rotation pivot values
- Fix interpolation issues with all `djui_hud` elements
- A few autogen fixes (missing `number` type for constants, missing return values for some functions)
- Fix recolorable hud font offsets on `e`, `i` and `o` letters
Hue, saturation, brightness, contrast, exposure, dithering, posterization
Global = usually an object in the world
Non global = usually a screen element
Also:
* Changed skyboxes to use environment color instead of vertex color, visually identical
* Changed hud head texture to be non global
* changed power meter to be non global
* changed sparkles to be global
* changed some BBH vertex types to global
OpenGL renderer supported only for now.
* Allow multiple returns in autogen functions
* condense function member names
* This shouldn't be here
* Relocate these functions
LVT_FIELD shouldn't be there yet
* multi-return part 2: most functions are usable now
---------
Co-authored-by: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com>
* djui_hud_get_mouse_locked()
Adds a total of 1 function:
# `bool djui_hud_get_mouse_locked()`
Returns the DJUI mouse lock status
Tip: This won't return the true state of mouse lock, so make sure to use `get_first_person_enabled()` and `camera_config_is_mouse_look_enabled()` as well
---
This also fills in some descriptions left out by Isaac in his viewport/scissor functions
* djui_hud_is_mouse_locked()
Same as before but is
* this is better imo
* zip + json properties; check existing file in create file
* smlua_audio_utils_replace_sequence
* audio_stream_load, audio_sample_load, smlua_model_util_get_id
* get_texture_info + can also load PNG files
* smlua_collision_util_get
* add wildcard in properties files + set text mode
* filepath restrictions
* Some mod_storage improvements
- Cache mod storage files into a map to reduce file I/O
- Fix a bug in mod_storage_save
- Add mod_storage_load_all that returns all keys/values as a table
* shutdown; fix buffer overflow; fix warnings; lua table
* reject binary files starting with MZ or ELF
* function members
* better doc
* adding file rewind
* ModFS guide; replace yaml by ini; read string buffer changes
* wip
* get rid of seg2_dialog_table and fix crashes
* remove unused include
* change more types to s32
* remove dialog tables from eu_translation.h
* fix dialog_table_get signature
* Change `oToadMessageDialogId` to s32
* remove exit from dialog_table_add
* warning
* calloc allocated dialogs
* avoid memcpy on allocation fail
* Move dialog entry text field init to dialog_table_init
* Free original dialog entries' text field
* Put all reset logic in one place
* Run autogen
* Remove ``get_dialog_text_ascii`` from autogen
* minor fix
* free dialog->str if replaced
* nevermind
* remove get_dialog_unmodified from autogen
* Change -1 to DIALOG_NONE
* update stuff to s32
* use growing array functions
* Change limit to something more reasonable
* add null check
* remove explicit cast
* Minor fixes
* more type fix
* peachy review
* Fix weird enums in autogen
* remove extra newline :p
* add dialog restore
* bump max dialogs just a lil bit 🥺
* add lua behavior params
* all OBJECT fields are now Lua variables
* Revert lua behavior params changes
* isaac review
* fix segfault
---------
Co-authored-by: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com>
* modfs; optional function parameters in autogen
* errors and stuff
* script to turn a directory into a modfs file and vice versa
* bug fixes
* read: raise error on eof
* properly check eof on read_string
* fill; reload; check pointer validity; skip private files when loading non-active modfs
* added bytestrings
* move ByteString to smlua_utils.h
* Add new dialog functions
* Add missing symbols to charmap
* Fix the crashing
* Add braces to if statement
* Implement Isaac's suggestion
* Add override return type to autogen
* Update comment
* Add text field to `DialogEntry`
* wtf??
* Peachy requests
The old version was incrementing at the start of the code iteration, but it makes
more sense to increment after the frame is built. That way every event within one
visible game tick will get the same tick identifier
Co-authored-by: MysterD <myster@d>
Coop now maintains a counter that increments at the start of each game tick,
And another counter that increments at the start of each frame render.
This is to be able to identify specific frames regardless of mod load, hook,
and execution order.
---------
Co-authored-by: MysterD <myster@d>
* More math improvements
* more math functions
* stack check
* added error message when trying to modify read-only table; fix gSmluaConstants printed to console
- Renamed the `new` and `realloc` functions to `create` and `resize`
- Added `delete_all`
- Made Mod Data a class:
- Allocation is now limited to prevent out-of-memory crashes: 1024 display lists of max size 2048 and 1024 vertex buffers of max size 4096 per mod
- Added error codes to identify the cause of a failure (name not found, pointer not found, max size exceeded, item pool is full, ...)