improved frame pacing, where frame delaying is done just before displaying the frame.
so, the frame is fully rendered, and then the delay is done to wait the extra time before displaying the frame.
This is a far more reliable and consistent way to manage frame pacing, and it will help to keep the framerate from choking too badly when the game lags a little.
The changes to `gfx_end_frame` is to minimize the steps necessary between delaying and actually displaying the frame. This is an optimization just to increase the accuracy of frame pacing even further.
Also, delta calculation is improved when the number of frames to draw is known.
Djui cursor movement is also updated every frame for smoother movement.
added these new djui hud tools for Lua:
- djui_hud_set_viewport
- djui_hud_reset_viewport
- djui_hud_set_scissor
- djui_hud_reset_scissor
- djui_hud_render_line - this code could already be done exactly. this is just to make rendering lines more efficient.
Also made nametags use a viewport for scaling in the credits.
Shared graph nodes were incorrectly interpolated, only the first object with a shared graph node was interpolated properly.
Thanks to @Cooliokid956 for noticing that most of node types were **never** interpolated.
- Use a double hashmap to store interpolated data for each graph node and object. All translations, rotations and scales are now interpolated correctly.
- Add `GraphNodeScaleXYZ` type to scale to all 3 dimensions; Add `GEO_SCALE_XYZ` command.
gMtxTbl was also reaching it's limit, so dynamic allocation was added.
geo layouts -> geo_* functions only
behaviors -> bhv_* functions only
level scripts -> lvl_* functions only
other -> no function allowed
thanks maniscat for reporting the issue
* 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>
This fixes inconsistent mappings between `sSm64CharMap` and `str_ascii_to_dialog` (used in `smlua_text_utils_dialog_replace`) to make the `text` field of `dialogEntry` consistent
`str_ascii_to_dialog` now also has mappings for the interpunct (`•`) and the double opening (`<<`) and closing (`>>`) quotes, which were missing before.
- No one complained about framerate since several updates now; don't fix what isn't broken
- Too much frames are drawn at low framerates when Vsync is enabled
- FPS and delay calculation are wrong with Vsync: 60 FPS looks like 30 with a 120+Hz monitor
- Fixed Auto mode that was broken
- Kept precise_delay_f64 as I have observed no noticeable impact on CPU
plus limited frame rates on the loading and crash screens to go easy on the cpu.
during gameplay, this new system is able to stay true to your fps limit without frame drops.
Vsync causes occasional frame drops by just 1 frame. this is an sdl issue and i know of no workaround; luckily it's very minor.
this commit changes frame pacing by moving frame delaying to just before the frame is displayed. a more precise delay function is also used.
* Apply scale correction for tile interpolation
Credit to wibble in coop cafe for figuring out the correction
* add error checking
* float -> f32
---------
Co-authored-by: MysterD <myster@d>
Lights are also zero indexed now which I could change to being one indexed but I think this is better anyway.
I restored ambient light objects setting it every frame since it broke a mod I was working on.
Sorry if any of these changes break anything you're working on dj.
Kaze would be proud though I bet
Previously to recompile DynOS assets you had to remove the
bin/lvl/bhv/tex/col/etc files. Now the game will compare the
last-modified-timestamps of the generated/compiled assets vs
the other files that are within those directories. If the presumed-
source files have a later modified timestamp DynOS will regenerate
those assets.
While this results in scanning the attributes of files more, it
also prevents parsing files unnecessarily. Previously actors
would always parse their source files and build up GfxData
unnecessarily.
---------
Co-authored-by: MysterD <myster@d>
* 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
* Fix warping from one custom level to another
* Remove cached level warps
* More comments, use LEVEL_UNKNOWN_X
* more readability
* clear custom level slots on unload
---------
Co-authored-by: MysterD <myster@d>
* type checking for dynos gfx symbol parsing
* peachy review
* better parameter counting
* using peachy's changes
* Update dynos_bin_gfx.cpp
seems like fast64 write 0 instead of NULL for null pointer, which is technically valid
---------
Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
Adds network_send_bytestring(), network_send_bytestring_to(), and
HOOK_ON_PACKET_BYTESTRING_RECEIVE
This is as close to raw bytes as you can get in lua. It allows you
to efficiently pack as much data as possible into each packet.
The existing network_send() was built for ease of use, but is quite
inefficient when you want to send a lot of data. Each number or int
field in the table amounts to 9 bytes for the key and 9 bytes for the
value. (amounting to 18 bytes per value). Whereas with the new method
you can pack that information into 1, 2, 4, or 8 bytes depending on
your type's size.
---------
Co-authored-by: MysterD <myster@d>
Just making a brief commit and thats all to add onto dj's lighting engine improvements because I heard about the PR, in mine I
* allowed all Vtx objects to be manipulated/retrieved
* updated lighting engine demo to be an SM64 night mode with a flashlight
* Fixed longterm bug where lighting bugs out unless you spawn a light
* Added new default LE mode LE_MODE_AFFECT_ALL_SHADED_AND_COLORED which also affects vertex colored surfaces
* Lighting engine improvements
Now objects will be affected by the lighting engine. This is
accomplished by passing the renderer the object's model matrix
(uncombined with the view or projection). You can now setup the
lighting engine mode to affect all shaded surfaces, lighting can
be affected by surface normals, and you can control what type of
tone mapping is applied.
added le_set_mode(mode)
By default we retain the previous behavior.
When set to LE_MODE_AFFECT_ALL_SHADED the lighting engine will
affect every shaded material.
This way we don't have to recompile every object and level that
we want shaded with special coop-specific commands
added le_get_mode()
added le_set_tone_mapping(toneMapping)
Tone mapping is what happens when a color value exceeds its 0-255
range.
By default we retain the current tone mapping (called
LE_TONE_MAPPING_TOTAL_WEIGHTED).
LE_TONE_MAPPING_WEIGHTED is now accessible, it was the tone
mapping that was previously left out of the compile through ifdefs.
LE_TONE_MAPPING_CLAMP is just simple additive with a clamp at a
color value of 255.
LE_TONE_MAPPING_REINHARD is reinhard tone mapping
(vout = (vin + 1) / vin).
added le_set_light_use_surface_normals(id, useSurfaceNormals)
By default lights retain their previous behavior (of ignoring
surface normals).
When enabled lights cast on one side of the object will not
appear on the other side of the object.
It is kind of like backface culling, but for lights.
added le_calculate_lighting_color_with_normal(pos, normal, outColor, lightIntensityScalar)
It's just like le_calculate_lighting_color(), but you can pass
in normals now.
* Removed normal calculation from vertex colored surfaces - they don't have normals
* Use packed normals correctly
* made LE_MODE_AFFECT_ALL_SHADED the default
* made useSurfaceNormals the default for lights
* Set ambient color, performed le_is_enabled() checks
The ambient color was black, which is why everything was dark by default.
If we set ambient to white then people will never see the effects of their
lights unless they set ambient to a lower value. So I added checks for
if a light has ever been added. The alternative would be to have something
like le_set_enabled()
* Rewrite how we obtain the model matrix - invert the camera
* run autogen
* Change default tonemapper to weighted, make setting ambient enable LE, fix null deref
* Address Peachy's comments
---------
Co-authored-by: MysterD <myster@d>
* 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
* Patches work when using git submodules (where .git is a file instead of a folder)
* Patches: Use git's build in error throwing to detect if the git repository is valid
* Fix dpad cursor logic in menus
Without this change, there is no way to get the cursor onto the ">" button in the public lobbies pagination without using a mouse, because the dpad/arrowkey logic skips over it strangely. Another alternative solution could be that the rules button and the back/reset buttons swap places.
* fixed brain fail in the djui cursor code
I forgot how ternaries worked whoops
* Added `xOffset` and `yOffset` to the `DjuiFont` struct to align the custom hud fonts
* Replaced `VL-Tones and CJes` CS pack with `The Originals` CS pack
* Removed the shading from the emblems and sideburns for `[CS] The Originals`
* Updated Djoslin0 Toad to give him recolorable hair and updated CJes and VL-Tones Luigi hud icons.
* Updated `[CS] The Originals` models to add missing reverts
* Wrong outdated Djoslin Toad model fix
* Added `math.tween` and along with common easing functions
* Fixed wrong implementation of `IN_OUT_ELASTIC`
* Added `OUT_IN` easing variants
* Fixed Incorrect `OUT_IN_SINE` function
* Fixed wrong `OUT_IN_ELASTIC` implementation