Text&area#12
Closed
TrainWrack wants to merge 10 commits into
Closed
Conversation
* First iteration * Second iteration * Third iteration * Add namespaces * Cleanups * Address Copilot comments * Account for TE data type changes * Update spotcam.h * Naming consistency * Move spline function to Math/Utils * Add log message about missing flyby cameras * Move spotcams to level struct, hide internal vectors, naming consistency * Demagic * Update spotcam.h * Address PR comments * Address PR comments * Update Utils.cpp * Align pause duration with tomb4 source * Update spotcam.cpp * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Stranger1992 <84292688+Stranger1992@users.noreply.github.com>
* First iteration * Update 1_GlobalVars.h * Address PR comments * Update CHANGELOG.md * Update savegame.cpp
There was a problem hiding this comment.
Pull request overview
This PR expands TombEngine’s UI/rendering and scripting layer by introducing new View types for drawing/clipping text and sprites, adds scissor/priority-aware rendering support, and includes a Lua Achievements module that uses the UI primitives.
Changes:
- Add
TEN.View.DisplayStringandTEN.View.DisplayAreaLua-exposed types (including clipping/scissor support and debug visualization). - Extend renderer string rendering to support Vector2 scaling, rotation, per-string priority/blend, and scissor rects; add unified “display layers” drawing.
- Add a configurable Lua Achievements system (popup + full-screen list) under
Scripts/Engine/Achievements.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| TombEngine/TombEngine.vcxproj | Adds new DisplayArea/DisplayString sources to the build. |
| TombEngine/Scripting/Internal/TEN/View/ViewHandler.cpp | Registers new View usertypes (DisplayArea/DisplayString). |
| TombEngine/Scripting/Internal/TEN/View/DisplayString/ScriptDisplayString.h | Declares new script-facing DisplayString type. |
| TombEngine/Scripting/Internal/TEN/View/DisplayString/ScriptDisplayString.cpp | Implements DisplayString registration, anchors, and Draw() integration with renderer. |
| TombEngine/Scripting/Internal/TEN/View/DisplayArea/ScriptDisplayArea.h | Declares script-facing clipping area that can draw items. |
| TombEngine/Scripting/Internal/TEN/View/DisplayArea/ScriptDisplayArea.cpp | Implements DisplayArea drawing, scissor activation, and debug overlay. |
| TombEngine/Scripting/Internal/ReservedScriptNames.h | Adds reserved script names for new View APIs. |
| TombEngine/Renderer/Structures/RendererStringToDraw.h | Extends queued string data (Vector2 scale, rotation, priority, blend, scissor). |
| TombEngine/Renderer/Structures/RendererSprite2D.h | Adds scissor rectangle metadata to 2D sprite draws. |
| TombEngine/Renderer/RendererString.cpp | Adds string measurement API + scissor/blend/priority-aware string batching. |
| TombEngine/Renderer/RendererDrawMenu.cpp | Switches menu render path to unified display-layer drawing and resets cached GPU state after ClearState(). |
| TombEngine/Renderer/RendererDraw2D.cpp | Adds scissor handling for display sprites and introduces DrawAllDisplayLayers(). |
| TombEngine/Renderer/RendererDraw.cpp | Uses unified display-layer drawing in the main scene path; clears debug rects; resets cached GPU state after ClearState(). |
| TombEngine/Renderer/Renderer.h | Declares new renderer APIs (display layers, debug rects, string sizing/internal add). |
| TombEngine/Game/effects/DisplaySprite.h | Adds global “active display scissor” API and per-sprite scissor fields. |
| TombEngine/Game/effects/DisplaySprite.cpp | Implements global scissor state and propagates it into queued display sprites. |
| Scripts/Engine/Achievements/Settings.lua | Adds achievement UI configuration (popup, list viewer, progress bar). |
| Scripts/Engine/Achievements/Popup.lua | Implements queued popup notifications. |
| Scripts/Engine/Achievements/List.lua | Implements FULL-freeze list viewer with scrolling and progress display. |
| Scripts/Engine/Achievements/Input.lua | Implements scroll acceleration input helper. |
| Scripts/Engine/Achievements/Block.lua | Shared renderer for an achievement “block” (background/icon/text). |
| Scripts/Engine/Achievements/Achievements.lua | Achievements entry point + persistence via GameVars + callback wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+250
to
+254
| ResetScissor(); | ||
| _spriteBatch->Begin(SpriteSortMode_Deferred, nullptr, nullptr, nullptr, _cullNoneRasterizerState.Get()); | ||
|
|
||
| auto currentBlend = BlendMode::AlphaBlend; | ||
| SetBlendMode(currentBlend); |
|
|
||
| // Utilities | ||
| ScriptDisplayAnchors GetAnchors(sol::optional<DisplaySpriteAlignMode> alignModeOpt, sol::optional<DisplaySpriteScaleMode> scaleModeOpt) const; | ||
| void Draw(sol::optional<int> priority, sol::optional<int> alignMode, sol::optional<int> blendMode); |
| arrowColor = TEN.Color(255, 255, 255), | ||
| arrowAlignMode = TEN.View.AlignMode.CENTER, | ||
| arrowScaleMode = TEN.View.ScaleMode.FIT, | ||
| arrowBlendMode = TEN.Effects.BlendID.ALPHABLEND, |
Comment on lines
+668
to
+672
| // Insert 3D display items at the transition from negative to non-negative priority. | ||
| if (!itemsDrawn && priority >= 0) | ||
| { | ||
| DrawDisplayItems(); | ||
| itemsDrawn = true; |
Comment on lines
+43
to
+46
| float baseScale = stringScale.y; | ||
|
|
||
| auto wtext = TEN::Utils::ToWString(text); | ||
| auto measured = Vector2(_gameFont->MeasureString(wtext.c_str())) * baseScale; |
Comment on lines
+117
to
119
| float wordWidth = Vector3(_gameFont->MeasureString(word.c_str())).x * baseScale; | ||
|
|
||
| if (!currentLine.empty() && (currentLineWidth + wordWidth + spaceWidth > area.x * factor.x)) |
* Fixed partially 0...1 range * Removed 2.0f factor in special effects like flame emitters, smoke emitters, etc; Removed saturate from ModulateColor function; * Pack colors to uint for saving bandwidth on GPU; Fixed sprites colors range; * Fixed some coefficients and bad modulations * Fixed inventory light * New fixes to normalization * Fixed color modulation * Fixed again color range * Fixed multiple issues * Revert incorrect color multiplication * More fixes * Restore full alpha for colored flames which was previously unset by Lerp operation * Premultiply object tint alpha in vertex shader, revert multiplication * Update LaserBarrier.cpp * Remove unnecessary menu hack * Added gamma correction setting * Fixed muzzle brightness * Fixed swarm enemy tint * Update RendererDraw.cpp * Remove unnecessary argument from shaders * Update effects.h * Fixed legacy SpawnDynamicLight color range * Update RendererInit.cpp * Use AMBIENT_COLOR constant for DisplayItem * Address Copilot comments * Update RGBAColor8Byte.cpp * Minor code cleanups * Update CHANGELOG.md * Update CHANGELOG.md * Fix room/item lighting range and vertex glow overbrightness - Remove ModulateColor wrapping around RoomLights and CombineLights dynamic light colors. The saturate() inside DoPointLight clamped the pre-modulated values to [0, 1], which was then halved again by the reduced ROOM_LIGHT_COEFF (0.7), making dynamic lights only half as bright as on develop. - Restore ROOM_LIGHT_COEFF to 1.4 to match develop. - Halve the vertex Glow intensity to compensate for the ModulateColor (* 2) applied in the pixel shader. Without this, glow values end up twice as prominent relative to develop where ModulateColor doesn't exist. * Reverted ROOM_LIGHT_COEFF value and moved 2X factor in formula * Apply ModulateColor to light results instead of light colors Wrap DoPointLight/DoSpotLight/DoDirectionalLight/DoShadowLight and specular results with ModulateColor() post-saturate, rather than modulating input light colors pre-saturate where the internal saturate() would eat the scale factor. This compensates for light colors being in [0, 1] range (new TE) instead of [0, 2] (old TE), using ModulateColor as a single control point for the scale factor. * Fixed issues with colored light and waterfall objects * Use NEUTRAL_COLOR in remaining cases * Fixed flare intensity * Fixed steam emitter and electric light * Fix FirePendulum color normalization to [0,1] range * Add missing changes to initializers * fix electricball, waterfallemitter, laserbeam, laserbarrier * LaserBeam/Barrier: Shader-side color and brightness fixed * pushed real Laserbarrier/Beam colorfix again * Fix fog bulbs being half as bright due to missing ModulateColor * fixed waterfallemitter density * update waterfallEmitter density fix * Fixed sprite brightness * Correct waterfall color scale * Rollback brightness compensation * Use data types according to coding conventions * Fixed burning torch color * Move lambda within the function * Update CHANGELOG.md * fixed moculatecolor for laserbeam/barriere in sprites/instancedSprites.hlsl * Use proper data types in ScriptColor * Fixed issues with postprocess tint and gamma setting value drift * Move brightness calculation to postprocess shader * Use correct gamma correction formula * Address Copilot comments * Use GAMMA_STEP in configuration as well * Cleanups * Also apply gamma correction to linear inventory --------- Co-authored-by: Stranger1992 <84292688+Stranger1992@users.noreply.github.com> Co-authored-by: davidmarr <116632612+davidmarr@users.noreply.github.com> Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com> Co-authored-by: Nemoel-Tomo <tomo_669@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
CHANGELOG.mdfile on the branch/fork (if it is an internal change, this is not needed).Links to issue(s) this pull request concerns (if applicable)
(Replace this sentence with links to issues this PR concerns. If not applicable, please write "N/A").
Pull request description