Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truckparser2021 prep (code cleanup only) #2829

Merged
merged 120 commits into from
May 28, 2022

Conversation

ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented Dec 2, 2021

This is only code cleanup - no feature changes.

I removed the remaining useless cruft I introduced back in 2013 when reworking the parser for the 1st time. A lot of it disappeared throughout the years but not all.
I also corrected all irregularities which appeared throughout the years in between.

The motivation for this is preparation for upcoming fixes:

  • 'sectionconfig' should be fully respected again (since 2013 it was auto-deduced from 'section/end_section').
  • 'section/end_section' should support multiple sectionconfigs at once (since 2013 it's been just 1).
  • 'nodes2' should have their numbers assigned on spawn (since 2013 it was during parsing, which broke the grand scheme of sectionconfig).
  • Lotus Esprit 007 should function again.

ohlidalp added 17 commits April 14, 2022 19:25
Parser: added *_set flags for all optional args
Spawner: respect *_set flags for all optional args
Serializer: don't write out un*_set flags
Actor.h/cpp: `CalcAnimators()` - Deleted outdated comments, useless params and dead code.
ActorForcesEuler.cpp: `CalcHydros()` - Removed dummy variable `flagstate`.
RigDef_File.h/RigDef_Parser.cpp/ActorSpawner.cpp: changed aeroengine number from 1-based to 0-based.
RigDef_File.h - corrected some Keyword names, added some missing
RigDef_Regexes.h - fixed alphabetical order of axles/authors, added missing keywords (not in use yet, but soon).
RigDef_File.cpp - added missing bits (many!) to KeywordToString()
parser/spawner - just find&replaced enum names.
'submesh', 'forset' are now directives.
'texcoords', 'cab' are now sections.
removed enum `Subsection`.
keywords "comment/end_comment" and "description/end_description" are now tracked by `m_current_block`, bools were removed.
ohlidalp added 20 commits May 27, 2022 20:04
function ActorSpawner::Setup() absorbed into ActorSpawner::SpawnActor(), which was then renamed to ProcessNewActor() to differentiate from GameContext::SpawnActor().

Also creating Renderdash moved at the start of ProcessNewActor()
CreateGfxActor() absorbed into ProcessNewActor()
GfxActor.h/cpp:  factored out InitializeSimBuffers() from constructor.
Removed temporary storage `m_gfx_nodes` in ActorSpawner.
GfxActor: created functions AddNode(), SetNodeHot().
ActorSpawner.h: Removed useless queuing mechanism
ActorSpawner.cpp: CreateBeamVisuals() now does full setup - absorbed code from GfxActor::AddRod()
GfxActor: simplified, just maintains an array of BeamGfx
ActorSpawner.h: eliminated "joke" Ticket/Queue system for wheel visuals. Added function CreateFlexBodyWheelVisuals()
ActorSpawner.cpp: wheel visuals code from FinalizeGfxSetup moved directly to [Build/Create]*Wheel*Visuals() functions, including the new one above.
GfxActor: consistency++ :)
GfxActor: func InitializeSimBuffers() absorbed into UpdateSimDataBuffer()
ActorSpawner: removed calls to InitializeSimBuffers()
motivation: I abandoned the notion of "attribute (xa_) vs. state (simbuf_)" elements.

SimBuffers.h: xa_ elements renamed to simbuf_ and distributed to their groups
GfxActor.h: removed func GetAttributes(). added members helpmat, helptex extracted from simbuffer.
GfxActor.cpp: major tidy-up of UpdateSimDataBuffer(), order matched to that of `struct ActorSB`.
ActorSpawner.cpp: assign new GfxActor members helpmat, helptex.
GUI_VehicleDescription.cpp: use helptex.
OverlayWrapper.cpp: use helpmat.
other sources: find&replace
Code migrated from functions `AddModule()`.
Deleted excess /** */ comments with minimal value.
Added doxygen groups.
While at it, I extracted the cab setup code to new function CreateCabVisual().
Removed temporary storage in ActorSpawner
function GfxActor::RegisterAirbrakes() absorbed by ActorSpawner::ProcessAirbrake().
GfxActor::AddMaterialFlare() -> ActorSpawner::CreateMaterialFlare()
motivation = consistency.
@ohlidalp ohlidalp force-pushed the truckparser2021prep branch from e839459 to 2502ac9 Compare May 27, 2022 18:09
@ohlidalp ohlidalp marked this pull request as ready for review May 27, 2022 19:14
@ohlidalp ohlidalp requested a review from tritonas00 May 27, 2022 19:15
@ohlidalp ohlidalp merged commit 6590779 into RigsOfRods:master May 28, 2022
@ohlidalp ohlidalp deleted the truckparser2021prep branch May 28, 2022 14:29
@tritonas00
Copy link
Collaborator

tritonas00 commented May 29, 2022

 else if (new_section == SECTION_FLEXBODIES)
    {
        m_current_subsection = SUBSECTION__FLEXBODIES__PROPLIKE_LINE;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants