mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
added loading screen stretching for all resolutions
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5488 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+96
-80
@@ -28,7 +28,7 @@ extern BOOLEAN gfSchedulesHosed;
|
|||||||
#include "Ja25 Strategic Ai.h"
|
#include "Ja25 Strategic Ai.h"
|
||||||
#endif
|
#endif
|
||||||
UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING;
|
UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING;
|
||||||
BOOLEAN bShowSmallImage = FALSE;
|
//BOOLEAN bShowSmallImage = FALSE;
|
||||||
SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
|
SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
|
||||||
|
|
||||||
static INT16 requestedX, requestedY, requestedZ;
|
static INT16 requestedX, requestedY, requestedZ;
|
||||||
@@ -343,18 +343,18 @@ static void BuildLoadscreenFilename(std::string& dst, const char* path, int reso
|
|||||||
if (path)
|
if (path)
|
||||||
dst.append(path);
|
dst.append(path);
|
||||||
|
|
||||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||||
{
|
//{
|
||||||
// Nothing to do here
|
// // Nothing to do here
|
||||||
}
|
//}
|
||||||
else if (iResolution < _1024x768)
|
//else if (iResolution < _1024x768)
|
||||||
{
|
//{
|
||||||
dst.append("_800x600");
|
// dst.append("_800x600");
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
dst.append("_1024x768");
|
// dst.append("_1024x768");
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
@@ -379,7 +379,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
|
|||||||
// char szFullImagePath[80];
|
// char szFullImagePath[80];
|
||||||
STRING512 sImage = {0};
|
STRING512 sImage = {0};
|
||||||
|
|
||||||
bShowSmallImage = FALSE;
|
//bShowSmallImage = FALSE;
|
||||||
|
|
||||||
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
|
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
|
||||||
|
|
||||||
@@ -454,72 +454,72 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
|
|||||||
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
|
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
|
||||||
|
|
||||||
// Actual image, depending on the resolution
|
// Actual image, depending on the resolution
|
||||||
std::string strBigImage;
|
//std::string strBigImage;
|
||||||
|
|
||||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 0, imageFormat.c_str());
|
// BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 0, imageFormat.c_str());
|
||||||
}
|
//}
|
||||||
else if (iResolution < _1024x768)
|
//else if (iResolution < _1024x768)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 1, imageFormat.c_str());
|
// BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 1, imageFormat.c_str());
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 2, imageFormat.c_str());
|
// BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 2, imageFormat.c_str());
|
||||||
}
|
//}
|
||||||
|
|
||||||
strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
//strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
||||||
|
|
||||||
|
|
||||||
if ( !FileExists(vs_desc.ImageFile) )
|
if ( !FileExists(vs_desc.ImageFile) )
|
||||||
{
|
{
|
||||||
// Small image: 640x480
|
// Small image: 640x480
|
||||||
std::string strSmallImage("LOADSCREENS\\");
|
std::string strSmallImage("LOADSCREENS\\");
|
||||||
std::string strBigImage("LOADSCREENS\\");
|
//std::string strBigImage("LOADSCREENS\\");
|
||||||
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[1], 0, imageFormat.c_str());
|
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[1], 0, imageFormat.c_str());
|
||||||
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
|
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
|
||||||
|
|
||||||
// Actual image, depending on the resolution
|
// Actual image, depending on the resolution
|
||||||
|
|
||||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 0, imageFormat.c_str());
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 0, imageFormat.c_str());
|
||||||
}
|
//}
|
||||||
else if (iResolution < _1024x768)
|
//else if (iResolution < _1024x768)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 1, imageFormat.c_str());
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 1, imageFormat.c_str());
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 2, imageFormat.c_str());
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 2, imageFormat.c_str());
|
||||||
}
|
//}
|
||||||
|
|
||||||
strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
//strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string strSmallImage("LOADSCREENS\\");
|
std::string strSmallImage("LOADSCREENS\\");
|
||||||
std::string strBigImage("LOADSCREENS\\");
|
//std::string strBigImage("LOADSCREENS\\");
|
||||||
|
|
||||||
if (LOADINGSCREEN_NOTHING <= ubLoadScreenID && ubLoadScreenID <= LOADINGSCREEN_NIGHTBALIME)
|
if (LOADINGSCREEN_NOTHING <= ubLoadScreenID && ubLoadScreenID <= LOADINGSCREEN_NIGHTBALIME)
|
||||||
{
|
{
|
||||||
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
|
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
|
||||||
|
|
||||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
|
||||||
}
|
//}
|
||||||
else if (iResolution < _1024x768)
|
//else if (iResolution < _1024x768)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 1, "sti");
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 1, "sti");
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 2, "sti");
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 2, "sti");
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -527,22 +527,22 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
|
|||||||
// for some reason the heli screen is the default
|
// for some reason the heli screen is the default
|
||||||
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[0], 0, "sti");
|
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[0], 0, "sti");
|
||||||
|
|
||||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 0, "sti");
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 0, "sti");
|
||||||
}
|
//}
|
||||||
else if (iResolution < _1024x768)
|
//else if (iResolution < _1024x768)
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 1, "sti");
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 1, "sti");
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 2, "sti");
|
// BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 2, "sti");
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
|
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
|
||||||
strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
//strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
|
|||||||
{
|
{
|
||||||
// Sti loadscreen is not available
|
// Sti loadscreen is not available
|
||||||
// we may have tried the big image, so let's check out the small one
|
// we may have tried the big image, so let's check out the small one
|
||||||
bShowSmallImage = TRUE;
|
//bShowSmallImage = TRUE;
|
||||||
strncpy(vs_desc.ImageFile, smallImage, sizeof(vs_desc.ImageFile)-1);
|
strncpy(vs_desc.ImageFile, smallImage, sizeof(vs_desc.ImageFile)-1);
|
||||||
|
|
||||||
if (FileExists(vs_desc.ImageFile) && AddVideoSurface(&vs_desc, &uiLoadScreen))
|
if (FileExists(vs_desc.ImageFile) && AddVideoSurface(&vs_desc, &uiLoadScreen))
|
||||||
@@ -573,18 +573,34 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
|
|||||||
|
|
||||||
if (fOk)
|
if (fOk)
|
||||||
{
|
{
|
||||||
|
SGPRect SrcRect, DstRect;
|
||||||
|
|
||||||
//Blit the background image
|
//Blit the background image
|
||||||
GetVideoSurface(&hVSurface, uiLoadScreen);
|
GetVideoSurface(&hVSurface, uiLoadScreen);
|
||||||
|
|
||||||
|
// Stretch the background image
|
||||||
|
SrcRect.iLeft = 0;
|
||||||
|
SrcRect.iTop = 0;
|
||||||
|
SrcRect.iRight = hVSurface->usWidth;
|
||||||
|
SrcRect.iBottom = hVSurface->usHeight;
|
||||||
|
|
||||||
|
DstRect.iLeft = 0;
|
||||||
|
DstRect.iTop = 0;
|
||||||
|
DstRect.iRight = SCREEN_WIDTH;
|
||||||
|
DstRect.iBottom = SCREEN_HEIGHT;
|
||||||
|
|
||||||
|
BltStretchVideoSurface( FRAME_BUFFER, uiLoadScreen, 0, 0, 0, &SrcRect, &DstRect );
|
||||||
|
|
||||||
|
|
||||||
// Special case->show the small image centered
|
// Special case->show the small image centered
|
||||||
if (iResolution > _640x480 && bShowSmallImage)
|
//if (iResolution > _640x480 && bShowSmallImage)
|
||||||
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
|
// BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, (SCREEN_WIDTH - xResSize) / 2,(SCREEN_HEIGHT - yResSize) / 2, 0, NULL );
|
// BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, (SCREEN_WIDTH - xResSize) / 2,(SCREEN_HEIGHT - yResSize) / 2, 0, NULL );
|
||||||
}
|
//}
|
||||||
|
|
||||||
DeleteVideoSurfaceFromIndex( uiLoadScreen );
|
DeleteVideoSurfaceFromIndex( uiLoadScreen );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,29 +32,33 @@ void CreateLoadingScreenProgressBar()
|
|||||||
{
|
{
|
||||||
gusLeftmostShaded = 162;
|
gusLeftmostShaded = 162;
|
||||||
|
|
||||||
// Special case->show small image centered
|
//// Special case->show small image centered
|
||||||
if (bShowSmallImage == TRUE)
|
//if (bShowSmallImage == TRUE)
|
||||||
{
|
//{
|
||||||
if (iResolution >= _800x600)
|
// if (iResolution >= _800x600)
|
||||||
{
|
// {
|
||||||
CreateProgressBar(0, iScreenWidthOffset + 162, iScreenHeightOffset + 427, iScreenWidthOffset + 480, iScreenHeightOffset + 443);
|
// CreateProgressBar(0, iScreenWidthOffset + 162, iScreenHeightOffset + 427, iScreenWidthOffset + 480, iScreenHeightOffset + 443);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
// if (iResolution >= _640x480 && iResolution < _800x600)
|
||||||
{
|
// {
|
||||||
CreateProgressBar(0, 162, 427, 480, 443);
|
// CreateProgressBar(0, 162, 427, 480, 443);
|
||||||
}
|
// }
|
||||||
else if (iResolution < _1024x768)
|
// else if (iResolution < _1024x768)
|
||||||
{
|
// {
|
||||||
CreateProgressBar(0, (202 + (SCREEN_WIDTH - 800)/2), 533 + ((SCREEN_HEIGHT - 600) / 2), 600 + ((SCREEN_WIDTH - 800) / 2), 554 + ((SCREEN_HEIGHT - 600) / 2));
|
// CreateProgressBar(0, (202 + (SCREEN_WIDTH - 800)/2), 533 + ((SCREEN_HEIGHT - 600) / 2), 600 + ((SCREEN_WIDTH - 800) / 2), 554 + ((SCREEN_HEIGHT - 600) / 2));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
CreateProgressBar(0, 259 + ((SCREEN_WIDTH - 1024) / 2), 683 + ((SCREEN_HEIGHT - 768) / 2), 767 + ((SCREEN_WIDTH - 1024) / 2), 708 + ((SCREEN_HEIGHT - 768) / 2));
|
// CreateProgressBar(0, 259 + ((SCREEN_WIDTH - 1024) / 2), 683 + ((SCREEN_HEIGHT - 768) / 2), 767 + ((SCREEN_WIDTH - 1024) / 2), 708 + ((SCREEN_HEIGHT - 768) / 2));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
CreateProgressBar(0, SCREEN_WIDTH*162/640, SCREEN_HEIGHT*427/480, SCREEN_WIDTH*480/640, SCREEN_HEIGHT*443/480);
|
||||||
|
|
||||||
|
|
||||||
SetProgressBarUseBorder(0, FALSE );
|
SetProgressBarUseBorder(0, FALSE );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user