Skip to content

Commit

Permalink
Engine, Editor: use shared __my_setcolor() function
Browse files Browse the repository at this point in the history
The split implementations are result of old refactor, where the editor and engine used difference color shifts and conversions.
It looks like that is not necessary now.
  • Loading branch information
ivan-mogilko committed Aug 11, 2024
1 parent 0a4573a commit 482ced6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 113 deletions.
31 changes: 31 additions & 0 deletions Common/util/wgt2allg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,37 @@

using namespace AGS::Common;

void __my_setcolor(int *ctset, int newcol, int wantColDep)
{
if (wantColDep == 8)
{
ctset[0] = newcol;
}
else if ((newcol >= 32) && (wantColDep > 16))
{
// true-color
ctset[0] = makeacol32(getr16(newcol), getg16(newcol), getb16(newcol), 255);
}
else if (newcol >= 32)
{
// If it's 15-bit, convert the color
if (wantColDep == 15)
ctset[0] = (newcol & 0x001f) | ((newcol >> 1) & 0x7fe0);
else
ctset[0] = newcol;
}
else
{
// indexed color, use palette
ctset[0] = makecol_depth(wantColDep, col_lookups[newcol] >> 16,
(col_lookups[newcol] >> 8) & 0x000ff, col_lookups[newcol] & 0x000ff);

// in case it's used on an alpha-channel sprite, make sure it's visible
if (wantColDep > 16)
ctset[0] |= 0xff000000;
}
}

void wsetrgb(int coll, int r, int g, int b, RGB * pall)
{
pall[coll].r = r;
Expand Down
1 change: 0 additions & 1 deletion Editor/AGS.Native/NativeDLL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ copy "$(TargetPath)" "$(SolutionDir)..\Editor\References\x64"</Command>
<ClCompile Include="..\Native\acgui_agsnative.cpp" />
<ClCompile Include="..\Native\ac\actiontype.cpp" />
<ClCompile Include="..\Native\ac\scriptmodule.cpp" />
<ClCompile Include="..\Native\color_native.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCPP.cxx" />
<ClCompile Include="..\scintilla\lexlib\Accessor.cxx" />
<ClCompile Include="..\scintilla\lexlib\CharacterCategory.cxx" />
Expand Down
3 changes: 0 additions & 3 deletions Editor/AGS.Native/NativeDLL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
<ClCompile Include="agsnative.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Native\color_native.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NativeMethods.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
48 changes: 0 additions & 48 deletions Editor/Native/color_native.cpp

This file was deleted.

1 change: 0 additions & 1 deletion Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ target_sources(engine
gfx/ali3dsw.h
gfx/blender.cpp
gfx/blender.h
gfx/color_engine.cpp
gfx/ddb.h
gfx/gfx_util.cpp
gfx/gfx_util.h
Expand Down
56 changes: 0 additions & 56 deletions Engine/gfx/color_engine.cpp

This file was deleted.

1 change: 0 additions & 1 deletion Solutions/Engine.App/Engine.App.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@
<ClCompile Include="..\..\Engine\gfx\ali3dogl.cpp" />
<ClCompile Include="..\..\Engine\gfx\ali3dsw.cpp" />
<ClCompile Include="..\..\Engine\gfx\blender.cpp" />
<ClCompile Include="..\..\Engine\gfx\color_engine.cpp" />
<ClCompile Include="..\..\Engine\gfx\gfxdriverbase.cpp" />
<ClCompile Include="..\..\Engine\gfx\gfxdriverfactory.cpp" />
<ClCompile Include="..\..\Engine\gfx\gfxfilter_aad3d.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions Solutions/Engine.App/Engine.App.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,6 @@
<ClCompile Include="..\..\Engine\gfx\blender.cpp">
<Filter>Source Files\gfx</Filter>
</ClCompile>
<ClCompile Include="..\..\Engine\gfx\color_engine.cpp">
<Filter>Source Files\gfx</Filter>
</ClCompile>
<ClCompile Include="..\..\Engine\gfx\gfx_util.cpp">
<Filter>Source Files\gfx</Filter>
</ClCompile>
Expand Down

0 comments on commit 482ced6

Please sign in to comment.