-
Notifications
You must be signed in to change notification settings - Fork 182
feat: Raw reading on zone load and scene tools #1910
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
Open
aronwk-aaron
wants to merge
32
commits into
main
Choose a base branch
from
raw-parsing-for-scene-data
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
12fd9d0
Impl raw reading, and some slash commands to test with scenes
aronwk-aaron accdb4f
Correct scene making, merged the old raw into the new.
aronwk-aaron 893d127
idk
aronwk-aaron 2d744af
Merge branch 'main' into raw-parsing-for-scene-data
aronwk-aaron 6ea46ef
NL@EOF
aronwk-aaron 09ca193
Merge branch 'raw-parsing-for-scene-data' of https://github.com/Darkf…
aronwk-aaron ae20974
better algo for finding what scene we are in
aronwk-aaron 19637a9
missed staging a line
aronwk-aaron c87c9c2
don't try to load the raw if the map version is too old
aronwk-aaron 20c05cb
clamp search to bounds
aronwk-aaron 0b4f888
Merge branch 'main' into raw-parsing-for-scene-data
aronwk-aaron b7a1ef3
whoops
aronwk-aaron c9bcad3
Update dZoneManager/Raw.cpp
aronwk-aaron a1ab595
Update dZoneManager/Raw.cpp
aronwk-aaron 02b102d
Update dZoneManager/Raw.cpp
aronwk-aaron 87f221b
Update dZoneManager/Raw.cpp
aronwk-aaron 0c8411d
Update dGame/dUtilities/SlashCommands/DEVGMCommands.cpp
aronwk-aaron ec8d514
Update dGame/dUtilities/SlashCommands/DEVGMCommands.cpp
aronwk-aaron 705a9ab
Update dZoneManager/dZoneManager.cpp
aronwk-aaron b50e9d9
Update dCommon/NiColor.h
aronwk-aaron aea9009
Update dZoneManager/Zone.cpp
aronwk-aaron a826949
Update dGame/dUtilities/SlashCommands/DEVGMCommands.cpp
aronwk-aaron 64c3319
fix: guard against division by zero in GetSceneIDFromPosition
Copilot 6ea6ca4
fix: prevent overflow/OOM in Raw chunk parsing and fix global scene I…
Copilot 5b9f7e0
fix: add explicit guards before sceneMapI/J computation in GetSceneID…
Copilot c6a38e3
Update dZoneManager/Raw.h
aronwk-aaron fbac324
Update dZoneManager/dZoneManager.cpp
aronwk-aaron d51ad3e
Update dZoneManager/Raw.cpp
aronwk-aaron f66716f
fix: validate numChunks, numFlairs, vertSize before resize to prevent…
Copilot d5bacab
fix: add width/height/scaleFactor guards in SpawnScenePoints to preve…
Copilot f623053
fix: change SceneColor::Get parameter from unsigned char to uint8_t
Copilot d725da7
fix: add scaleFactor/width/height guards in GenerateTerrainMesh, fix …
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #ifndef NICOLOR_H | ||
| #define NICOLOR_H | ||
|
|
||
| struct NiColor { | ||
| float m_Red; | ||
| float m_Green; | ||
| float m_Blue; | ||
|
|
||
| NiColor(float red, float green, float blue) : m_Red(red), m_Green(green), m_Blue(blue) {} | ||
| NiColor() : NiColor(0.0f, 0.0f, 0.0f) {} | ||
|
|
||
| /* reduce RGB files to grayscale, with or without alpha | ||
| * using the equation given in Poynton's ColorFAQ at | ||
| * <http://www.inforamp.net/~poynton/> // dead link | ||
| * Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net | ||
| * | ||
| * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B | ||
| * | ||
| * We approximate this with | ||
| * | ||
| * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B | ||
| * | ||
| * which can be expressed with integers as | ||
| * | ||
| * Y = (6969 * R + 23434 * G + 2365 * B)/32768 | ||
| * | ||
| * The calculation is to be done in a linear colorspace. | ||
| * | ||
| * Other integer coefficents can be used via png_set_rgb_to_gray(). | ||
| */ | ||
| float ToXYZ() const { return (m_Red * 0.212671f) + (m_Green * 0.71516f) + (m_Blue * 0.072169f); }; | ||
| }; | ||
|
|
||
| #endif // NICOLOR_H | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| #ifndef SCENE_COLOR_H | ||
| #define SCENE_COLOR_H | ||
aronwk-aaron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #include "NiColor.h" | ||
| #include <cstdint> | ||
| #include <vector> | ||
|
|
||
| class SceneColor { | ||
| public: | ||
| SceneColor() { | ||
| TEMPLATE_COLORS.resize(146); | ||
|
|
||
| // these are not random values, they are the actual template colors used by the game | ||
| TEMPLATE_COLORS[0] = NiColor(0.5019608f, 0.5019608f, 0.5019608f); | ||
| TEMPLATE_COLORS[1] = NiColor(1.0f, 0.0f, 0.0f); | ||
| TEMPLATE_COLORS[2] = NiColor(0.0f, 1.0f, 0.0f); | ||
| TEMPLATE_COLORS[3] = NiColor(0.0f, 0.0f, 1.0f); | ||
| TEMPLATE_COLORS[4] = NiColor(1.0f, 1.0f, 0.0f); | ||
| TEMPLATE_COLORS[5] = NiColor(1.0f, 0.0f, 1.0f); | ||
| TEMPLATE_COLORS[6] = NiColor(0.0f, 1.0f, 1.0f); | ||
| TEMPLATE_COLORS[7] = NiColor(0.5019608f, 0.0f, 1.0f); | ||
| TEMPLATE_COLORS[8] = NiColor(1.0f, 0.5019608f, 0.0f); | ||
| TEMPLATE_COLORS[9] = NiColor(1.0f, 0.5019608f, 0.5019608f); | ||
| TEMPLATE_COLORS[10] = NiColor(0.5019608f, 0.2509804f, 0.0f); | ||
| TEMPLATE_COLORS[11] = NiColor(0.5019608f, 0.0f, 0.2509804f); | ||
| TEMPLATE_COLORS[12] = NiColor(0.0f, 0.5019608f, 0.2509804f); | ||
| TEMPLATE_COLORS[13] = NiColor(0.2509804f, 0.0f, 0.5019608f); | ||
| TEMPLATE_COLORS[14] = NiColor(0.8745098f, 0.0f, 0.2509804f); | ||
| TEMPLATE_COLORS[15] = NiColor(0.2509804f, 0.8745098f, 0.5019608f); | ||
| TEMPLATE_COLORS[16] = NiColor(1.0f, 0.7490196f, 0.0f); | ||
| TEMPLATE_COLORS[17] = NiColor(1.0f, 0.2509804f, 0.0627451f); | ||
| TEMPLATE_COLORS[18] = NiColor(0.2509804f, 0.0f, 0.8745098f); | ||
| TEMPLATE_COLORS[19] = NiColor(0.7490196f, 0.0627451f, 0.0627451f); | ||
| TEMPLATE_COLORS[20] = NiColor(0.0627451f, 0.7490196f, 0.0627451f); | ||
| TEMPLATE_COLORS[21] = NiColor(1.0f, 0.5019608f, 1.0f); | ||
| TEMPLATE_COLORS[22] = NiColor(0.9372549f, 0.8705882f, 0.8039216f); | ||
| TEMPLATE_COLORS[23] = NiColor(0.8039216f, 0.5843138f, 0.4588235f); | ||
| TEMPLATE_COLORS[24] = NiColor(0.9921569f, 0.8509804f, 0.7098039f); | ||
| TEMPLATE_COLORS[25] = NiColor(0.4705882f, 0.8588235f, 0.8862745f); | ||
| TEMPLATE_COLORS[26] = NiColor(0.5294118f, 0.6627451f, 0.4196078f); | ||
| TEMPLATE_COLORS[27] = NiColor(1.0f, 0.6431373f, 0.454902f); | ||
| TEMPLATE_COLORS[28] = NiColor(0.9803922f, 0.9058824f, 0.7098039f); | ||
| TEMPLATE_COLORS[29] = NiColor(0.6235294f, 0.5058824f, 0.4392157f); | ||
| TEMPLATE_COLORS[30] = NiColor(0.9921569f, 0.4862745f, 0.4313726f); | ||
| TEMPLATE_COLORS[31] = NiColor(0.0f, 0.0f, 0.0f); | ||
| TEMPLATE_COLORS[32] = NiColor(0.6745098f, 0.8980392f, 0.9333333f); | ||
| TEMPLATE_COLORS[33] = NiColor(0.1215686f, 0.4588235f, 0.9960784f); | ||
| TEMPLATE_COLORS[34] = NiColor(0.6352941f, 0.6352941f, 0.8156863f); | ||
| TEMPLATE_COLORS[35] = NiColor(0.4f, 0.6f, 0.8f); | ||
| TEMPLATE_COLORS[36] = NiColor(0.05098039f, 0.5960785f, 0.7294118f); | ||
| TEMPLATE_COLORS[37] = NiColor(0.4509804f, 0.4f, 0.7411765f); | ||
| TEMPLATE_COLORS[38] = NiColor(0.8705882f, 0.3647059f, 0.5137255f); | ||
| TEMPLATE_COLORS[39] = NiColor(0.7960784f, 0.254902f, 0.3294118f); | ||
| TEMPLATE_COLORS[40] = NiColor(0.7058824f, 0.4039216f, 0.3019608f); | ||
| TEMPLATE_COLORS[41] = NiColor(1.0f, 0.4980392f, 0.2862745f); | ||
| TEMPLATE_COLORS[42] = NiColor(0.9176471f, 0.4941176f, 0.3647059f); | ||
| TEMPLATE_COLORS[43] = NiColor(0.6901961f, 0.7176471f, 0.7764706f); | ||
| TEMPLATE_COLORS[44] = NiColor(1.0f, 1.0f, 0.6f); | ||
| TEMPLATE_COLORS[45] = NiColor(0.1098039f, 0.827451f, 0.6352941f); | ||
| TEMPLATE_COLORS[46] = NiColor(1.0f, 0.6666667f, 0.8f); | ||
| TEMPLATE_COLORS[47] = NiColor(0.8666667f, 0.2666667f, 0.572549f); | ||
| TEMPLATE_COLORS[48] = NiColor(0.1137255f, 0.6745098f, 0.8392157f); | ||
| TEMPLATE_COLORS[49] = NiColor(0.7372549f, 0.3647059f, 0.345098f); | ||
| TEMPLATE_COLORS[50] = NiColor(0.8666667f, 0.5803922f, 0.4588235f); | ||
| TEMPLATE_COLORS[51] = NiColor(0.6039216f, 0.8078431f, 0.9215686f); | ||
| TEMPLATE_COLORS[52] = NiColor(1.0f, 0.7372549f, 0.8509804f); | ||
| TEMPLATE_COLORS[53] = NiColor(0.9921569f, 0.8588235f, 0.427451f); | ||
| TEMPLATE_COLORS[54] = NiColor(0.1686275f, 0.4235294f, 0.7686275f); | ||
| TEMPLATE_COLORS[55] = NiColor(0.9372549f, 0.8039216f, 0.7215686f); | ||
| TEMPLATE_COLORS[56] = NiColor(0.4313726f, 0.3176471f, 0.3764706f); | ||
| TEMPLATE_COLORS[57] = NiColor(0.8078431f, 1.0f, 0.1137255f); | ||
| TEMPLATE_COLORS[58] = NiColor(0.427451f, 0.682353f, 0.5058824f); | ||
| TEMPLATE_COLORS[59] = NiColor(0.7647059f, 0.3921569f, 0.772549f); | ||
| TEMPLATE_COLORS[60] = NiColor(0.8f, 0.4f, 0.4f); | ||
| TEMPLATE_COLORS[61] = NiColor(0.9058824f, 0.7764706f, 0.5921569f); | ||
| TEMPLATE_COLORS[62] = NiColor(0.9882353f, 0.8509804f, 0.4588235f); | ||
| TEMPLATE_COLORS[63] = NiColor(0.6588235f, 0.8941177f, 0.627451f); | ||
| TEMPLATE_COLORS[64] = NiColor(0.5843138f, 0.5686275f, 0.5490196f); | ||
| TEMPLATE_COLORS[65] = NiColor(0.1098039f, 0.6745098f, 0.4705882f); | ||
| TEMPLATE_COLORS[66] = NiColor(0.06666667f, 0.3921569f, 0.7058824f); | ||
| TEMPLATE_COLORS[67] = NiColor(0.9411765f, 0.9098039f, 0.5686275f); | ||
| TEMPLATE_COLORS[68] = NiColor(1.0f, 0.1137255f, 0.8078431f); | ||
| TEMPLATE_COLORS[69] = NiColor(0.6980392f, 0.9254902f, 0.3647059f); | ||
| TEMPLATE_COLORS[70] = NiColor(0.3647059f, 0.4627451f, 0.7960784f); | ||
| TEMPLATE_COLORS[71] = NiColor(0.7921569f, 0.2156863f, 0.4039216f); | ||
| TEMPLATE_COLORS[72] = NiColor(0.2313726f, 0.6901961f, 0.5607843f); | ||
| TEMPLATE_COLORS[73] = NiColor(0.9882353f, 0.7058824f, 0.8352941f); | ||
| TEMPLATE_COLORS[74] = NiColor(1.0f, 0.9568627f, 0.3098039f); | ||
| TEMPLATE_COLORS[75] = NiColor(1.0f, 0.7411765f, 0.5333334f); | ||
| TEMPLATE_COLORS[76] = NiColor(0.9647059f, 0.3921569f, 0.6862745f); | ||
| TEMPLATE_COLORS[77] = NiColor(0.6666667f, 0.9411765f, 0.8196079f); | ||
| TEMPLATE_COLORS[78] = NiColor(0.8039216f, 0.2901961f, 0.2980392f); | ||
| TEMPLATE_COLORS[79] = NiColor(0.9294118f, 0.8196079f, 0.6117647f); | ||
| TEMPLATE_COLORS[80] = NiColor(0.5921569f, 0.6039216f, 0.6666667f); | ||
| TEMPLATE_COLORS[81] = NiColor(0.7843137f, 0.2196078f, 0.3529412f); | ||
| TEMPLATE_COLORS[82] = NiColor(0.9372549f, 0.5960785f, 0.6666667f); | ||
| TEMPLATE_COLORS[83] = NiColor(0.9921569f, 0.7372549f, 0.7058824f); | ||
| TEMPLATE_COLORS[84] = NiColor(0.1019608f, 0.282353f, 0.4627451f); | ||
| TEMPLATE_COLORS[85] = NiColor(0.1882353f, 0.7294118f, 0.5607843f); | ||
| TEMPLATE_COLORS[86] = NiColor(0.772549f, 0.2941177f, 0.5490196f); | ||
| TEMPLATE_COLORS[87] = NiColor(0.09803922f, 0.454902f, 0.8235294f); | ||
| TEMPLATE_COLORS[88] = NiColor(0.7294118f, 0.7215686f, 0.4235294f); | ||
| TEMPLATE_COLORS[89] = NiColor(1.0f, 0.4588235f, 0.2196078f); | ||
| TEMPLATE_COLORS[90] = NiColor(1.0f, 0.1686275f, 0.1686275f); | ||
| TEMPLATE_COLORS[91] = NiColor(0.972549f, 0.8352941f, 0.4078431f); | ||
| TEMPLATE_COLORS[92] = NiColor(0.9019608f, 0.6588235f, 0.8431373f); | ||
| TEMPLATE_COLORS[93] = NiColor(0.254902f, 0.2901961f, 0.2980392f); | ||
| TEMPLATE_COLORS[94] = NiColor(1.0f, 0.4313726f, 0.2901961f); | ||
| TEMPLATE_COLORS[95] = NiColor(0.1098039f, 0.6627451f, 0.7882353f); | ||
| TEMPLATE_COLORS[96] = NiColor(1.0f, 0.8117647f, 0.6705883f); | ||
| TEMPLATE_COLORS[97] = NiColor(0.772549f, 0.8156863f, 0.9019608f); | ||
| TEMPLATE_COLORS[98] = NiColor(0.9921569f, 0.8666667f, 0.9019608f); | ||
| TEMPLATE_COLORS[99] = NiColor(0.08235294f, 0.5019608f, 0.4705882f); | ||
| TEMPLATE_COLORS[100] = NiColor(0.9882353f, 0.454902f, 0.9921569f); | ||
| TEMPLATE_COLORS[101] = NiColor(0.9686275f, 0.5607843f, 0.654902f); | ||
| TEMPLATE_COLORS[102] = NiColor(0.5568628f, 0.2705882f, 0.5215687f); | ||
| TEMPLATE_COLORS[103] = NiColor(0.454902f, 0.2588235f, 0.7843137f); | ||
| TEMPLATE_COLORS[104] = NiColor(0.6156863f, 0.5058824f, 0.7294118f); | ||
| TEMPLATE_COLORS[105] = NiColor(1.0f, 0.2862745f, 0.4235294f); | ||
| TEMPLATE_COLORS[106] = NiColor(0.8392157f, 0.5411765f, 0.3490196f); | ||
| TEMPLATE_COLORS[107] = NiColor(0.4431373f, 0.2941177f, 0.1372549f); | ||
| TEMPLATE_COLORS[108] = NiColor(1.0f, 0.282353f, 0.8156863f); | ||
| TEMPLATE_COLORS[109] = NiColor(0.9333333f, 0.1254902f, 0.3019608f); | ||
| TEMPLATE_COLORS[110] = NiColor(1.0f, 0.3254902f, 0.2862745f); | ||
| TEMPLATE_COLORS[111] = NiColor(0.7529412f, 0.2666667f, 0.5607843f); | ||
| TEMPLATE_COLORS[112] = NiColor(0.1215686f, 0.8078431f, 0.7960784f); | ||
| TEMPLATE_COLORS[113] = NiColor(0.4705882f, 0.3176471f, 0.6627451f); | ||
| TEMPLATE_COLORS[114] = NiColor(1.0f, 0.6078432f, 0.6666667f); | ||
| TEMPLATE_COLORS[115] = NiColor(0.9882353f, 0.1568628f, 0.2784314f); | ||
| TEMPLATE_COLORS[116] = NiColor(0.4627451f, 1.0f, 0.4784314f); | ||
| TEMPLATE_COLORS[117] = NiColor(0.6235294f, 0.8862745f, 0.7490196f); | ||
| TEMPLATE_COLORS[118] = NiColor(0.6470588f, 0.4117647f, 0.3098039f); | ||
| TEMPLATE_COLORS[119] = NiColor(0.5411765f, 0.4745098f, 0.3647059f); | ||
| TEMPLATE_COLORS[120] = NiColor(0.2705882f, 0.8078431f, 0.6352941f); | ||
| TEMPLATE_COLORS[121] = NiColor(0.8039216f, 0.772549f, 0.7607843f); | ||
| TEMPLATE_COLORS[122] = NiColor(0.5019608f, 0.854902f, 0.9215686f); | ||
| TEMPLATE_COLORS[123] = NiColor(0.9254902f, 0.9176471f, 0.7450981f); | ||
| TEMPLATE_COLORS[124] = NiColor(1.0f, 0.8117647f, 0.282353f); | ||
| TEMPLATE_COLORS[125] = NiColor(0.9921569f, 0.3686275f, 0.3254902f); | ||
| TEMPLATE_COLORS[126] = NiColor(0.9803922f, 0.654902f, 0.4235294f); | ||
| TEMPLATE_COLORS[127] = NiColor(0.09411765f, 0.654902f, 0.7098039f); | ||
| TEMPLATE_COLORS[128] = NiColor(0.9215686f, 0.7803922f, 0.8745098f); | ||
| TEMPLATE_COLORS[129] = NiColor(0.9882353f, 0.5372549f, 0.6745098f); | ||
| TEMPLATE_COLORS[130] = NiColor(0.8588235f, 0.8431373f, 0.8235294f); | ||
| TEMPLATE_COLORS[131] = NiColor(0.8705882f, 0.6666667f, 0.5333334f); | ||
| TEMPLATE_COLORS[132] = NiColor(0.4666667f, 0.8666667f, 0.9058824f); | ||
| TEMPLATE_COLORS[133] = NiColor(1.0f, 1.0f, 0.4f); | ||
| TEMPLATE_COLORS[134] = NiColor(0.572549f, 0.4313726f, 0.682353f); | ||
| TEMPLATE_COLORS[135] = NiColor(0.1960784f, 0.2901961f, 0.6980392f); | ||
| TEMPLATE_COLORS[136] = NiColor(0.9686275f, 0.3254902f, 0.5803922f); | ||
| TEMPLATE_COLORS[137] = NiColor(1.0f, 0.627451f, 0.5372549f); | ||
| TEMPLATE_COLORS[138] = NiColor(0.5607843f, 0.3137255f, 0.6156863f); | ||
| TEMPLATE_COLORS[139] = NiColor(1.0f, 1.0f, 1.0f); | ||
| TEMPLATE_COLORS[140] = NiColor(0.6352941f, 0.6784314f, 0.8156863f); | ||
| TEMPLATE_COLORS[141] = NiColor(0.9882353f, 0.4235294f, 0.5215687f); | ||
| TEMPLATE_COLORS[142] = NiColor(0.8039216f, 0.6431373f, 0.8705882f); | ||
| TEMPLATE_COLORS[143] = NiColor(0.9882353f, 0.9098039f, 0.5137255f); | ||
| TEMPLATE_COLORS[144] = NiColor(0.772549f, 0.8901961f, 0.5176471f); | ||
| TEMPLATE_COLORS[145] = NiColor(1.0f, 0.682353f, 0.2588235f); | ||
| } | ||
|
|
||
| const NiColor& Get(uint8_t index) const { | ||
| return (index < 146) ? TEMPLATE_COLORS[index] : FALLBACK_COLOR; | ||
| } | ||
aronwk-aaron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private: | ||
| const NiColor FALLBACK_COLOR = NiColor(1.0f, 1.0f, 1.0f); | ||
| std::vector<NiColor> TEMPLATE_COLORS; | ||
| }; | ||
|
|
||
| #endif // SCENE_COLOR_H | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.