Files
source/Loading Screen.cpp
T
Wanne 7ca53fadc7 *** MERGED source code from development trunk revision 4890 up to latest current revision 5105 ***
Development Trunk (now obsolete): https://ja2svn.dyndns.org/source/ja2/branches/Wanne/JA2%201.13%20MP
A detailed list of all the features (changes) is visible in the history log of the development trunk:

INFO: There will be no further development in the development source trunk, so is obsolete from now on!

This commit contains the following features (bugfixes are not listed):

- New Feature: Show merc ranks in Strategy Screen before merc name
o Toggle on/off in the ingame options screen
o For each experience level (0-10) there are defined rank names in the language specific text files
o Additional language text that is not translated yet is marked with // TODO.Translate

- New Feature: Faster Bobby Ray Shipments
o This feature is selectable in the ja2_options.ini
o When activated Bobby Ray shipments will be really fast
-> Overnight Express: 5 - 7 hours
-> Air Service: 10, 12 or 14 hours
-> Standard Service: 15, 18 or 21 hours
o In a multiplayer game, this feature is disabled (because shipment arrive immediately in the destination sector)

- New Feature: AP cost for manipulating the merc inventory
o This feature is selectable in the start new game screen
o For example, putting a weapon from hand in the backpack costs APs
o The AP costs are defined in the APBPConstants.ini
o In a multiplayer game, this feature is disabled

- New Feature: Added possibility to set individual Gear Kit names
o Set individual names in the optional new tag <mGearKitName> inside the <GEARKIT> root element (File: TableData\MercStartingGear.xml)

- New Feature: Externalized the maximum purchase amount (JA2 vanilla: 10) for Bobby Rays purchases per shipment
o Define the max. amount in the ja2_options.ini: BOBBY_RAY_MAX_PURCHASE_AMOUNT, Range: 10 - 100)
o Nice scrolling bars to scroll through all the purchases

- New Feature: Now it is possible to walk on "water" tiles or handle those tiles like "normal" tiles 
o (instead of showing the swimming animation and counting the APs for swimming), when the soldier is located on the second level (level > 0)

- New Feature: Externalized AIM Veterans laptop site
o Add maximum of 4 pages
o Add  new AIM to veterans page, and remove AIM from veterans page.
o New XML file: OldAIMArchive.xml (language specific XML files: *.OldAIMArchive.xml)

- New Feature: Added possibility to choose from 254 IMP faces
o Modified IMPPortraits.xml
o Added new GameDir folder "IMPFaces" which contains the IMP face portraits
o Moved IMP faces in the new "IMPFaces" folder

- New Feature: ARSP - All Resolution Support Project
o See here: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=298698&page=1
o Support any kind of screen resolution. This works by choosing the matching full supported resolution (640x480, 800x600, 1024x768) and then centering the graphics
o See ja2.ini for defining the screen resolution

- New Feature: AI Turn Speed Up (FF-MOD)
o see here: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=298699#Post298699
o When this feature is activated it allows fast enemy turns
o New entry in ja2.ini to enable this feature: HIGHSPEED_TIMER = TRUE
o Turn on/off auto fast turns in ingame options
o New ja2_options.ini settings for fine tuning: [Clock Settings] ini block

- New Feature: "Lock" / "Release" mouse cursor in tactical windowed mode, so the mouse can stay within window boundary
o This is very helpful for doing scrolling with the mouse (by moving the mouse to the window edge) in windowed mode
o You can toggle on/off the feature by pressing CTRL + Z. It is also possible to press CTRL + Y. So the user can decide which fits better :)
o Whenever you toggle on/off a screen message appears on the tactical log to notify the player

- New Feature: Weapon overheating
o Basically, every shot fired from a gun increases its temperature. On higher temperatures, the gun jams more frequently
o On/off toggle in the ingame options
o Graphical thermometer indication on the weapon picture
o New ja2_options.ini section with a few options, Section: [Tactical Weapon Overheating Settings]
o XML changes (New Tags)
--> AmmoTypes.xml: <temperatureModificator>
--> Items.xml: <barrel>, <usOverheatingCooldownFactor>
--> Weapons.xml: <usOverheatingJamThreshold>, <usOverheatingDamageThreshold>, <usOverheatingSingleShotTemperature>
o Added a few barells to Items.xml (end of the file)
o more infos: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=301059&page=1

- New Feature: Resting weapons on a surfaces
o You can now rest your weapon on crates, low walls, rocks, debris, open windows etc. while you are crouched. Resting will give yu the superior gun handling modifiers from PRONE position.
o A little 'A' on your gun indicates if you are resting it or not.
o Both settings can be turned on and off in Ja2_Options.ini under 'Tactical Gameplay Settings'

- New Feature: Externalized option on whether mercs can exit sector using grid exit in turn based mode
o new ja2_options.ini property: GRID_EXIT_IN_TURNBASED
o This ini setting does not affect leaving sectors on map edges

- Rework/Update: Ammo boxes and Ammo crates
o Ammo crate items added for remaining calibers.  Tweaked prices to correspond to magazines, tweaked capacities and weights to be reasonable (~800 or less).
o Shift-R reload now looks at both boxes and crates in sector items and merc's inventory to reload, and tops off magazines in inventory as well.  Only possible outside of combat.
o Ctrl-Shift-A still creates crates as per usual, with some fixes to ensure all ammo is caught on the first press.
o Shift-A now creates ammo boxes in the same loop.  They mostly behave like crates, but fit in mercs inventories.
o Ammo boxes are available to purchase at BR and tony, sam, etc.  Individual magazines/drums/etc are no longer available.
o Removed ammo crate xml tag.  Added ubMagType tag to Magazines array.  This allows us to differentiate between magazines, bullets, boxes and crates.
o Changed ammo filtering in BR's to display boxes appropriately.  Added back the "Mag:" display (changed text to "Size:")
o Added ja2set.dat.xml file (WF map version in WF maps folder) to be used instead of ja2set.dat file (ja2.ini setting added) For now, if you want to play vanilla instead, just change the setting in the ini (see comments in file).
o Added P4-P9Items image files (up to 5k images each) and tileslots.  1.13 core items will continue to use Guns and P1-P3Items for the foreseeable future.  P4-P9 can be used by customizers/modders to avoid conflicts with Guns/P1-P3 items.  TODO: Need to discuss a strategy for this in the forums.
o Added in Ambient/0.bad and 32.bad to avoid an exception in the code.
o Updated the XML Editor
o Standardized the text on all the ammo items.

- New Multiplayer Feature: Sharing same FOV (field of view) in a coop/team-dm (for friendly teams) game
o You will also see enemies, that your teammate sees

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5108 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2012-03-23 18:46:54 +00:00

606 lines
18 KiB
C++

#ifdef PRECOMPILEDHEADERS
#include "JA2 All.h"
#include "Loading Screen.h"
#include "INIReader.h"
#else
#include "vsurface.h"
#include "mapscreen.h"
#include "Loading Screen.h"
#include "Campaign Types.h"
#include "Game Clock.h"
#include "GameSettings.h"
#include "Random.h"
#include "Debug.h"
#include "local.h"
#include "Font Control.h"
#include "font.h"
#include "render dirty.h"
#endif
#include "Strategic Movement.h"
#include "UndergroundInit.h"
#include <string>
extern HVSURFACE ghFrameBuffer;
extern BOOLEAN gfSchedulesHosed;
#ifdef JA2UB
#include "Ja25_Tactical.h"
#include "Ja25 Strategic Ai.h"
#endif
UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING;
BOOLEAN bShowSmallImage = FALSE;
SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
static INT16 requestedX, requestedY, requestedZ;
static STR8 szSector;
static STR8 szSectorMap[MAP_WORLD_Y][MAP_WORLD_X] = {
{"N", "N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" , "N" , "N" , "N" , "N" , "N" , "N" , "N" ,"N"},
{"N", "A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","A13","A14","A15","A16" ,"N"},
{"N", "B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","B11","B12","B13","B14","B15","B16" ,"N"},
{"N", "C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13","C14","C15","C16" ,"N"},
{"N", "D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13","D14","D15","D16" ,"N"},
{"N", "E1","E2","E3","E4","E5","E6","E7","E8","E9","E10","E11","E12","E13","E14","E15","E16" ,"N"},
{"N", "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16" ,"N"},
{"N", "G1","G2","G3","G4","G5","G6","G7","G8","G9","G10","G11","G12","G13","G14","G15","G16" ,"N"},
{"N", "H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13","H14","H15","H16" ,"N"},
{"N", "I1","I2","I3","I4","I5","I6","I7","I8","I9","I10","I11","I12","I13","I14","I15","I16" ,"N"},
{"N", "J1","J2","J3","J4","J5","J6","J7","J8","J9","J10","J11","J12","J13","J14","J15","J16" ,"N"},
{"N", "K1","K2","K3","K4","K5","K6","K7","K8","K9","K10","K11","K12","K13","K14","K15","K16" ,"N"},
{"N", "L1","L2","L3","L4","L5","L6","L7","L8","L9","L10","L11","L12","L13","L14","L15","L16" ,"N"},
{"N", "M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12","M13","M14","M15","M16" ,"N"},
{"N", "N1","N2","N3","N4","N5","N6","N7","N8","N9","N10","N11","N12","N13","N14","N15","N16" ,"N"},
{"N", "O1","O2","O3","O4","O5","O6","O7","O8","O9","O10","O11","O12","O13","O14","O15","O16" ,"N"},
{"N", "P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16" ,"N"},
{"N", "N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" , "N" , "N" , "N" , "N" , "N" , "N" , "N" ,"N"},
};
// Map LOADINGSCREEN_NOTHING, ..., LOADINGSCREEN_NIGHTBALIME (see enum in header file)
// to some strings which will be used to create the actual filename
// (by appending e.g. "_800x600.sti" or something).
// This is only used when NOT loading them from SectorLoadscreens.xml.
static STR8 LoadScreenNames[LOADINGSCREEN_NIGHTBALIME+1] =
{
"LS_Heli",
"LS_DayGeneric",
"LS_DayTown1",
"LS_DayTown2",
"LS_DayWild",
"LS_DayTropical",
"LS_DayForest",
"LS_DayDesert",
"LS_DayPalace",
"LS_NightGeneric",
"LS_NightWild",
"LS_NightTown1",
"LS_NightTown2",
"LS_NightForest",
"LS_NightTropical",
"LS_NightDesert",
"LS_NightPalace",
"LS_Heli",
"LS_Basement",
"LS_Mine",
"LS_Cave",
"LS_DayPine",
"LS_NightPine",
"LS_DayMilitary",
"LS_NightMilitary",
"LS_DaySAM",
"LS_NightSAM",
"LS_DayPrison",
"LS_NightPrison",
"LS_DayHospital",
"LS_NightHospital",
"LS_DayAirport",
"LS_NightAirport",
"LS_DayLab",
"LS_NightLab",
"LS_DayOmerta",
"LS_NightOmerta",
"LS_DayChitzena",
"LS_NightChitzena",
"LS_DayMine",
"LS_NightMine",
"LS_DayBalime",
"LS_NightBalime",
};
//returns the UINT8 ID for the specified sector.
// Which for sectors above ground is one of { HELI, DAY, NIGHT }
// if gGameExternalOptions.gfUseExternalLoadscreens.
// Otherwise and for underground sectors this is the actual loadsceen ID.
UINT8 GetLoadScreenID(INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ)
{
const UINT8 ubSectorID = SECTOR( sSectorX, sSectorY );
const BOOLEAN fNight = NightTime(); //before 5AM or after 9PM
requestedX = sSectorX; requestedY = sSectorY; requestedZ = bSectorZ;
/* User made system - BEGIN */
if (gGameExternalOptions.gfUseExternalLoadscreens)
{
if (bSectorZ != 0)
{
szSector = szSectorMap [sSectorY][sSectorX]; // not really necessary, I guess
return UNDERGROUND;
}
switch( ubSectorID )
{
case SEC_A9:
szSector = "A9";
return DidGameJustStart() ? HELI : (fNight ? NIGHT : DAY);
default:
szSector = szSectorMap [sSectorY][sSectorX];
return fNight ? NIGHT : DAY;
}
} /* WANNE: User made System - END */
/* WANNE: Sir-Tech System - BEGIN */
else
{
// Which map layer? (ground, basement 1-3)?
switch( bSectorZ )
{
// Ground
case 0:
{
switch( ubSectorID )
{
case SEC_A2:
case SEC_B2:
return fNight ? LOADINGSCREEN_NIGHTCHITZENA : LOADINGSCREEN_DAYCHITZENA;
case SEC_A9:
return DidGameJustStart() ? LOADINGSCREEN_HELI :
(fNight ? LOADINGSCREEN_NIGHTOMERTA : LOADINGSCREEN_DAYOMERTA);
case SEC_A10:
return fNight ? LOADINGSCREEN_NIGHTOMERTA : LOADINGSCREEN_DAYOMERTA;
case SEC_P3:
return fNight ? LOADINGSCREEN_NIGHTPALACE : LOADINGSCREEN_DAYPALACE;
case SEC_H13:
case SEC_H14: //military installations
case SEC_I13:
case SEC_N7:
return fNight ? LOADINGSCREEN_NIGHTMILITARY : LOADINGSCREEN_DAYMILITARY;
case SEC_K4:
return fNight ? LOADINGSCREEN_NIGHTLAB : LOADINGSCREEN_DAYLAB;
case SEC_J9:
return fNight ? LOADINGSCREEN_NIGHTPRISON : LOADINGSCREEN_DAYPRISON;
case SEC_D2:
case SEC_D15:
case SEC_I8:
case SEC_N4:
return fNight ? LOADINGSCREEN_NIGHTSAM : LOADINGSCREEN_DAYSAM;
case SEC_F8:
return fNight ? LOADINGSCREEN_NIGHTHOSPITAL : LOADINGSCREEN_DAYHOSPITAL;
case SEC_B13:
case SEC_N3:
return fNight ? LOADINGSCREEN_NIGHTAIRPORT : LOADINGSCREEN_DAYAIRPORT;
case SEC_L11:
case SEC_L12:
return fNight ? LOADINGSCREEN_NIGHTBALIME : LOADINGSCREEN_DAYBALIME;
case SEC_H3:
case SEC_H8:
case SEC_D4:
return fNight ? LOADINGSCREEN_NIGHTMINE : LOADINGSCREEN_DAYMINE;
}
SECTORINFO *pSector = &SectorInfo[ ubSectorID ];
switch( pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] )
{
case TOWN:
return Random(2) > 0 ?
(fNight ? LOADINGSCREEN_NIGHTTOWN2 : LOADINGSCREEN_DAYTOWN2) :
(fNight ? LOADINGSCREEN_NIGHTTOWN1 : LOADINGSCREEN_DAYTOWN1);
case SAND:
case SAND_ROAD:
return fNight ? LOADINGSCREEN_NIGHTDESERT : LOADINGSCREEN_DAYDESERT;
case FARMLAND:
case FARMLAND_ROAD:
case ROAD:
return fNight ? LOADINGSCREEN_NIGHTGENERIC : LOADINGSCREEN_DAYGENERIC;
case PLAINS:
case SPARSE:
case HILLS:
case PLAINS_ROAD:
case SPARSE_ROAD:
case HILLS_ROAD:
return fNight ? LOADINGSCREEN_NIGHTWILD : LOADINGSCREEN_DAYWILD;
case DENSE:
case SWAMP:
case SWAMP_ROAD:
case DENSE_ROAD:
return fNight ? LOADINGSCREEN_NIGHTFOREST : LOADINGSCREEN_DAYFOREST;
case TROPICS:
case TROPICS_ROAD:
case WATER:
case NS_RIVER:
case EW_RIVER:
case COASTAL:
case COASTAL_ROAD:
return fNight ? LOADINGSCREEN_NIGHTTROPICAL : LOADINGSCREEN_DAYTROPICAL;
default:
Assert( 0 );
return fNight ? LOADINGSCREEN_NIGHTGENERIC : LOADINGSCREEN_DAYGENERIC;
}
/* WANNE: Sir-Tech System */
}
#ifdef JA2UB
case 1:
{
switch( ubSectorID )
{
case SEC_I13:
case SEC_J13:
return fNight ? LOADINGSCREEN_MINE : LOADINGSCREEN_MINE;
//tunnels
case SEC_J14:
case SEC_K14:
return LOADINGSCREEN_TUNNELS;
case SEC_K15:
{
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_UP_STAIRS )
return LOADINGSCREEN_UP_STAIRS;
else if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_DOWN_STAIRS )
return LOADINGSCREEN_DOWN_STAIRS;
else
return LOADINGSCREEN_COMPLEX_BASEMENT_GENERIC;
}
default:
return LOADINGSCREEN_BASEMENT;
}
}
case 2:
{
switch( ubSectorID )
{
case SEC_K15:
{
//if we are going up stairs, else traversing at same level
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_UP_STAIRS )
return LOADINGSCREEN_UP_STAIRS;
else if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_DOWN_STAIRS )
return LOADINGSCREEN_DOWN_STAIRS;
else
return LOADINGSCREEN_COMPLEX_BASEMENT;
}
case SEC_L15:
{
//if we are going up stairs, else traversing at same level
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_UP_STAIRS )
return LOADINGSCREEN_UP_STAIRS;
else
return LOADINGSCREEN_COMPLEX_BASEMENT;
}
default:
return LOADINGSCREEN_BASEMENT;
}
}
case 3:
{
switch( ubSectorID )
{
case SEC_L15:
{
//if we are going up stairs, else traversing at same level
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_DOWN_STAIRS )
return LOADINGSCREEN_DOWN_STAIRS;
else
return LOADINGSCREEN_COMPLEX_BASEMENT_GENERIC;
}
default:
return LOADINGSCREEN_CAVE;
}
}
break;
return LOADINGSCREEN_CAVE;
default:
/*
case 1:
case 2:
case 3:
return LOADINGSCREEN_CAVE;
break;
return LOADINGSCREEN_CAVE;
default:
*/
#else
// Basement Level 1
case 1:
switch( ubSectorID )
{
case SEC_A10: //Miguel's basement
case SEC_I13: //Alma prison dungeon
case SEC_J9: //Tixa prison dungeon
case SEC_K4: //Orta weapons plant
case SEC_O3: //Meduna
case SEC_P3: //Meduna
return LOADINGSCREEN_BASEMENT;
default: //rest are mines
return LOADINGSCREEN_MINE;
}
// Basement Level 2 and 3
case 2:
case 3:
//all level 2 and 3 maps are caves!
return LOADINGSCREEN_CAVE;
default:
#endif
// shouldn't ever happen
Assert( FALSE );
return fNight ? LOADINGSCREEN_NIGHTGENERIC : LOADINGSCREEN_DAYGENERIC;
}
} /* WANNE: Sir-Tech System - END */
}
static void BuildLoadscreenFilename(std::string& dst, const char* path, int resolution, const char* ext)
{
if (path)
dst.append(path);
if (iResolution >= _640x480 && iResolution < _800x600)
{
// Nothing to do here
}
else if (iResolution < _1024x768)
{
dst.append("_800x600");
}
else
{
dst.append("_1024x768");
}
if (ext)
{
dst.append(".");
dst.append(ext);
}
else
// This might suck later on. If it does, remove it.
dst.append(".sti");
}
//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER,
//and refreshing the screen with it.
void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
{
VSURFACE_DESC vs_desc = {};
HVSURFACE hVSurface;
UINT32 uiLoadScreen;
STRING512 smallImage = {0};
// STRING512 xName;
// char szFullImagePath[80];
STRING512 sImage = {0};
bShowSmallImage = FALSE;
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
const BOOLEAN fExternalLS = (szSector != NULL) && ((DAY <= ubLoadScreenID && ubLoadScreenID <= NIGHT_ALT) || (ubLoadScreenID == UNDERGROUND));
if (fExternalLS)
{
// Get the image path
std::string imagePath;
std::string imageFormat;
// Start screen
if (ubLoadScreenID == HELI)
{
imagePath = gSectorLoadscreens[0].szDay;
imageFormat = gSectorLoadscreens[0].szImageFormat;
}
else if (ubLoadScreenID == UNDERGROUND)
{
g_luaUnderground.GetLoadscreen(requestedX, requestedY, requestedZ, imagePath, imageFormat);
}
else
{
for (int i = 1; i < MAX_SECTOR_LOADSCREENS; i++)
{
// We found the sector
if (strcmp(gSectorLoadscreens[i].szLocation, szSector) == 0)
{
imageFormat = gSectorLoadscreens[i].szImageFormat;
BOOLEAN fAlternate = gSectorLoadscreens[i].RandomAltSector;
if (fAlternate && (Random(2) > 0))
{
switch (ubLoadScreenID)
{
case DAY:
ubLoadScreenID = DAY_ALT;
break;
case NIGHT:
ubLoadScreenID = NIGHT_ALT;
break;
default:
break;
}
}
switch (ubLoadScreenID)
{
case DAY:
imagePath = gSectorLoadscreens[i].szDay;
break;
case DAY_ALT:
imagePath = gSectorLoadscreens[i].szDayAlt;
break;
case NIGHT:
imagePath = gSectorLoadscreens[i].szNight;
break;
case NIGHT_ALT:
imagePath = gSectorLoadscreens[i].szNight;
break;
}
break;
}
}
}
// Small image: 640x480
std::string strSmallImage;
BuildLoadscreenFilename(strSmallImage, imagePath.c_str(), 0, imageFormat.c_str());
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
// Actual image, depending on the resolution
std::string strBigImage;
if (iResolution >= _640x480 && iResolution < _800x600)
{
BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 0, imageFormat.c_str());
}
else if (iResolution < _1024x768)
{
BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 1, imageFormat.c_str());
}
else
{
BuildLoadscreenFilename(strBigImage, imagePath.c_str(), 2, imageFormat.c_str());
}
strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
if ( !FileExists(vs_desc.ImageFile) )
{
// Small image: 640x480
std::string strSmallImage("LOADSCREENS\\");
std::string strBigImage("LOADSCREENS\\");
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[1], 0, imageFormat.c_str());
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
// Actual image, depending on the resolution
if (iResolution >= _640x480 && iResolution < _800x600)
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 0, imageFormat.c_str());
}
else if (iResolution < _1024x768)
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 1, imageFormat.c_str());
}
else
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[1], 2, imageFormat.c_str());
}
strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
}
}
else
{
std::string strSmallImage("LOADSCREENS\\");
std::string strBigImage("LOADSCREENS\\");
if (LOADINGSCREEN_NOTHING <= ubLoadScreenID && ubLoadScreenID <= LOADINGSCREEN_NIGHTBALIME)
{
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
if (iResolution >= _640x480 && iResolution < _800x600)
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
}
else if (iResolution < _1024x768)
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 1, "sti");
}
else
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[ubLoadScreenID], 2, "sti");
}
}
else
{
// for some reason the heli screen is the default
BuildLoadscreenFilename(strSmallImage, LoadScreenNames[0], 0, "sti");
if (iResolution >= _640x480 && iResolution < _800x600)
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 0, "sti");
}
else if (iResolution < _1024x768)
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 1, "sti");
}
else
{
BuildLoadscreenFilename(strBigImage, LoadScreenNames[0], 2, "sti");
}
}
strSmallImage.copy(smallImage, sizeof(smallImage)-1);
strBigImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
}
if( gfSchedulesHosed )
{
SetFont( FONT10ARIAL );
SetFontForeground( FONT_YELLOW );
SetFontShadow( FONT_NEARBLACK );
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
mprintf( 5, 5, L"Error loading save, attempting to patch save to version 1.02...", vs_desc.ImageFile );
}
else
{
BOOLEAN fOk = FALSE;
if(FileExists(vs_desc.ImageFile) && AddVideoSurface(&vs_desc, &uiLoadScreen))
fOk = TRUE;
else
{
// Sti loadscreen is not available
// we may have tried the big image, so let's check out the small one
bShowSmallImage = TRUE;
strncpy(vs_desc.ImageFile, smallImage, sizeof(vs_desc.ImageFile)-1);
if (FileExists(vs_desc.ImageFile) && AddVideoSurface(&vs_desc, &uiLoadScreen))
fOk = TRUE;
}
if (fOk)
{
//Blit the background image
GetVideoSurface(&hVSurface, uiLoadScreen);
// Special case->show the small image centered
if (iResolution > _640x480 && bShowSmallImage)
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
else
{
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, (SCREEN_WIDTH - xResSize) / 2,(SCREEN_HEIGHT - yResSize) / 2, 0, NULL );
}
DeleteVideoSurfaceFromIndex( uiLoadScreen );
}
else
{
//Failed to load the file, so use a black screen and print out message.
SetFont( FONT10ARIAL );
SetFontForeground( FONT_YELLOW );
SetFontShadow( FONT_NEARBLACK );
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
mprintf( 5, 5, L"%S loadscreen data file not found...", vs_desc.ImageFile );
}
}
gubLastLoadingScreenID = ubLoadScreenID;
InvalidateScreen( );
ExecuteBaseDirtyRectQueue();
EndFrameBufferRender();
RefreshScreen( NULL );
}