add twitch integration, part 2

This commit is contained in:
Miso Zmiric (Mike Squinter) 2015-05-25 20:38:33 +01:00 committed by IntelOrca
parent 1ac93e44c9
commit c2c9bbf4ef
21 changed files with 4502 additions and 108 deletions

5
.gitignore vendored
View File

@ -11,6 +11,11 @@ distribution/windows/*.exe
# Build artifacts
.cache
#libcurl
lib/libcurl/
#libjansson
lib/jansson/
#################
## Eclipse
#################

View File

@ -25,6 +25,14 @@ project(${PROJECT})
add_definitions(-DORCT2_RESOURCE_DIR="${ORCT2_RESOURCE_DIR}")
add_definitions(-DHAVE_CONFIG_H)
add_definitions(-DCURL_STATICLIB)
#uncomment the line bellow if you don't want to build openrct2 with twitch integration
#add_definitions(-DDISABLE_HTTP -DDISABLE_TWITCH)
set(ORCALIBS_INCLUDE /usr/local/cross-tools/orcalibs/include)
set(JANSSON_INCLUDE /usr/local/cross-tools/orcalibs/include/jansson)
set(ORCALIBS_LIB_DIR /usr/local/cross-tools/orcalibs/lib)
set(ORCALIBS_LIB jansson curl ssl crypto ws2_32)
# include lib
include_directories("lib/")
@ -44,7 +52,8 @@ if (UNIX)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
endif (UNIX)
LINK_DIRECTORIES(${SDL2_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${ORCALIBS_INCLUDE} ${JANSSON_INCLUDE})
LINK_DIRECTORIES(${SDL2_LIBRARY_DIRS} ${ORCALIBS_LIB_DIR})
# build as library for now, replace with add_executable
add_library(${PROJECT} SHARED ${ORCT2_SOURCES})
@ -55,7 +64,7 @@ add_library(${PROJECT} SHARED ${ORCT2_SOURCES})
# libopenrct2.dll -> openrct2.dll
set_target_properties(${PROJECT} PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(${PROJECT} ${SDL2_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT} ${SDL2_LIBRARIES} ${ORCALIBS_LIB})
if (WIN32)
target_link_libraries(${PROJECT} winmm.lib -limm32 -lversion -ldsound)

View File

@ -10,7 +10,8 @@ SET(PKG_CONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
# potential flags to make code more similar to MSVC:
# -fshort-wchar -fshort-enums -mms-bitfields
#
set(CMAKE_C_FLAGS "-masm=intel -std=gnu99 -fpack-struct=2" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "-masm=intel -std=gnu99 -fpack-struct=1" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-masm=intel -std=c++0x -std=gnu++0x -fpack-struct=1" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++" CACHE STRING "" FORCE)
# find and include SDL2
@ -19,7 +20,7 @@ PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
if(APPLE)
SET(TARGET_ENVIRONMENT /usr/local/mingw-w32-bin_i686-darwin/i686-w64-mingw32)
SET(TARGET_ENVIRONMENT /usr/local/mingw-w32-bin_i686-darwin/i686-w64-mingw32)
else()
SET(TARGET_ENVIRONMENT /usr/i686-w64-mingw32)
endif(APPLE)

10
VSgetLibs.bat Normal file
View File

@ -0,0 +1,10 @@
@echo OFF
pushd "%~dp0"
IF NOT EXIST .\lib\libcurl\ (
curl http://misozmiric.com/ted/openrct2/orcalibs-vs.zip -o .\lib\orcalibs.zip
pushd .\lib
unzip -oaq orcalibs.zip
del .\orcalibs.zip
popd
)
popd

View File

@ -1 +1 @@
msbuild .\projects\openrct2.vcxproj /p:Configuration=Release /p:Platform=x86
msbuild .\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32

View File

@ -3,5 +3,6 @@
set -ev
sudo rm -rf /usr/local/cross-tools/i686-w64-mingw32
sudo rm -rf /usr/local/cross-tools/orcalibs
rm -rf .cache
rm -rf build

4055
curl-ca-bundle.crt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3497,3 +3497,16 @@ STR_5160 :{MONTH} {STRINGID}, Year {COMMA16}
STR_5161 :{WHITE}Date Format:
STR_5162 :Day/Month/Year
STR_5163 :Month/Day/Year
STR_5164 :Twitch Channel name
STR_5165 :Name peeps after followers
STR_5166 :Will name peeps after channel's Twitch followers
STR_5167 :Track follower peeps
STR_5168 :Will turn on tracking information for guests named after channel's Twitch followers
STR_5169 :Name peeps after people in Twitch chat
STR_5170 :Will name peeps after people in Twitch chat
STR_5171 :Track chat peeps
STR_5172 :Will turn on tracking information for guests named after Twitch chat participants
STR_5173 :Pull Twitch chat as news
STR_5174 :Will use Twitch chat messages preceded by !news for in game notifications
STR_5175 :Input the name of your Twitch channel
STR_5176 :Enable Twitch integration

View File

@ -84,6 +84,14 @@ if [[ ! -d $cachedir/SDL2-${SDL2_PV} ]]; then
tar -xzf SDL2-devel-${SDL2_PV}-mingw.tar.gz
popd
fi
if [[ ! -f $cachedir/orcalibs.zip ]]; then
wget http://misozmiric.com/ted/openrct2/orcalibs-unix.zip --output-document $cachedir/orcalibs.zip;
fi
if [[ ! -d $cachedir/orcalibs ]]; then
pushd $cachedir
unzip -uaq orcalibs.zip
popd
fi
# Apply platform patch
mingw_patch=libsdl2-mingw-2.0.3-fix-platform-detection-for-mingw.patch
@ -103,6 +111,9 @@ fi
if [[ ! -d /usr/local/cross-tools/i686-w64-mingw32 ]]; then
sudo cp -r $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32 /usr/local/cross-tools/
fi
if [[ ! -d /usr/local/cross-tools/orcalibs ]]; then
sudo cp -r $cachedir/orcalibs /usr/local/cross-tools/
fi
if [[ ! -f $cachedir/i686-w64-mingw32-pkg-config ]]; then
# If this fails to work because of newlines, be sure you are running this

View File

@ -41,10 +41,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\$(Configuration)\</IntDir>
<IncludePath>..\..\lib\openssl\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\$(Configuration)\</IntDir>
<IncludePath>..\..\lib\libcurl\include;..\..\lib\jansson;$(IncludePath)</IncludePath>
<LibraryPath>..\..\lib\libcurl\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -53,7 +56,7 @@
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;NS_ENABLE_THREADS;NS_ENABLE_SSL;DISABLE_MD5;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -66,21 +69,40 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;NS_ENABLE_THREADS;NS_ENABLE_SSL;DISABLE_MD5;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>libcurl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>$(SolutionDir)..\VSgetLibs.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\lib\argparse\argparse.c">
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\dump.c" />
<ClCompile Include="..\..\lib\jansson\jansson\error.c" />
<ClCompile Include="..\..\lib\jansson\jansson\hashtable.c" />
<ClCompile Include="..\..\lib\jansson\jansson\hashtable_seed.c" />
<ClCompile Include="..\..\lib\jansson\jansson\load.c" />
<ClCompile Include="..\..\lib\jansson\jansson\memory.c" />
<ClCompile Include="..\..\lib\jansson\jansson\pack_unpack.c" />
<ClCompile Include="..\..\lib\jansson\jansson\strbuffer.c" />
<ClCompile Include="..\..\lib\jansson\jansson\strconv.c" />
<ClCompile Include="..\..\lib\jansson\jansson\utf.c" />
<ClCompile Include="..\..\lib\jansson\jansson\value.c" />
<ClCompile Include="..\..\lib\libspeex\resample.c">
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
@ -89,6 +111,14 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\lib\argparse\argparse.h" />
<ClInclude Include="..\..\lib\jansson\jansson\hashtable.h" />
<ClInclude Include="..\..\lib\jansson\jansson\jansson.h" />
<ClInclude Include="..\..\lib\jansson\jansson\jansson_private.h" />
<ClInclude Include="..\..\lib\jansson\jansson\lookup3.h" />
<ClInclude Include="..\..\lib\jansson\jansson\strbuffer.h" />
<ClInclude Include="..\..\lib\jansson\jansson\utf.h" />
<ClInclude Include="..\..\lib\jansson\jansson_config.h" />
<ClInclude Include="..\..\lib\jansson\jansson_private_config.h" />
<ClInclude Include="..\..\lib\libspeex\arch.h" />
<ClInclude Include="..\..\lib\libspeex\config.h" />
<ClInclude Include="..\..\lib\libspeex\os_support.h" />

View File

@ -13,6 +13,12 @@
<Filter Include="lodepng">
<UniqueIdentifier>{7f953e55-d294-4158-b309-67f41fa82760}</UniqueIdentifier>
</Filter>
<Filter Include="libcurl">
<UniqueIdentifier>{7b46a2d6-1095-4e7a-b98b-006b832ef7a1}</UniqueIdentifier>
</Filter>
<Filter Include="jansson">
<UniqueIdentifier>{16ee6cb9-307a-4e8a-8261-a69d91b17739}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\lib\argparse\argparse.c">
@ -24,6 +30,39 @@
<ClCompile Include="..\..\lib\lodepng\lodepng.c">
<Filter>lodepng</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\dump.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\error.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\hashtable.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\hashtable_seed.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\load.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\memory.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\pack_unpack.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\strbuffer.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\strconv.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\utf.c">
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="..\..\lib\jansson\jansson\value.c">
<Filter>jansson</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\lib\argparse\argparse.h">
@ -50,5 +89,29 @@
<ClInclude Include="..\..\lib\lodepng\lodepng.h">
<Filter>lodepng</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson_config.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson_private_config.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson\hashtable.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson\jansson.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson\jansson_private.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson\lookup3.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson\strbuffer.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="..\..\lib\jansson\jansson\utf.h">
<Filter>jansson</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -2,6 +2,7 @@
<Project DefaultTargets="Build0;Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build0">
<Copy SourceFiles="..\openrct2.exe" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="..\curl-ca-bundle.crt" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="..\SDL2.dll" DestinationFolder="$(OutDir)" />
</Target>
<ItemGroup Label="ProjectConfigurations">
@ -15,6 +16,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<None Include="..\curl-ca-bundle.crt" />
<None Include="..\openrct2.exe" />
</ItemGroup>
<ItemGroup>
@ -55,6 +57,8 @@
<ClCompile Include="..\src\management\marketing.c" />
<ClCompile Include="..\src\management\news_item.c" />
<ClCompile Include="..\src\management\research.c" />
<ClCompile Include="..\src\network\http.cpp" />
<ClCompile Include="..\src\network\twitch.cpp" />
<ClCompile Include="..\src\object.c" />
<ClCompile Include="..\src\object_list.c" />
<ClCompile Include="..\src\openrct2.c" />
@ -182,6 +186,8 @@
<ClInclude Include="..\src\management\marketing.h" />
<ClInclude Include="..\src\management\news_item.h" />
<ClInclude Include="..\src\management\research.h" />
<ClInclude Include="..\src\network\http.h" />
<ClInclude Include="..\src\network\twitch.h" />
<ClInclude Include="..\src\object.h" />
<ClInclude Include="..\src\openrct2.h" />
<ClInclude Include="..\src\peep\peep.h" />
@ -260,8 +266,8 @@
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)..\lib;$(SolutionDir)..\lib\libspeex;$(SolutionDir)..\lib\sdl\include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\lib\sdl\lib\x86;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\lib;$(SolutionDir)..\lib\libspeex;$(SolutionDir)..\lib\sdl\include;$(SolutionDir)..\lib\libcurl\include;$(SolutionDir)..\lib\jansson;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\lib\sdl\lib\x86;$(SolutionDir)..\lib\libcurl\lib;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)..\obj\$(ProjectName)\$(Configuration)\</IntDir>
<CustomBuildBeforeTargets>
@ -289,13 +295,13 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<TreatSpecificWarningsAsErrors>4013</TreatSpecificWarningsAsErrors>
<OmitFramePointers>
</OmitFramePointers>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
@ -304,6 +310,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>winmm.lib;sdl2.lib;Dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)\openrct2.exe" sprite build "$(SolutionDir)\..\Data\g2.dat" "$(SolutionDir)\..\Resources\g2\"

View File

@ -41,11 +41,17 @@
<Filter Include="Source\Peep">
<UniqueIdentifier>{51e38783-5334-464c-8f90-61d725dc8013}</UniqueIdentifier>
</Filter>
<Filter Include="Source\Network">
<UniqueIdentifier>{ae88ed08-902b-4167-a78c-9b521ce67749}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe">
<Filter>Resource Files</Filter>
</None>
<None Include="..\curl-ca-bundle.crt">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\management\award.c">
@ -381,7 +387,6 @@
<ClCompile Include="..\src\localisation\user.c">
<Filter>Source\Localisation</Filter>
</ClCompile>
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\windows\editor_inventions_list.c">
<Filter>Source\Windows</Filter>
</ClCompile>
@ -391,7 +396,6 @@
<ClCompile Include="..\src\windows\editor_scenario_options.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\world\map_helpers.c">
<Filter>Source\World</Filter>
</ClCompile>
@ -440,6 +444,12 @@
<ClCompile Include="..\src\interface\console.c">
<Filter>Source\Interface</Filter>
</ClCompile>
<ClCompile Include="..\src\network\twitch.cpp">
<Filter>Source\Network</Filter>
</ClCompile>
<ClCompile Include="..\src\network\http.cpp">
<Filter>Source\Network</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\management\award.h">
@ -646,5 +656,11 @@
<ClInclude Include="..\src\interface\console.h">
<Filter>Source\Interface</Filter>
</ClInclude>
<ClInclude Include="..\src\network\http.h">
<Filter>Source\Network</Filter>
</ClInclude>
<ClInclude Include="..\src\network\twitch.h">
<Filter>Source\Network</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -7,4 +7,7 @@
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

BIN
resources/g2/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

1
run.bat Normal file
View File

@ -0,0 +1 @@
.\build\Release\openrct2.exe %*

View File

@ -561,6 +561,7 @@ void window_publisher_credits_open();
void window_track_manage_open();
void window_viewport_open();
void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uint32 existing_args, int maxLength);
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength);
rct_window *window_mapgen_open();
rct_window *window_loadsave_open(int type);

View File

@ -1408,6 +1408,20 @@ enum {
STR_OPENRCT2_BEGIN_STRING_ID = 5120,
STR_TWITCH_NAME = 5164,
STR_TWITCH_PEEP_FOLLOWERS = 5165,
STR_TWITCH_PEEP_FOLLOWERS_TIP = 5166,
STR_TWITCH_FOLLOWERS_TRACK = 5167,
STR_TWITCH_FOLLOWERS_TRACK_TIP = 5168,
STR_TWITCH_PEEP_CHAT = 5169,
STR_TWITCH_PEEP_CHAT_TIP = 5170,
STR_TWITCH_CHAT_TRACK = 5171,
STR_TWITCH_CHAT_TRACK_TIP = 5172,
STR_TWITCH_CHAT_NEWS = 5173,
STR_TWITCH_CHAT_NEWS_TIP = 5174,
STR_TWITCH_NAME_DESC = 5175,
STR_TWITCH_ENABLE = 5176,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@ -253,105 +253,106 @@ enum {
SPR_TAB_OBJECTIVE_15 = SPR_TAB_OBJECTIVE_0 + 15,
SPR_TAB_AWARDS = 5527,
SPR_TAB_QUESTION = 5528,
SPR_TAB_QUESTION = 5528,
SPR_TAB_GUESTS_0 = 5568,
SPR_TAB_GUESTS_1 = SPR_TAB_GUESTS_0 + 1,
SPR_TAB_GUESTS_2 = SPR_TAB_GUESTS_0 + 2,
SPR_TAB_GUESTS_3 = SPR_TAB_GUESTS_0 + 3,
SPR_TAB_GUESTS_4 = SPR_TAB_GUESTS_0 + 4,
SPR_TAB_GUESTS_5 = SPR_TAB_GUESTS_0 + 5,
SPR_TAB_GUESTS_6 = SPR_TAB_GUESTS_0 + 6,
SPR_TAB_GUESTS_7 = SPR_TAB_GUESTS_0 + 7,
SPR_TAB_GUESTS_8 = SPR_TAB_GUESTS_0 + 8,
SPR_TAB_GUESTS_9 = SPR_TAB_GUESTS_0 + 9,
SPR_TAB_GUESTS_10 = SPR_TAB_GUESTS_0 + 10,
SPR_TAB_GUESTS_11 = SPR_TAB_GUESTS_0 + 11,
SPR_TAB_GUESTS_12 = SPR_TAB_GUESTS_0 + 12,
SPR_TAB_GUESTS_13 = SPR_TAB_GUESTS_0 + 13,
SPR_TAB_GUESTS_14 = SPR_TAB_GUESTS_0 + 14,
SPR_TAB_GUESTS_15 = SPR_TAB_GUESTS_0 + 15,
SPR_TAB_GUESTS_0 = 5568,
SPR_TAB_GUESTS_1 = SPR_TAB_GUESTS_0 + 1,
SPR_TAB_GUESTS_2 = SPR_TAB_GUESTS_0 + 2,
SPR_TAB_GUESTS_3 = SPR_TAB_GUESTS_0 + 3,
SPR_TAB_GUESTS_4 = SPR_TAB_GUESTS_0 + 4,
SPR_TAB_GUESTS_5 = SPR_TAB_GUESTS_0 + 5,
SPR_TAB_GUESTS_6 = SPR_TAB_GUESTS_0 + 6,
SPR_TAB_GUESTS_7 = SPR_TAB_GUESTS_0 + 7,
SPR_TAB_GUESTS_8 = SPR_TAB_GUESTS_0 + 8,
SPR_TAB_GUESTS_9 = SPR_TAB_GUESTS_0 + 9,
SPR_TAB_GUESTS_10 = SPR_TAB_GUESTS_0 + 10,
SPR_TAB_GUESTS_11 = SPR_TAB_GUESTS_0 + 11,
SPR_TAB_GUESTS_12 = SPR_TAB_GUESTS_0 + 12,
SPR_TAB_GUESTS_13 = SPR_TAB_GUESTS_0 + 13,
SPR_TAB_GUESTS_14 = SPR_TAB_GUESTS_0 + 14,
SPR_TAB_GUESTS_15 = SPR_TAB_GUESTS_0 + 15,
SPR_FLOOR_TEXTURE_GRASS = 5579,
SPR_FLOOR_TEXTURE_SAND = SPR_FLOOR_TEXTURE_GRASS + 1,
SPR_FLOOR_TEXTURE_DIRT = SPR_FLOOR_TEXTURE_GRASS + 2,
SPR_FLOOR_TEXTURE_ROCK = SPR_FLOOR_TEXTURE_GRASS + 3,
SPR_FLOOR_TEXTURE_MARTIAN = SPR_FLOOR_TEXTURE_GRASS + 4,
SPR_FLOOR_TEXTURE_CHECKERBOARD = SPR_FLOOR_TEXTURE_GRASS + 5,
SPR_FLOOR_TEXTURE_GRASS_CLUMPS = SPR_FLOOR_TEXTURE_GRASS + 6,
SPR_FLOOR_TEXTURE_ICE = SPR_FLOOR_TEXTURE_GRASS + 7,
SPR_FLOOR_TEXTURE_GRID_RED = SPR_FLOOR_TEXTURE_GRASS + 8,
SPR_FLOOR_TEXTURE_GRID_YELLOW = SPR_FLOOR_TEXTURE_GRASS + 9,
SPR_FLOOR_TEXTURE_GRID_BLUE = SPR_FLOOR_TEXTURE_GRASS + 10,
SPR_FLOOR_TEXTURE_GRID_GREEN = SPR_FLOOR_TEXTURE_GRASS + 11,
SPR_FLOOR_TEXTURE_SAND_DARK = SPR_FLOOR_TEXTURE_GRASS + 12,
SPR_FLOOR_TEXTURE_SAND_LIGHT = SPR_FLOOR_TEXTURE_GRASS + 13,
SPR_FLOOR_TEXTURE_GRASS = 5579,
SPR_FLOOR_TEXTURE_SAND = SPR_FLOOR_TEXTURE_GRASS + 1,
SPR_FLOOR_TEXTURE_DIRT = SPR_FLOOR_TEXTURE_GRASS + 2,
SPR_FLOOR_TEXTURE_ROCK = SPR_FLOOR_TEXTURE_GRASS + 3,
SPR_FLOOR_TEXTURE_MARTIAN = SPR_FLOOR_TEXTURE_GRASS + 4,
SPR_FLOOR_TEXTURE_CHECKERBOARD = SPR_FLOOR_TEXTURE_GRASS + 5,
SPR_FLOOR_TEXTURE_GRASS_CLUMPS = SPR_FLOOR_TEXTURE_GRASS + 6,
SPR_FLOOR_TEXTURE_ICE = SPR_FLOOR_TEXTURE_GRASS + 7,
SPR_FLOOR_TEXTURE_GRID_RED = SPR_FLOOR_TEXTURE_GRASS + 8,
SPR_FLOOR_TEXTURE_GRID_YELLOW = SPR_FLOOR_TEXTURE_GRASS + 9,
SPR_FLOOR_TEXTURE_GRID_BLUE = SPR_FLOOR_TEXTURE_GRASS + 10,
SPR_FLOOR_TEXTURE_GRID_GREEN = SPR_FLOOR_TEXTURE_GRASS + 11,
SPR_FLOOR_TEXTURE_SAND_DARK = SPR_FLOOR_TEXTURE_GRASS + 12,
SPR_FLOOR_TEXTURE_SAND_LIGHT = SPR_FLOOR_TEXTURE_GRASS + 13,
SPR_WALL_TEXTURE_ROCK = 5593,
SPR_WALL_TEXTURE_WOOD_RED = SPR_WALL_TEXTURE_ROCK + 1,
SPR_WALL_TEXTURE_WOOD_BLACK = SPR_WALL_TEXTURE_ROCK + 2,
SPR_WALL_TEXTURE_ICE = SPR_WALL_TEXTURE_ROCK + 3,
SPR_WALL_TEXTURE_ROCK = 5593,
SPR_WALL_TEXTURE_WOOD_RED = SPR_WALL_TEXTURE_ROCK + 1,
SPR_WALL_TEXTURE_WOOD_BLACK = SPR_WALL_TEXTURE_ROCK + 2,
SPR_WALL_TEXTURE_ICE = SPR_WALL_TEXTURE_ROCK + 3,
SPR_TOOLBAR_PAUSE = 5597,
SPR_TOOLBAR_FILE = 5599,
SPR_TOOLBAR_ZOOM_OUT = 5601,
SPR_TOOLBAR_ZOOM_IN = 5604,
SPR_TOOLBAR_ROTATE = 5607,
SPR_TOOLBAR_LAND = 5609,
SPR_TOOLBAR_MAP = 5611,
SPR_TOOLBAR_GUESTS = 5613,
SPR_TOOLBAR_SCENERY = 5615,
SPR_TOOLBAR_WATER = 5617,
SPR_TOOLBAR_RIDES = 5619,
SPR_TOOLBAR_VIEW = 5621,
SPR_TOOLBAR_FOOTPATH = 5623,
SPR_TOOLBAR_STAFF = 5627,
SPR_TOOLBAR_PARK = 5629,
SPR_TOOLBAR_CONSTRUCT_RIDE = 5631,
SPR_TOOLBAR_CLEAR_SCENERY = 5633,
SPR_TOOLBAR_PAUSE = 5597,
SPR_TOOLBAR_FILE = 5599,
SPR_TOOLBAR_ZOOM_OUT = 5601,
SPR_TOOLBAR_ZOOM_IN = 5604,
SPR_TOOLBAR_ROTATE = 5607,
SPR_TOOLBAR_LAND = 5609,
SPR_TOOLBAR_MAP = 5611,
SPR_TOOLBAR_GUESTS = 5613,
SPR_TOOLBAR_SCENERY = 5615,
SPR_TOOLBAR_WATER = 5617,
SPR_TOOLBAR_RIDES = 5619,
SPR_TOOLBAR_VIEW = 5621,
SPR_TOOLBAR_FOOTPATH = 5623,
SPR_TOOLBAR_STAFF = 5627,
SPR_TOOLBAR_PARK = 5629,
SPR_TOOLBAR_CONSTRUCT_RIDE = 5631,
SPR_TOOLBAR_CLEAR_SCENERY = 5633,
SPR_NEXT_WEATHER = 23189,
SPR_WEATHER_SUN = 23190,
SPR_WEATHER_SUN_CLOUD = 23191,
SPR_WEATHER_CLOUD = 23192,
SPR_WEATHER_LIGHT_RAIN = 23193,
SPR_WEATHER_HEAVY_RAIN = 23194,
SPR_WEATHER_STORM = 23195,
SPR_WEATHER_UNKNOWN = 23196,
SPR_NEXT_WEATHER = 23189,
SPR_WEATHER_SUN = 23190,
SPR_WEATHER_SUN_CLOUD = 23191,
SPR_WEATHER_CLOUD = 23192,
SPR_WEATHER_LIGHT_RAIN = 23193,
SPR_WEATHER_HEAVY_RAIN = 23194,
SPR_WEATHER_STORM = 23195,
SPR_WEATHER_UNKNOWN = 23196,
SPR_RATING_LOW = 23197,
SPR_RATING_HIGH = 23198,
SPR_RATING_LOW = 23197,
SPR_RATING_HIGH = 23198,
SPR_MENU_NEW_GAME = 23207,
SPR_MENU_LOAD_GAME = 23208,
SPR_MENU_TUTORIAL = 23209,
SPR_MENU_EXIT = 23210,
SPR_MENU_TOOLBOX = 23211,
SPR_MENU_LOGO = 23212,
SPR_CREDITS_LOGO_SMALL = 23213,
SPR_CREDITS_CHRIS_SAWYER_SMALL = 23214,
SPR_INTRO_CHRIS_SAWYER_00 = 23215,
SPR_INTRO_CHRIS_SAWYER_10 = SPR_INTRO_CHRIS_SAWYER_00 + 1,
SPR_INTRO_LOGO_00 = 23218,
SPR_INTRO_LOGO_10 = SPR_INTRO_LOGO_00 + 1,
SPR_INTRO_LOGO_20 = SPR_INTRO_LOGO_00 + 2,
SPR_INTRO_LOGO_01 = SPR_INTRO_LOGO_00 + 3,
SPR_INTRO_LOGO_11 = SPR_INTRO_LOGO_00 + 4,
SPR_INTRO_LOGO_21 = SPR_INTRO_LOGO_00 + 5,
SPR_MENU_NEW_GAME = 23207,
SPR_MENU_LOAD_GAME = 23208,
SPR_MENU_TUTORIAL = 23209,
SPR_MENU_EXIT = 23210,
SPR_MENU_TOOLBOX = 23211,
SPR_MENU_LOGO = 23212,
SPR_CREDITS_LOGO_SMALL = 23213,
SPR_CREDITS_CHRIS_SAWYER_SMALL = 23214,
SPR_INTRO_CHRIS_SAWYER_00 = 23215,
SPR_INTRO_CHRIS_SAWYER_10 = SPR_INTRO_CHRIS_SAWYER_00 + 1,
SPR_INTRO_LOGO_00 = 23218,
SPR_INTRO_LOGO_10 = SPR_INTRO_LOGO_00 + 1,
SPR_INTRO_LOGO_20 = SPR_INTRO_LOGO_00 + 2,
SPR_INTRO_LOGO_01 = SPR_INTRO_LOGO_00 + 3,
SPR_INTRO_LOGO_11 = SPR_INTRO_LOGO_00 + 4,
SPR_INTRO_LOGO_21 = SPR_INTRO_LOGO_00 + 5,
SPR_SIX_FLAGS = 23225,
SPR_INTRO_INFOGRAMES_00 = 23226,
SPR_INTRO_INFOGRAMES_10 = SPR_INTRO_INFOGRAMES_00 + 1,
SPR_INTRO_INFOGRAMES_01 = SPR_INTRO_INFOGRAMES_00 + 2,
SPR_INTRO_INFOGRAMES_11 = SPR_INTRO_INFOGRAMES_00 + 3,
SPR_CREDITS_INFOGRAMES = 23230,
SPR_SIX_FLAGS = 23225,
SPR_INTRO_INFOGRAMES_00 = 23226,
SPR_INTRO_INFOGRAMES_10 = SPR_INTRO_INFOGRAMES_00 + 1,
SPR_INTRO_INFOGRAMES_01 = SPR_INTRO_INFOGRAMES_00 + 2,
SPR_INTRO_INFOGRAMES_11 = SPR_INTRO_INFOGRAMES_00 + 3,
SPR_CREDITS_INFOGRAMES = 23230,
SPR_G2_BEGIN = 324288,
SPR_G2_LOGO = SPR_G2_BEGIN + 0,
SPR_G2_TITLE = SPR_G2_BEGIN + 1,
SPR_G2_FASTFORWARD = SPR_G2_BEGIN + 2,
SPR_G2_SPEED_ARROW = SPR_G2_BEGIN + 3,
SPR_G2_HYPER_ARROW = SPR_G2_BEGIN + 4
SPR_G2_BEGIN = 324288,
SPR_G2_LOGO = SPR_G2_BEGIN + 0,
SPR_G2_TITLE = SPR_G2_BEGIN + 1,
SPR_G2_FASTFORWARD = SPR_G2_BEGIN + 2,
SPR_G2_SPEED_ARROW = SPR_G2_BEGIN + 3,
SPR_G2_HYPER_ARROW = SPR_G2_BEGIN + 4,
SPR_G2_TAB_TWITCH = SPR_G2_BEGIN + 5
};
#endif

View File

@ -46,6 +46,7 @@ enum {
WINDOW_OPTIONS_PAGE_AUDIO,
WINDOW_OPTIONS_PAGE_INPUT,
WINDOW_OPTIONS_PAGE_MISC,
WINDOW_OPTIONS_PAGE_TWITCH,
WINDOW_OPTIONS_PAGE_COUNT
};
@ -59,6 +60,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_TAB_3,
WIDX_TAB_4,
WIDX_TAB_5,
WIDX_TAB_6,
WIDX_RESOLUTION,
WIDX_RESOLUTION_DROPDOWN,
@ -104,6 +106,13 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_ALLOW_SUBTYPE_SWITCHING,
WIDX_DEBUGGING_TOOLS,
WIDX_TEST_UNFINISHED_TRACKS,
WIDX_CHANNEL_BUTTON,
WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX,
WIDX_FOLLOWER_PEEP_TRACKING_CHECKBOX,
WIDX_CHAT_PEEP_NAMES_CHECKBOX,
WIDX_CHAT_PEEP_TRACKING_CHECKBOX,
WIDX_NEWS_CHECKBOX,
WINDOW_OPTIONS_WIDGETS_SIZE // Marks the end of the widget list, leave as last item
};
@ -120,6 +129,7 @@ static rct_widget window_options_widgets[] = {
{ WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, STR_NONE },
{ WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE },
{ WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, STR_NONE },
{ WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, STR_NONE },
// Display tab
{ WWT_DROPDOWN, 0, 155, 299, 53, 64, 840, STR_NONE }, // resolution
@ -170,11 +180,20 @@ static rct_widget window_options_widgets[] = {
{ WWT_CHECKBOX, 2, 10, 299, 98, 109, 5122, STR_NONE }, // allow subtype
{ WWT_CHECKBOX, 2, 10, 299, 113, 124, 5150, STR_NONE }, // enabled debugging tools
{ WWT_CHECKBOX, 2, 10, 299, 128, 139, 5155, 5156 }, // test unfinished tracks
//Twitch tab
{ WWT_DROPDOWN_BUTTON, 2, 10, 299, 53, 64, STR_TWITCH_NAME, STR_NONE }, // Twitch channel name
{ WWT_CHECKBOX, 2, 10, 299, 68, 79, STR_TWITCH_PEEP_FOLLOWERS, STR_TWITCH_PEEP_FOLLOWERS_TIP }, // Twitch name peeps by follows
{ WWT_CHECKBOX, 2, 10, 299, 83, 94, STR_TWITCH_FOLLOWERS_TRACK, STR_TWITCH_FOLLOWERS_TRACK_TIP}, // Twitch information on for follows
{ WWT_CHECKBOX, 2, 10, 299, 98, 109, STR_TWITCH_PEEP_CHAT, STR_TWITCH_PEEP_CHAT_TIP }, // Twitch name peeps by chat
{ WWT_CHECKBOX, 2, 10, 299, 113, 124, STR_TWITCH_CHAT_TRACK, STR_TWITCH_CHAT_TRACK_TIP }, // Twitch information on for chat
{ WWT_CHECKBOX, 2, 10, 299, 128, 139, STR_TWITCH_CHAT_NEWS, STR_TWITCH_CHAT_NEWS_TIP }, // Twitch chat !news as notifications in game
{ WIDGETS_END },
};
const int window_options_tab_animation_divisor[] = { 4, 8, 2, 2, 2 };
const int window_options_tab_animation_frames[] = { 16, 8, 16, 4, 16 };
const int window_options_tab_animation_divisor[] = { 4, 8, 2, 2, 2, 1 };
const int window_options_tab_animation_frames[] = { 16, 8, 16, 4, 16, 1 };
static void window_options_set_page(rct_window *w, int page);
static void window_options_set_pressed_tab(rct_window *w);
@ -188,6 +207,7 @@ static void window_options_dropdown();
static void window_options_update(rct_window *w);
static void window_options_invalidate();
static void window_options_paint();
static void window_options_text_input();
static void window_options_show_dropdown(rct_window *w, rct_widget *widget, int num_items);
static void window_options_update_height_markers();
@ -211,7 +231,7 @@ static void* window_options_events[] = {
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_text_input,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
@ -244,6 +264,7 @@ void window_options_open()
(1ULL << WIDX_TAB_3) |
(1ULL << WIDX_TAB_4) |
(1ULL << WIDX_TAB_5) |
(1ULL << WIDX_TAB_6) |
(1ULL << WIDX_SOUND) |
(1ULL << WIDX_SOUND_DROPDOWN) |
(1ULL << WIDX_SOUND_CHECKBOX) |
@ -283,7 +304,13 @@ void window_options_open()
(1ULL << WIDX_TEST_UNFINISHED_TRACKS) |
(1ULL << WIDX_RCT1_COLOUR_SCHEME) |
(1ULL << WIDX_DATE_FORMAT) |
(1ULL << WIDX_DATE_FORMAT_DROPDOWN);
(1ULL << WIDX_DATE_FORMAT_DROPDOWN) |
(1ULL << WIDX_CHANNEL_BUTTON) |
(1ULL << WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX) |
(1ULL << WIDX_FOLLOWER_PEEP_TRACKING_CHECKBOX) |
(1ULL << WIDX_CHAT_PEEP_NAMES_CHECKBOX) |
(1ULL << WIDX_CHAT_PEEP_TRACKING_CHECKBOX) |
(1ULL << WIDX_NEWS_CHECKBOX);
w->page = WINDOW_OPTIONS_PAGE_DISPLAY;
window_init_scroll_widgets(w);
@ -312,11 +339,15 @@ static void window_options_mouseup()
case WIDX_TAB_3:
case WIDX_TAB_4:
case WIDX_TAB_5:
case WIDX_TAB_6:
window_options_set_page(w, widgetIndex - WIDX_TAB_1);
break;
case WIDX_HOTKEY_DROPDOWN:
window_shortcut_keys_open();
break;
case WIDX_CHANNEL_BUTTON:
window_text_input_raw_open(w, widgetIndex, STR_TWITCH_NAME, STR_TWITCH_NAME_DESC, gConfigTwitch.channel, 32);
break;
case WIDX_SCREEN_EDGE_SCROLLING:
gConfigGeneral.edge_scrolling ^= 1;
config_save_default();
@ -387,6 +418,31 @@ static void window_options_mouseup()
config_save_default();
window_invalidate(w);
break;
case WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX:
gConfigTwitch.enable_follower_peep_names ^= 1;
config_save_default();
window_invalidate(w);
break;
case WIDX_FOLLOWER_PEEP_TRACKING_CHECKBOX:
gConfigTwitch.enable_follower_peep_tracking ^= 1;
config_save_default();
window_invalidate(w);
break;
case WIDX_CHAT_PEEP_NAMES_CHECKBOX:
gConfigTwitch.enable_chat_peep_names ^= 1;
config_save_default();
window_invalidate(w);
break;
case WIDX_CHAT_PEEP_TRACKING_CHECKBOX:
gConfigTwitch.enable_chat_peep_tracking ^= 1;
config_save_default();
window_invalidate(w);
break;
case WIDX_NEWS_CHECKBOX:
gConfigTwitch.enable_news ^= 1;
config_save_default();
window_invalidate(w);
break;
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX:
gConfigGeneral.save_plugin_data ^= 1;
config_save_default();
@ -867,6 +923,21 @@ static void window_options_invalidate()
window_options_widgets[WIDX_ALLOW_SUBTYPE_SWITCHING].type = WWT_CHECKBOX;
window_options_widgets[WIDX_DEBUGGING_TOOLS].type = WWT_CHECKBOX;
window_options_widgets[WIDX_TEST_UNFINISHED_TRACKS].type = WWT_CHECKBOX;
break;
case WINDOW_OPTIONS_PAGE_TWITCH:
widget_set_checkbox_value(w, WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX, gConfigTwitch.enable_follower_peep_names);
widget_set_checkbox_value(w, WIDX_FOLLOWER_PEEP_TRACKING_CHECKBOX, gConfigTwitch.enable_follower_peep_tracking);
widget_set_checkbox_value(w, WIDX_CHAT_PEEP_NAMES_CHECKBOX, gConfigTwitch.enable_chat_peep_names);
widget_set_checkbox_value(w, WIDX_CHAT_PEEP_TRACKING_CHECKBOX, gConfigTwitch.enable_chat_peep_tracking);
widget_set_checkbox_value(w, WIDX_NEWS_CHECKBOX, gConfigTwitch.enable_news);
window_options_widgets[WIDX_CHANNEL_BUTTON].type = WWT_DROPDOWN_BUTTON;
window_options_widgets[WIDX_FOLLOWER_PEEP_NAMES_CHECKBOX].type = WWT_CHECKBOX;
window_options_widgets[WIDX_FOLLOWER_PEEP_TRACKING_CHECKBOX].type = WWT_CHECKBOX;
window_options_widgets[WIDX_CHAT_PEEP_NAMES_CHECKBOX].type = WWT_CHECKBOX;
window_options_widgets[WIDX_CHAT_PEEP_TRACKING_CHECKBOX].type = WWT_CHECKBOX;
window_options_widgets[WIDX_NEWS_CHECKBOX].type = WWT_CHECKBOX;
break;
}
}
@ -973,6 +1044,26 @@ static void window_options_update_height_markers()
gfx_invalidate_screen();
}
static void window_options_text_input(){
short widgetIndex;
rct_window *w;
char _cl;
char* text;
window_text_input_get_registers(w, widgetIndex, _cl, text);
if (_cl == 0)
{
return;
}
if (widgetIndex == WIDX_CHANNEL_BUTTON){
if (gConfigTwitch.channel != NULL)
free(gConfigTwitch.channel);
gConfigTwitch.channel = _strdup(text);
config_save_default();
}
}
#pragma region Common
static void window_options_set_page(rct_window *w, int page)
@ -1016,6 +1107,7 @@ static void window_options_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w
window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_AUDIO, 5335);
window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_INPUT, 5201);
window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_MISC, 5205);
window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_TWITCH, SPR_G2_TAB_TWITCH);
}
#pragma endregion

View File

@ -161,6 +161,67 @@ void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id t
w->colours[2] = call_w->colours[2];
}
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength)
{
_maxInputLength = maxLength;
window_close_by_class(WC_TEXTINPUT);
// Clear the text input buffer
memset(text_input, 0, maxLength);
// Enter in the the text input buffer any existing
// text.
if (existing_text != NULL)
strncpy(text_input, existing_text, maxLength);
// In order to prevent strings that exceed the maxLength
// from crashing the game.
text_input[maxLength - 1] = '\0';
// This is the text displayed above the input box
input_text_description = description;
// Work out the existing size of the window
char wrapped_string[512];
strcpy(wrapped_string, text_input);
int no_lines = 0, font_height = 0;
// String length needs to add 12 either side of box
// +13 for cursor when max length.
gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height);
int height = no_lines * 10 + WH;
// Window will be in the center of the screen
rct_window* w = window_create_centred(
WW,
height,
(uint32*)window_text_input_events,
WC_TEXTINPUT,
WF_STICK_TO_FRONT
);
w->widgets = window_text_input_widgets;
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_OKAY);
window_text_input_widgets[WIDX_TITLE].image = title;
// Save calling window details so that the information
// can be passed back to the correct window & widget
calling_class = call_w->classification;
calling_number = call_w->number;
calling_widget = call_widget;
platform_start_text_input(text_input, maxLength);
window_init_scroll_widgets(w);
w->colours[0] = call_w->colours[0];
w->colours[1] = call_w->colours[1];
w->colours[2] = call_w->colours[2];
}
/**
*
*/