Merge branch 'master' into ExtraMercs

This commit is contained in:
Asdow
2024-11-09 13:44:53 +02:00
371 changed files with 6539 additions and 13390 deletions
+13 -93
View File
@@ -1659,80 +1659,6 @@ void EndLoadScreen( )
'A' + gWorldSectorY - 1, gWorldSectorX, gbWorldSectorZ, uiSeconds, uiHundreths );
}
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str );
#ifndef USE_VFS
FILE *fp;
if ( fStartNewFile )
{ //start new file
fp = fopen( "TimeResults.txt", "w" );
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, L"See JA2\\Data\\TimeResults.txt for more detailed timings." );
fStartNewFile = FALSE;
}
else
{ //append to end of file
fp = fopen( "TimeResults.txt", "a" );
if ( fp )
{
fprintf( fp, "\n\n--------------------------------------------------------------------\n\n" );
}
}
if ( fp )
{
//Record all of the timings.
fprintf( fp, "%S\n", str );
fprintf( fp, "EnterSector() supersets LoadWorld(). This includes other external sections.\n" );
//FileRead()
fprintf( fp, "\n\nVARIOUS FUNCTION TIMINGS (exclusive of actual function timings in second heading)\n" );
uiSeconds = uiTotalFileReadTime / 1000;
uiHundreths = (uiTotalFileReadTime / 10) % 100;
fprintf( fp, "FileRead: %d.%02d (called %d times)\n", uiSeconds, uiHundreths, uiTotalFileReadCalls );
fprintf( fp, "\n\nSECTIONS OF LOADWORLD (all parts should add up to 100%)\n" );
//TrashWorld()
uiSeconds = uiTrashWorldTime / 1000;
uiHundreths = (uiTrashWorldTime / 10) % 100;
fprintf( fp, "TrashWorld: %d.%02d\n", uiSeconds, uiHundreths );
//LoadMapTilesets()
uiSeconds = uiLoadMapTilesetTime / 1000;
uiHundreths = (uiLoadMapTilesetTime / 10) % 100;
fprintf( fp, "LoadMapTileset: %d.%02d\n", uiSeconds, uiHundreths );
//LoadMapLights()
uiSeconds = uiLoadMapLightsTime / 1000;
uiHundreths = (uiLoadMapLightsTime / 10) % 100;
fprintf( fp, "LoadMapLights: %d.%02d\n", uiSeconds, uiHundreths );
uiSeconds = uiBuildShadeTableTime / 1000;
uiHundreths = (uiBuildShadeTableTime / 10) % 100;
fprintf( fp, " 1) BuildShadeTables: %d.%02d\n", uiSeconds, uiHundreths );
uiPercentage = uiNumImagesReloaded * 100 / giNumberOfTileTypes;
fprintf( fp, " 2) %d%% of the tileset images were actually reloaded.\n", uiPercentage );
if ( (uiNumTablesSaved + uiNumTablesLoaded) != 0 )
{
uiPercentage = uiNumTablesSaved * 100 / (uiNumTablesSaved + uiNumTablesLoaded);
}
else
{
uiPercentage = 0;
}
fprintf( fp, " 3) Of that, %d%% of the shade tables were generated (not loaded).\n", uiPercentage );
if ( gfForceBuildShadeTables )
fprintf( fp, " NOTE: Force building of shadetables enabled on this local computer.\n" );
//Unaccounted
uiUnaccounted = uiLoadWorldTime - uiTrashWorldTime - uiLoadMapTilesetTime - uiLoadMapLightsTime;
uiSeconds = uiUnaccounted / 1000;
uiHundreths = (uiUnaccounted / 10) % 100;
fprintf( fp, "Unaccounted: %d.%02d\n", uiSeconds, uiHundreths );
//LoadWorld()
uiSeconds = uiLoadWorldTime / 1000;
uiHundreths = (uiLoadWorldTime / 10) % 100;
fprintf( fp, "\nTotal: %d.%02d\n", uiSeconds, uiHundreths );
fclose( fp );
}
#else
sgp::Logger_ID time_log_id = sgp::Logger::instance( ).createLogger( );
sgp::Logger::instance( ).connectFile( time_log_id, L"TimeResults.txt", true, sgp::Logger::FLUSH_ON_ENDL );
sgp::Logger::LogInstance timeResults = SGP_LOG( time_log_id );
@@ -1793,7 +1719,6 @@ void EndLoadScreen( )
uiSeconds = uiLoadWorldTime / 1000;
uiHundreths = (uiLoadWorldTime / 10) % 100;
timeResults << vfs::Log::endl << "Total: " << uiSeconds << "." << uiHundreths << sgp::endl;
#endif // USE_VFS
#endif
}
@@ -3457,27 +3382,22 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY,
break;
case INSERTION_CODE_ARRIVING_GAME:
// Are we in Omerta!
if ( sSectorX == gWorldSectorX && gWorldSectorX == 9 && sSectorY == gWorldSectorY && gWorldSectorY == 1 && bSectorZ == gbWorldSectorZ && gbWorldSectorZ == 0 )
#ifdef JA2UB
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->sInsertionGridNo = gGameUBOptions.LOCATEGRIDNO;
#else
extern BOOLEAN gfFirstHeliRun;
if (gfFirstHeliRun)
{
// TODO.WANNE: Hardcoded grid number
// Try another location and walk into map
pSoldier->sInsertionGridNo = 4379;//dnl!!!
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->sInsertionGridNo = gGameExternalOptions.iInitialMercArrivalLocation;
}
else
{
#ifdef JA2UB
//pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
//pSoldier->sInsertionGridNo = gMapInformation.sNorthGridNo;
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->sInsertionGridNo = gGameUBOptions.LOCATEGRIDNO;
#else
//pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
//pSoldier->sInsertionGridNo = gMapInformation.sNorthGridNo;
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->sInsertionGridNo = gGameExternalOptions.iInitialMercArrivalLocation;
#endif
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CENTER;
pSoldier->sInsertionGridNo = gMapInformation.sCenterGridNo;
}
#endif
break;
case INSERTION_CODE_CHOPPER:
// Try another location and walk into map
@@ -4773,8 +4693,8 @@ void DoneFadeOutAdjacentSector( )
curr->pSoldier->ubWaitActionToDo = 1;
// OK, here we have been given a position, a gridno has been given to use as well....
sOldGridNo = curr->pSoldier->sGridNo;
sWorldX = CenterX( sGridNo );
sWorldY = CenterY( sGridNo );
ConvertGridNoToCenterCellXY(sGridNo, &sWorldX, &sWorldY);
curr->pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY );
if ( sGridNo != sOldGridNo )
{