-
Notifications
You must be signed in to change notification settings - Fork 230
unify(worldbuilder): Merge Generals and Zero Hour WorldBuilder #3025
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,8 @@ m_numPoints(0), | |
| m_sizePoints(0), | ||
| m_exportWithScripts(false), | ||
| m_isWaterArea(false), | ||
| m_shouldRender(true), | ||
| m_selected(false), | ||
| m_isRiver(FALSE), | ||
| m_riverStart(0) | ||
| { | ||
|
|
@@ -140,6 +142,7 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu | |
| Bool isRiver; | ||
| Int riverStart; | ||
| AsciiString triggerName; | ||
| AsciiString layerName; | ||
| // Remove any existing polygon triggers, if any. | ||
| PolygonTrigger::deleteTriggers(); // just in case. | ||
| PolygonTrigger *pPrevTrig = nullptr; | ||
|
|
@@ -148,6 +151,9 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu | |
| while (count>0) { | ||
| count--; | ||
| triggerName = file.readAsciiString(); | ||
| if (info->version >= K_TRIGGERS_VERSION_4) { | ||
| layerName = file.readAsciiString(); | ||
| } | ||
| triggerID = file.readInt(); | ||
| isWater = false; | ||
| if (info->version >= K_TRIGGERS_VERSION_2) { | ||
|
|
@@ -163,6 +169,9 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu | |
| numPoints = file.readInt(); | ||
| PolygonTrigger *pTrig = newInstance(PolygonTrigger)(numPoints+1); | ||
| pTrig->setTriggerName(triggerName); | ||
| if (info->version >= K_TRIGGERS_VERSION_4) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs to be behind
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same reasoning applies here. Generals can receive version 4 data when compatibility is disabled, so it needs to apply the serialized layer name. The version check ensures that version 1–3 files retain their existing layout and behavior. |
||
| pTrig->setLayerName(layerName); | ||
| } | ||
| pTrig->setWaterArea(isWater); | ||
| pTrig->setRiver(isRiver); | ||
| pTrig->setRiverStart(riverStart); | ||
|
|
@@ -224,7 +233,12 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu | |
| */ | ||
| void PolygonTrigger::WritePolygonTriggersDataChunk(DataChunkOutput &chunkWriter) | ||
| { | ||
| #if RETAIL_COMPATIBLE_WORLDBUILDER && RTS_GENERALS | ||
| // TheSuperHackers @info OmarAglan 30/07/2026 Retail Generals expects version 3 and does not read polygon trigger layer names. | ||
| chunkWriter.openDataChunk("PolygonTriggers", K_TRIGGERS_VERSION_3); | ||
| #else | ||
| chunkWriter.openDataChunk("PolygonTriggers", K_TRIGGERS_VERSION_4); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs to be behind
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in #3024. Both writer implementations now use |
||
| #endif | ||
|
|
||
| PolygonTrigger *pTrig; | ||
| Int count = 0; | ||
|
|
@@ -234,6 +248,9 @@ void PolygonTrigger::WritePolygonTriggersDataChunk(DataChunkOutput &chunkWriter) | |
| chunkWriter.writeInt(count); | ||
| for (pTrig=PolygonTrigger::getFirstPolygonTrigger(); pTrig; pTrig = pTrig->getNext()) { | ||
| chunkWriter.writeAsciiString(pTrig->getTriggerName()); | ||
| #if !(RETAIL_COMPATIBLE_WORLDBUILDER && RTS_GENERALS) | ||
| chunkWriter.writeAsciiString(pTrig->getLayerName()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs to be behind
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated alongside the version selection. |
||
| #endif | ||
| chunkWriter.writeInt(pTrig->getID()); | ||
| chunkWriter.writeByte(pTrig->isWaterArea()); | ||
| chunkWriter.writeByte(pTrig->isRiver()); | ||
|
|
@@ -480,7 +497,7 @@ const WaterHandle* PolygonTrigger::getWaterHandle() const | |
|
|
||
| Bool PolygonTrigger::isValid() const | ||
| { | ||
| if (m_numPoints == 0) { | ||
| if (m_numPoints < 2) { | ||
| return FALSE; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,8 @@ set(WORLDBUILDER_SRC | |
| "src/RampTool.cpp" | ||
| "src/RoadOptions.cpp" | ||
| "src/RoadTool.cpp" | ||
| "src/RulerOptions.cpp" | ||
| "src/RulerTool.cpp" | ||
| "src/SaveMap.cpp" | ||
| "src/ScorchOptions.cpp" | ||
| "src/ScorchTool.cpp" | ||
|
|
@@ -75,6 +77,7 @@ set(WORLDBUILDER_SRC | |
| "src/TeamBehavior.cpp" | ||
| "src/TeamGeneric.cpp" | ||
| "src/TeamIdentity.cpp" | ||
| "src/TeamObjectProperties.cpp" | ||
| "src/TeamReinforcement.cpp" | ||
| "src/teamsdialog.cpp" | ||
| "src/TerrainMaterial.cpp" | ||
|
|
@@ -156,6 +159,8 @@ set(WORLDBUILDER_SRC | |
| "include/RampTool.h" | ||
| "include/RoadOptions.h" | ||
| "include/RoadTool.h" | ||
| "include/RulerOptions.h" | ||
| "include/RulerTool.h" | ||
| "include/SaveMap.h" | ||
| "include/ScorchOptions.h" | ||
| "include/ScorchTool.h" | ||
|
|
@@ -171,6 +176,7 @@ set(WORLDBUILDER_SRC | |
| "include/TeamBehavior.h" | ||
| "include/TeamGeneric.h" | ||
| "include/TeamIdentity.h" | ||
| "include/TeamObjectProperties.h" | ||
| "include/TeamReinforcement.h" | ||
| "include/teamsdialog.h" | ||
| "include/TerrainMaterial.h" | ||
|
|
@@ -184,6 +190,7 @@ set(WORLDBUILDER_SRC | |
| "include/WaypointTool.h" | ||
| "include/WBFrameWnd.h" | ||
| "include/WBHeightMap.h" | ||
| "include/WBPopupSlider.h" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am I missing something or is this file not actually being added in this PR?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "include/wbview.h" | ||
| "include/wbview3d.h" | ||
| "include/WHeightMapEdit.h" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @stephanmeesters mentioned it already (but I don't see his comment appear here), this needs to be behind ZH guards or the Generals World Builder will no longer work properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the reader version gated rather than Zero Hour-only. With the updated writer logic in #3024, Generals writes version 3 by default, but it can still write version 4 when
RETAIL_COMPATIBLE_WORLDBUILDERis disabled. The Generals reader therefore still needs to understand version 4. Zero Hour continues writing and reading version 4.