From 3083ac66b3a1b6eaed519d89c35ab7361ba9950b Mon Sep 17 00:00:00 2001 From: Wanne Date: Thu, 2 May 2013 19:50:21 +0000 Subject: [PATCH] - Bugfix: LoadScreenHints o Added support for language specific (German, Russian, ...) LoadScreenHints (*.LoadScreenHints.xml) o Added support for long (multi line) load screen hints (there will be an automatic line break in long load screen hints text) o Reset load screen hint text to 0 (no display), because otherwise the old load screen will also be shown underneath the correct new one which resulted in an unreadable text mess git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6053 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Init.cpp | 20 +++++++++++++++++++- Strategic/strategicmap.cpp | 3 +++ Utils/Animated ProgressBar.cpp | 11 +++++++++-- Utils/Animated ProgressBar.h | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Init.cpp b/Init.cpp index 33a91c80..3d1aa354 100644 --- a/Init.cpp +++ b/Init.cpp @@ -386,8 +386,26 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcpy(fileName, directoryName); strcat(fileName, LOADSCREENHINTSFILENAME); - SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME); +#ifndef ENGLISH + AddLanguagePrefix(fileName); + + if ( FileExists(fileName) ) + { + SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME); + } + else + { + //CHRISL: If we fail to load, try loading just the default english + strcpy(fileName, directoryName); + strcat(fileName, LOADSCREENHINTSFILENAME); + SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME); + } +#else + SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName),LOADSCREENHINTSFILENAME); +#endif + + strcpy(fileName, directoryName); strcat(fileName, ARMOURSFILENAME); SGP_THROW_IFFALSE(ReadInArmourStats(fileName),ARMOURSFILENAME); diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 90655434..f33e3a10 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -2883,6 +2883,9 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ ) UNDERGROUND_SECTORINFO *pNode = NULL; CHAR8 bFilename[ 50 ]; + // Reset + //ResetLoadScreenHint(); + // pause game PauseGame( ); diff --git a/Utils/Animated ProgressBar.cpp b/Utils/Animated ProgressBar.cpp index aa371f23..3646dd0b 100644 --- a/Utils/Animated ProgressBar.cpp +++ b/Utils/Animated ProgressBar.cpp @@ -32,6 +32,8 @@ extern BOOLEAN bShowSmallImage; void CreateLoadingScreenProgressBar() { + ResetLoadScreenHint(); + gusLeftmostShaded = 162; //// Special case->show small image centered @@ -224,6 +226,11 @@ void RemoveProgressBar( UINT8 ubID ) extern UINT16 num_found_loadscreenhints; static UINT16 usCurrentLoadScreenHint = 0; +void ResetLoadScreenHint() +{ + usCurrentLoadScreenHint = 0; +} + // Flugente: this function selects the next hint to display, and makes sure it is not played again during this run of the exe void SetNewLoadScreenHint() { @@ -335,8 +342,8 @@ void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT16 uiRelStartPerc, UINT16 // Flugente: loadscreen hints if (gGameExternalOptions.gfUseLoadScreenHints && usCurrentLoadScreenHint ) - { - DrawTextToScreen( zLoadScreenHint[usCurrentLoadScreenHint].szName, 1, pCurr->usBarBottom + 3 - 200, SCREEN_WIDTH - 1, FONT12ARIAL, FONT_MCOLOR_WHITE, 0, FALSE, INVALIDATE_TEXT | CENTER_JUSTIFIED ); + { + DisplayWrappedString( 10, pCurr->usBarBottom + 3 - 100, SCREEN_WIDTH - 10, 2, FONT12ARIAL, FONT_MCOLOR_WHITE, zLoadScreenHint[usCurrentLoadScreenHint].szName, FONT_MCOLOR_BLACK, FALSE, INVALIDATE_TEXT | CENTER_JUSTIFIED ); } } diff --git a/Utils/Animated ProgressBar.h b/Utils/Animated ProgressBar.h index 436cee8d..48291336 100644 --- a/Utils/Animated ProgressBar.h +++ b/Utils/Animated ProgressBar.h @@ -46,6 +46,7 @@ extern LOADSCREENHINT_STRUCT zLoadScreenHint[LOADSCREENHINT_MAX]; // Flugente: this function selects the next hint to display, and makes sure it is not played again during this run of the exe void SetNewLoadScreenHint(); +void ResetLoadScreenHint(); // -------- added by Flugente: various flags for loadscreen hints-------- // easier than adding 32 differently named variables. DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!!