From 0c39762f88d462d895b83bbba715e717f72d53b6 Mon Sep 17 00:00:00 2001 From: Shadooow Date: Fri, 28 May 2021 05:36:39 +0000 Subject: [PATCH] added new optional tag into SectorLoadscreens.xml that allows modder to specify format of alternative loadscreen as we already have loadscreens that have only STI and loadscreens that have only PNG variant but currently we can specify just one format for both normal and alternative loadscreen git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9057 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Loading Screen.cpp | 2 ++ Loading Screen.h | 1 + Tactical/XML_SectorLoadscreens.cpp | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/Loading Screen.cpp b/Loading Screen.cpp index 2ed5e7ef..7d3ca448 100644 --- a/Loading Screen.cpp +++ b/Loading Screen.cpp @@ -391,6 +391,8 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) if (fAlternate && (Random(2) > 0)) { + if(gSectorLoadscreens[i].szImageFormatAlt != NULL) + imageFormat = gSectorLoadscreens[i].szImageFormatAlt; switch (ubLoadScreenID) { case DAY: diff --git a/Loading Screen.h b/Loading Screen.h index fe4476df..fa5bc658 100644 --- a/Loading Screen.h +++ b/Loading Screen.h @@ -106,6 +106,7 @@ typedef struct CHAR8 szNight[MAX_IMAGE_PATH_CHARS]; CHAR8 szDayAlt[MAX_IMAGE_PATH_CHARS]; CHAR8 szNightAlt[MAX_IMAGE_PATH_CHARS]; + CHAR8 szImageFormatAlt[MAX_IMAGE_FORMAT_CHARS]; } SECTOR_LOADSCREENS; extern SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS]; diff --git a/Tactical/XML_SectorLoadscreens.cpp b/Tactical/XML_SectorLoadscreens.cpp index 92471b1a..36115eb9 100644 --- a/Tactical/XML_SectorLoadscreens.cpp +++ b/Tactical/XML_SectorLoadscreens.cpp @@ -228,6 +228,25 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name) //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szNightAlt[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szNightAlt[i],&temp)); } } + else if (strcmp(name, "szImageFormatAlt") == 0) + { + pData->curElement = ELEMENT; + + if (MAX_IMAGE_FORMAT_CHARS >= strlen(pData->szCharData)) + strcpy(pData->curSectorLoadscreens.szImageFormatAlt, pData->szCharData); + else + { + strncpy(pData->curSectorLoadscreens.szImageFormatAlt, pData->szCharData, MAX_IMAGE_FORMAT_CHARS); + pData->curSectorLoadscreens.szImageFormatAlt[MAX_IMAGE_FORMAT_CHARS - 1] = '\0'; + } + + for (int i = 0; i < min((int)strlen(pData->szCharData), MAX_IMAGE_FORMAT_CHARS); i++) + { + temp = pData->szCharData[i]; + pData->curSectorLoadscreens.szImageFormatAlt[i] = temp; + //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szImageFormatAlt[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szImageFormatAlt[i],&temp)); + } + } pData->maxReadDepth--; } @@ -328,6 +347,7 @@ BOOLEAN WriteSectorLoadscreensStats(SECTOR_LOADSCREENS *pSectorLoadscreens, STR FilePrintf(hFile,"\t\t%d\r\n", pSectorLoadscreens[cnt].szNight); FilePrintf(hFile,"\t\t%d\r\n", pSectorLoadscreens[cnt].szDayAlt); FilePrintf(hFile,"\t\t%d\r\n", pSectorLoadscreens[cnt].szNightAlt); + FilePrintf(hFile,"\t\t%d\r\n", pSectorLoadscreens[cnt].szImageFormatAlt); FilePrintf(hFile,"\t\r\n"); }