From f48fadb8025f63741d914eb265077cac71b240cb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Nov 2024 23:50:52 +0200 Subject: [PATCH 001/118] Improve AbstractXMLParser error reporting (#330) The more detailed error message that used to go only to Livelog.txt is now also displayed in the ingame error screen, providing more helpful error message to players when making bug reports/asking for help --- Ja2/Init.cpp | 12 +++++++----- Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp | 9 +++++---- Tactical/LogicalBodyTypes/AbstractXMLLoader.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 605a13a7..44a90d76 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -438,11 +438,13 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) if (isMultiplayer == false) { using namespace LogicalBodyTypes; - SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME), LBT_LAYERSFILENAME); - SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME), LBT_PALETTESFILENAME); - SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME), LBT_ANIMSURFACESFILENAME); - SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME), LBT_FILTERSFILENAME); - SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME), LBT_BODYTYPESFILENAME); + CHAR8 errorBuf[512]{"Failed loading LogicalBodyTypes external data!"}; + + SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME, errorBuf), errorBuf); } } diff --git a/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp b/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp index ab182259..93d74672 100644 --- a/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp +++ b/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp @@ -24,14 +24,15 @@ AbstractXMLLoader::ParseData* AbstractXMLLoader::MakeParseData(XML_Parser* parse return new ParseData(parser); } -bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* fileName) { +bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* fileName, CHAR8* errorBuf) { HWFILE hFile; UINT32 uiBytesRead; UINT32 uiFSize; CHAR8* lpcBuffer; char fileNameFull[MAX_PATH + 1]; if (strlen(fileName) + strlen(directoryName) >= MAX_PATH) { - LiveMessage("Can't load file. Concatinated filename too long for buffer!"); + sprintf(errorBuf, "Can't load file %s%s, Concatenated filename too long for buffer!", directoryName, fileName); + LiveMessage(errorBuf); return false; } SetDirectoryName(directoryName); @@ -46,12 +47,14 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file DebugMsg(TOPIC_JA2, DBG_LEVEL_3, msg.c_str()); hFile = FileOpen(fileNameFull, FILE_ACCESS_READ, FALSE); if (!hFile) { + sprintf(errorBuf, "Can't open %s", fileNameFull); delete data; return false; } uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8*)MemAlloc(uiFSize + 1); if (!FileRead(hFile, lpcBuffer, uiFSize, &uiBytesRead)) { + sprintf(errorBuf, "Error reading %s to buffer", fileNameFull); MemFree(lpcBuffer); delete data; return false; @@ -72,7 +75,6 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file try { if (!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { - CHAR8 errorBuf[512]; sprintf(errorBuf, "XML Parser Error in %s[%d]: %s", fileNameFull, XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser))); LiveMessage(errorBuf); MemFree(lpcBuffer); @@ -80,7 +82,6 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file return false; } } catch (XMLParseException e) { - CHAR8 errorBuf[512]; sprintf(errorBuf, "XML Parser Exception in %s[%d]: %s", fileNameFull, e._LINE, e.what()); LiveMessage(errorBuf); MemFree(lpcBuffer); diff --git a/Tactical/LogicalBodyTypes/AbstractXMLLoader.h b/Tactical/LogicalBodyTypes/AbstractXMLLoader.h index 765c127b..20749ba0 100644 --- a/Tactical/LogicalBodyTypes/AbstractXMLLoader.h +++ b/Tactical/LogicalBodyTypes/AbstractXMLLoader.h @@ -55,7 +55,7 @@ private: public: AbstractXMLLoader(XML_StartElementHandler startHandler, XML_EndElementHandler endHandler, XML_CharacterDataHandler charHandler, ParseDataFactoryFunc parseDataFactF = MakeParseData); ~AbstractXMLLoader(void); - bool LoadFromFile(const char* directoryName, const char* fileName); + bool LoadFromFile(const char* directoryName, const char* fileName, CHAR8* errorBuf); const char* GetFileName(); const char* GetDirectoryName(); void SetFileName(const char* fileName); From 1cd94cda23516df002d5dae06450b38890912825 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:05:14 +0200 Subject: [PATCH 002/118] Fix inventory cloning bug (#338) - If we have a sector already loaded (eg. Drassen airport) - Squad in a different sector encounters enemies and goes to autoresolve - After pressing DONE in autoresolve screen -> we miss calling the TrashWorld() function in CheckAndHandleUnloadingOfCurrentWorld() due to battle sector not being the same as loaded sector. - Selected sector gets reset from Drassen airport to invalid values by same function - Now we have the loaded sector's whole inventory existing in gWorldItems - Enter any other sector in tactical mode and the gWorldItems gets added into its sector inventory in EnterSector() Because the TrashItems() work in a way where it only sets gWorldItems elements to not existing if it finds them in a loaded map's structure data, we will pretty much always have that original bugged out set of items present in gWorlItems and they will constantly be added to sector inventories from then on once the bug has been triggered. --- Strategic/strategicmap.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 5708dfc7..801bda22 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -6665,18 +6665,16 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) if ( guiCurrentScreen == AUTORESOLVE_SCREEN ) { - if ( gWorldSectorX == sBattleSectorX && gWorldSectorY == sBattleSectorY && gbWorldSectorZ == sBattleSectorZ ) - { //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside - //TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because - //we are in the autoresolve screen, soldiers are internally created different (from pointers instead of - //the MercPtrs[]). It keys on the fact that we are in the autoresolve screen. So, by switching the - //screen, it'll delete the soldiers in the loaded world properly, then later on, once autoresolve is - //complete, it'll delete the autoresolve soldiers properly. As you can now see, the above if conditions - //don't change throughout this whole process which makes it necessary to do it this way. - guiCurrentScreen = MAP_SCREEN; - TrashWorld( ); - guiCurrentScreen = AUTORESOLVE_SCREEN; - } + //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside + //TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because + //we are in the autoresolve screen, soldiers are internally created different (from pointers instead of + //the MercPtrs[]). It keys on the fact that we are in the autoresolve screen. So, by switching the + //screen, it'll delete the soldiers in the loaded world properly, then later on, once autoresolve is + //complete, it'll delete the autoresolve soldiers properly. As you can now see, the above if conditions + //don't change throughout this whole process which makes it necessary to do it this way. + guiCurrentScreen = MAP_SCREEN; + TrashWorld( ); + guiCurrentScreen = AUTORESOLVE_SCREEN; } else { From 11bb0f741fea79ad4ea4cf03877e076845fa0c97 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 2 Dec 2024 01:10:58 +0200 Subject: [PATCH 003/118] Fix music playing when crepitus is present (#341) UseCreatureMusic( HostileZombiesPresent() ); was overriding the music mode set in PrepareCreaturesForBattle() when encountering crepitus or being in the creature caves, resulting in regular tense and battle music being played. --- Strategic/Meanwhile.cpp | 2 +- Strategic/PreBattle Interface.cpp | 4 +- Strategic/Strategic Movement.cpp | 2 +- Tactical/Merc Entering.cpp | 2 +- Tactical/Overhead.cpp | 85 +++++++++++++++---------------- Tactical/Rotting Corpses.cpp | 23 +++++++++ Tactical/Rotting Corpses.h | 4 +- 7 files changed, 73 insertions(+), 49 deletions(-) diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index ad9cdb8a..52c578fd 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -864,7 +864,7 @@ void EndMeanwhile( ) { // We leave this sector open for our POWs to escape! // Set music mode to enemy present! - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index a26c7ab8..0f04d615 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -1071,8 +1071,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) //Disable the options button when the auto resolve screen comes up EnableDisAbleMapScreenOptionsButton( FALSE ); - UseCreatureMusic(HostileZombiesPresent()); - + CheckForZombieMusic(); + #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ]; if ( MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ] != -1 ) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index e1c24384..b1e0b6be 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -1085,7 +1085,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating } //Set music - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 39dc0e7d..eacb0f7c 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -991,7 +991,7 @@ void HandleFirstHeliDropOfGame( ) SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); // Start music - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 9ea83354..ddc86eaa 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6664,7 +6664,7 @@ void ExitCombatMode( ) // unused //gfForceMusicToTense = TRUE; - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; @@ -6706,63 +6706,62 @@ void ExitCombatMode( ) } -void SetEnemyPresence( ) +void SetEnemyPresence() { - // We have an ememy present.... - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence")); + // We have an ememy present.... + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence" ) ); - // Check if we previously had no enemys present and we are in a virgin secotr ( no enemys spotted yet ) - if ( !gTacticalStatus.fEnemyInSector && gTacticalStatus.fVirginSector ) - { - // If we have a guy selected, say quote! - // For now, display ono status message - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ENEMY_IN_SECTOR_STR ] ); + // Check if we previously had no enemys present and we are in a virgin secotr ( no enemys spotted yet ) + if ( !gTacticalStatus.fEnemyInSector && gTacticalStatus.fVirginSector ) + { + // If we have a guy selected, say quote! + // For now, display ono status message + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ENEMY_IN_SECTOR_STR] ); - // Change music modes.. + // Change music modes.. - // If we are just starting game, don't do this! + // If we are just starting game, don't do this! #ifdef JA2UB - //Ja25: no meanwhiles - if ( !DidGameJustStart() ) + //Ja25: no meanwhiles + if ( !DidGameJustStart() ) #else - if ( !DidGameJustStart() && !AreInMeanwhile( ) ) - + if ( !DidGameJustStart() && !AreInMeanwhile() ) #endif - { + { - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC - GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; - if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 ) - SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] ); - else + GlobalSoundID = MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ]; + if ( MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ] != -1 ) + SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ] ); + else #endif - SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); + SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false")); - sniperwarning = FALSE; - biggunwarning = FALSE; - gogglewarning = FALSE; - checkBonusMilitia = TRUE; - // airstrikeavailable = TRUE; - } - else - { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = true")); - sniperwarning = TRUE; - biggunwarning = TRUE; - //gogglewarning = TRUE; - // airstrikeavailable = FALSE; - } + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence: warnings = false" ) ); + sniperwarning = FALSE; + biggunwarning = FALSE; + gogglewarning = FALSE; + checkBonusMilitia = TRUE; + // airstrikeavailable = TRUE; + } + else + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence: warnings = true" ) ); + sniperwarning = TRUE; + biggunwarning = TRUE; + //gogglewarning = TRUE; + // airstrikeavailable = FALSE; + } - // Say quote... - //SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); + // Say quote... + //SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); - gTacticalStatus.fEnemyInSector = TRUE; + gTacticalStatus.fEnemyInSector = TRUE; - } + } } @@ -7078,7 +7077,7 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen ) // Begin tense music.... // unused //gfForceMusicToTense = TRUE; - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 5083ecc9..64707e3f 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -3259,3 +3259,26 @@ FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ) return (FLOAT)(min(gGameExternalOptions.usCorpseDelayUntilRotting, GetWorldTotalMin() - pCorpse->def.uiTimeOfDeath)) / gGameExternalOptions.usCorpseDelayUntilRotting; } + +void CheckForZombieMusic() +{ + extern UINT8 LightGetColors( SGPPaletteEntry * pPal ); + + if ( gGameSettings.fOptions[TOPTION_ZOMBIES] ) + { + SGPPaletteEntry LColors[3]; + LightGetColors( LColors ); + + // If we're underground in the creature caves, use creepy music based on the cave light colors. + // Without this, the crepitus cave music is not working correctly as these checks override the original musicmode choice + // See PrepareCreaturesForBattle() in Creature Spreading.cpp + if ( gbWorldSectorZ ) + { + UseCreatureMusic( LColors->peBlue || HostileZombiesPresent() ); + } + else + { + UseCreatureMusic( HostileZombiesPresent() ); + } + } +} diff --git a/Tactical/Rotting Corpses.h b/Tactical/Rotting Corpses.h index 79c53918..af65bcbc 100644 --- a/Tactical/Rotting Corpses.h +++ b/Tactical/Rotting Corpses.h @@ -242,4 +242,6 @@ BOOLEAN CorpseOkToDress( ROTTING_CORPSE* pCorpse ); // Flugente: how rotten is this corpse? values from 0 to 1, 1 as soon as it is rotting FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ); -#endif \ No newline at end of file +void CheckForZombieMusic(); + +#endif From 1eff9f6aaa67e787792f802df5c898fa7e4dca87 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:13:09 +0200 Subject: [PATCH 004/118] Fix bloodcat ambush endless loop (#343) Some bloodcats during ambushes could have ubInsertionDirection with values > 100, which then causes endless looping in pathfinding algorithms as valid direction values range from 0 to 7 --- Tactical/Soldier Add.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 654283be..67b0e79d 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1201,7 +1201,14 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO if( fCalculateDirection ) ubDirection = ubCalculatedDirection; else + { + // Override calculated direction if we were told to.... + if ( pSoldier->ubInsertionDirection >= 100 ) + { + pSoldier->ubInsertionDirection -= 100; + } ubDirection = pSoldier->ubInsertionDirection; + } } else { From 678ef822ca95657c14cabe478a57bb03a18fb273 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:54:01 +0200 Subject: [PATCH 005/118] Fix passive bloodcats --- TacticalAI/Movement.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index ec5daaaf..5bc4b0a9 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -516,13 +516,18 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN #ifdef DEBUGDECISIONS AIPopMessage("destination Grid # itself not valid, looking around it"); #endif - if ( CREATURE_OR_BLOODCAT( pSoldier ) ) - { - // we tried to get close, failed; abort! - pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; - return( NOWHERE ); - } - else + // Commented out this branch for now because bloodcats are constantly failing to find a legal destination in the previous call to legalNPCDestination + // Following the function calls deep enough ( GoAsFarAsPossibleTowards -> InternalGoAsFarAsPossibleTowards -> LegalNPCDestination -> NewOKDestination -> InternalOkayToAddStructureToWorld -> OkayToAddStructureToTile) shows that the last one fails when checking if we can add bloodcat's structure onto the tile our merc is + // This then results them freezing and staying in place even if they can see our mercs + // The reason I'm leaving the code here instead of simply removing it is because this and the check for adding structures to a tile are really old code, + // which has definitely worked fine at some point. As I'm right now unable to find the real reason for this breaking, I'm just circumventing the issue for now. -Asdow + //if ( CREATURE_OR_BLOODCAT( pSoldier ) ) + //{ + // // we tried to get close, failed; abort! + // pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; + // return( NOWHERE ); + //} + //else { // else look at the 8 nearest gridnos to sDesGrid for a valid destination From febb283c3a82f11347aeea0d2889191866bc3a61 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:55:56 +0200 Subject: [PATCH 006/118] Allow bloodcats in RED state to roam farther Bloodcat lair had a few cats with CLOSE PATROL orders, resulting them to move only 15 tiles from their starting point, allowing them to be picked off from afar with scoped rifles. --- TacticalAI/AIUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index b6b5bf43..e0f53ecc 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -2787,7 +2787,7 @@ INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT32 * pusFromGridNo) BOOL OppPosKnown = FALSE; if (CREATURE_OR_BLOODCAT(pSoldier)) { - if (pSoldier->aiData.bAlertStatus == STATUS_BLACK) + if (pSoldier->aiData.bAlertStatus > STATUS_YELLOW) { *pusFromGridNo = pSoldier->sGridNo; // from current position! return(MAX_ROAMING_RANGE); From dcde413b7bb0597092c64cec1581caffcc807aec Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:05:50 +0200 Subject: [PATCH 007/118] Initialize AI morale to normal instead of hopeless (#345) --- Tactical/Soldier Create.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 445fcfc6..202d1dc6 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -419,6 +419,7 @@ SOLDIERCREATE_STRUCT::~SOLDIERCREATE_STRUCT() { // Note that the constructor does this automatically. void SOLDIERCREATE_STRUCT::initialize() { memset( this, 0, SIZEOF_SOLDIERCREATE_STRUCT_POD); + this->bAIMorale = MORALE_NORMAL; Inv.clear(); } From 0b21d1d798f19e881b2c0da2d291a5ee8b3e85ff Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 12:53:28 -0300 Subject: [PATCH 008/118] add a TODO file put your TODOs here so you won't forget, or in case you do, maybe someone can pick it up in the decades to come --- TODO | 1 + 1 file changed, 1 insertion(+) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ + From b89c63058fa6957a3a933b5a5b23fb55bbf61221 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 12:54:54 -0300 Subject: [PATCH 009/118] fix broken MS2022 behavior a recent Visual Studio update introduced an error unless there is a CMakePresets.json file present, this patches it over for now and makes note to remove it once this is fixed --- CMakePresets.json | 3 +++ TODO | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..cd2f236b --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,3 @@ +{ + "version": 3 +} diff --git a/TODO b/TODO index 8b137891..75f8728d 100644 --- a/TODO +++ b/TODO @@ -1 +1 @@ - +remove CMakePresets.json file as soon as Visual Studio 2022 doesn't output a `Include is not found at path "x:\xxx\cmakepresets.json"` error when it's absent From 2424066aab015157999a29d3ac9cfedfa6206514 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 13:44:01 -0300 Subject: [PATCH 010/118] Revert "fix broken MS2022 behavior" This reverts commit b89c63058fa6957a3a933b5a5b23fb55bbf61221. --- CMakePresets.json | 3 --- TODO | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json deleted file mode 100644 index cd2f236b..00000000 --- a/CMakePresets.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": 3 -} diff --git a/TODO b/TODO index 75f8728d..8b137891 100644 --- a/TODO +++ b/TODO @@ -1 +1 @@ -remove CMakePresets.json file as soon as Visual Studio 2022 doesn't output a `Include is not found at path "x:\xxx\cmakepresets.json"` error when it's absent + From 98cdffe5fd072c40528e34cd825c2ec7db4117ad Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 13:52:14 -0300 Subject: [PATCH 011/118] (actually) fix broken MS2022 behavior a recent Visual Studio update introduced an error unless there is a CMakePresets.json file present, completely blowing up the previous setup. after this commit, you should either delete the CMakeUserPresets.json file from your root or add it to your system - NOT repo! - excludesFile: https://stackoverflow.com/questions/7335420/global-git-ignore --- .gitignore | 2 +- cmake/CopyUserPresetTemplate.cmake | 4 ++-- cmake/presets/{CMakeUserPresets.json => CMakePresets.json} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename cmake/presets/{CMakeUserPresets.json => CMakePresets.json} (100%) diff --git a/.gitignore b/.gitignore index e91f3742..6466f05c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,6 @@ /.vs/ /build/ /out/ +/CMakePresets.json /CMakeSettings.json -/CMakeUserPresets.json /lib/ diff --git a/cmake/CopyUserPresetTemplate.cmake b/cmake/CopyUserPresetTemplate.cmake index 484f7ec8..fda0af34 100644 --- a/cmake/CopyUserPresetTemplate.cmake +++ b/cmake/CopyUserPresetTemplate.cmake @@ -5,7 +5,7 @@ function(CopyUserPresetTemplate) NOT EXISTS "${CMAKE_SOURCE_DIR}/CMakePresets.json" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/CMakeUserPresets.json" ) - file(COPY "${CMAKE_SOURCE_DIR}/cmake/presets/CMakeUserPresets.json" DESTINATION "${CMAKE_SOURCE_DIR}") - message(FATAL_ERROR "No existing preset was found, copied a preset template to ${CMAKE_SOURCE_DIR}/CMakeUserPresets.json.") + file(COPY "${CMAKE_SOURCE_DIR}/cmake/presets/CMakePresets.json" DESTINATION "${CMAKE_SOURCE_DIR}") + message(FATAL_ERROR "No existing preset was found, copied a preset template to ${CMAKE_SOURCE_DIR}/CMakePresets.json.") endif() endfunction() diff --git a/cmake/presets/CMakeUserPresets.json b/cmake/presets/CMakePresets.json similarity index 100% rename from cmake/presets/CMakeUserPresets.json rename to cmake/presets/CMakePresets.json From 87f51f0f6e41a47426136256cc7c13367d9a5e74 Mon Sep 17 00:00:00 2001 From: momoko-h Date: Tue, 10 Dec 2024 16:15:21 +0100 Subject: [PATCH 012/118] Fix warning C4715 in Music Control.cpp (#351) --- Utils/Music Control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utils/Music Control.cpp b/Utils/Music Control.cpp index aa86d29d..1030cd3d 100644 --- a/Utils/Music Control.cpp +++ b/Utils/Music Control.cpp @@ -234,7 +234,7 @@ BOOLEAN MusicPlay(NewMusicList mode, UINT8 songIndex) return FALSE; } - MusicPlay(MusicLists[mode][songIndex]); + return MusicPlay(MusicLists[mode][songIndex]); } //******************************************************************************** From 1d58bda82dc7364114f1a3bc8c9147c780c0bf8f Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 13 Dec 2024 19:07:39 -0300 Subject: [PATCH 013/118] cross-compilation scaffolding WIP requires clang/lld or mingw, obviously just make sure the MSVC_DIRECTORY env variable points to valid Visual Studio Build Tools directory and do: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=clang_or_mingw_toolchain_file` --- cmake/clang-toolchain.cmake | 39 +++++++++++++++++++++++++++++++++++++ cmake/mingw-toolchain.cmake | 11 +++++++++++ 2 files changed, 50 insertions(+) create mode 100644 cmake/clang-toolchain.cmake create mode 100644 cmake/mingw-toolchain.cmake diff --git a/cmake/clang-toolchain.cmake b/cmake/clang-toolchain.cmake new file mode 100644 index 00000000..e70a1375 --- /dev/null +++ b/cmake/clang-toolchain.cmake @@ -0,0 +1,39 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_RC_COMPILER llvm-rc) + +set(triple i386-pc-win32-msvc) +set(CMAKE_C_COMPILER_TARGET ${triple}) +set(CMAKE_CXX_COMPILER_TARGET ${triple}) +set(CMAKE_RC_COMPILER_TARGET ${triple}) + +set(msvc_dir "$ENV{MSVC_DIRECTORY}") +if(msvc_dir STREQUAL "") + message(FATAL_ERROR "Please set a valid MSVC_DIRECTORY environment variable") +endif() + +# Don't remember which version of Visual Studio Build Tools this is. +# When updating this, make sure to pin the version so people can get it. +set(msvc_include + "${msvc_dir}/14.34.31933/include" + "${msvc_dir}/14.34.31933/ATLMFC/include" + "${msvc_dir}/include/10.0.22000.0/ucrt" + "${msvc_dir}/include/10.0.22000.0/um" + "${msvc_dir}/include/10.0.22000.0/shared" + "${msvc_dir}/include/10.0.22000.0/winrt" + "${msvc_dir}/include/10.0.22000.0/cppwinrt" +) +set(msvc_libraries + "${msvc_dir}/14.34.31933/ATLMFC/lib/x86" + "${msvc_dir}/14.34.31933/lib/x86" + "${msvc_dir}/lib/10.0.22000.0/ucrt/x86" + "${msvc_dir}/lib/10.0.22000.0/um/x86" +) + +foreach(LANG C CXX) + set(CMAKE_${LANG}_STANDARD_INCLUDE_DIRECTORIES ${msvc_include}) +endforeach() + +link_directories(${msvc_libraries}) diff --git a/cmake/mingw-toolchain.cmake b/cmake/mingw-toolchain.cmake new file mode 100644 index 00000000..f8742cfb --- /dev/null +++ b/cmake/mingw-toolchain.cmake @@ -0,0 +1,11 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) + +set(triple ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) + +set(CMAKE_C_COMPILER ${triple}-gcc) +set(CMAKE_CXX_COMPILER ${triple}-g++) +set(CMAKE_RC_COMPILER ${triple}-windres) + +set(CMAKE_C_COMPILER_TARGET ${triple}) +set(CMAKE_CXX_COMPILER_TARGET ${triple}) From 86ad40118693ea3651b0039f869f459031086f21 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sat, 14 Dec 2024 19:01:11 -0300 Subject: [PATCH 014/118] add newline at end of file where it's lacking .editorconfig already enforces it but it's getting changed piecemeal in every commit. just get it done with. the script: ``` find . -type f -not -path "./.git/*" -not -path "./.vs/*" | while read -r file; do isFile=$(file -0 "$file" | cut -d $'\0' -f2) case "$isFile" in (*text*) echo "$file is text" if [[ $(tail -c 1 "$file" | wc -l) -ne 1 ]]; then echo "" >> "$file" fi ;; (*) echo "file isn't text" ;; esac done ``` --- Console/ComBSTROut.h | 2 +- Console/ComVariantOut.h | 2 +- Editor/Cursor Modes.h | 2 +- Editor/Editor Modes.h | 2 +- Editor/Editor Taskbar Creation.h | 2 +- Editor/Editor Taskbar Utils.h | 2 +- Editor/Road Smoothing.h | 2 +- Editor/Sector Summary.h | 2 +- Editor/Smoothing Utils.h | 2 +- Ja2/Cheats.h | 2 +- Ja2/Fade Screen.h | 2 +- Ja2/HelpScreen.h | 2 +- Ja2/Intro.h | 2 +- Ja2/JA2 Splash.h | 2 +- Ja2/Language Defines.h | 2 +- Ja2/MPChatScreen.h | 2 +- Ja2/MPConnectScreen.h | 2 +- Ja2/MPHostScreen.h | 2 +- Ja2/MPScoreScreen.h | 2 +- Ja2/MessageBoxScreen.h | 2 +- Ja2/Screens.h | 2 +- Ja2/gamescreen.h | 2 +- Ja2/jascreens.h | 2 +- Ja2/legion cfg.h | 2 +- Ja2/mainmenuscreen.h | 2 +- Ja2/screenids.h | 2 +- Ja2/ub_config.h | 2 +- Laptop/BriefingRoom.h | 2 +- Laptop/BriefingRoomM.h | 2 +- Laptop/BriefingRoom_Data.h | 2 +- Laptop/CampaignHistoryData.h | 2 +- Laptop/CampaignHistory_Summary.h | 2 +- Laptop/CampaignStats.h | 2 +- Laptop/IMP AboutUs.h | 2 +- Laptop/IMP Attribute Entrance.h | 2 +- Laptop/IMP Attribute Finish.h | 2 +- Laptop/IMP Attribute Selection.h | 2 +- Laptop/IMP Begin Screen.h | 2 +- Laptop/IMP Character and Disability Entrance.h | 2 +- Laptop/IMP Compile Character.h | 2 +- Laptop/IMP Finish.h | 2 +- Laptop/IMP HomePage.h | 2 +- Laptop/IMP MainPage.h | 2 +- Laptop/IMP Personality Entrance.h | 2 +- Laptop/IMP Personality Finish.h | 2 +- Laptop/IMP Personality Quiz.h | 2 +- Laptop/IMP Portraits.h | 2 +- Laptop/IMP Text System.h | 2 +- Laptop/IMP Voices.h | 2 +- Laptop/MilitiaWebsite.cpp | 2 +- Laptop/PMC.cpp | 2 +- Laptop/PostalService.h | 2 +- Laptop/Speck Quotes.h | 2 +- Laptop/XML_AIMAvailability.cpp | 2 +- Laptop/XML_ConditionsForMercAvailability.cpp | 2 +- Laptop/XML_DeliveryMethods.cpp | 2 +- Laptop/XML_ShippingDestinations.cpp | 2 +- Laptop/florist Cards.h | 2 +- Laptop/florist Gallery.h | 2 +- Laptop/florist Order Form.h | 2 +- Laptop/insurance Comments.h | 2 +- Laptop/insurance Contract.h | 2 +- Laptop/insurance Info.h | 2 +- Laptop/mercs Account.h | 2 +- Laptop/mercs Files.h | 2 +- Laptop/mercs No Account.h | 2 +- Multiplayer/fresh_header.h | 2 +- Multiplayer/network.h | 2 +- Multiplayer/raknet/AsynchronousFileIO.h | 2 +- Multiplayer/raknet/BitStream_NoTemplate.h | 2 +- Multiplayer/raknet/PacketPool.h | 2 +- Multiplayer/raknet/SimpleTCPServer.h | 2 +- Strategic/Assignments.h | 2 +- Strategic/Auto Resolve.h | 2 +- Strategic/Campaign Init.h | 2 +- Strategic/Campaign Types.h | 2 +- Strategic/Creature Spreading.cpp | 2 +- Strategic/Creature Spreading.h | 2 +- Strategic/Facilities.h | 2 +- Strategic/Game Init.h | 2 +- Strategic/Ja25 Strategic Ai.h | 2 +- Strategic/Luaglobal.cpp | 2 +- Strategic/Map Screen Helicopter.h | 2 +- Strategic/Map Screen Interface Border.h | 2 +- Strategic/Map Screen Interface Bottom.h | 2 +- Strategic/Map Screen Interface TownMine Info.h | 2 +- Strategic/Map Screen Interface.h | 2 +- Strategic/MilitiaIndividual.h | 2 +- Strategic/MilitiaSquads.h | 2 +- Strategic/Player Command.h | 2 +- Strategic/Quest Debug System.h | 2 +- Strategic/Reinforcement.h | 2 +- Strategic/Strategic AI.h | 2 +- Strategic/Strategic Event Handler.h | 2 +- Strategic/Strategic Mines.h | 2 +- Strategic/Strategic Pathing.cpp | 2 +- Strategic/Strategic Status.h | 2 +- Strategic/Strategic Town Loyalty.h | 2 +- Strategic/Strategic Turns.h | 2 +- Strategic/Town Militia.h | 2 +- Strategic/XML_Creatures.cpp | 2 +- Strategic/XML_SquadNames.cpp | 2 +- Strategic/mapscreen.h | 2 +- Strategic/strategic town reputation.h | 2 +- Strategic/strategic.h | 2 +- Tactical/Action Items.h | 2 +- Tactical/Air Raid.h | 2 +- Tactical/Animation Cache.h | 2 +- Tactical/Arms Dealer Init.h | 2 +- Tactical/Auto Bandage.h | 2 +- Tactical/Boxing.h | 2 +- Tactical/Bullets.h | 2 +- Tactical/Civ Quotes.h | 2 +- Tactical/Dialogue Control.h | 2 +- Tactical/End Game.h | 2 +- Tactical/Enemy Soldier Save.h | 2 +- Tactical/EnemyItemDrops.cpp | 2 +- Tactical/EnemyItemDrops.h | 2 +- Tactical/Handle Doors.h | 2 +- Tactical/Handle UI Plan.h | 2 +- Tactical/Handle UI.h | 2 +- Tactical/Interface Control.h | 2 +- Tactical/Interface Cursors.h | 2 +- Tactical/Interface Panels.h | 2 +- Tactical/Interface Utils.h | 2 +- Tactical/Interface.h | 2 +- Tactical/Inventory Choosing.h | 2 +- Tactical/Ja25_Tactical.h | 2 +- Tactical/Keys.h | 2 +- Tactical/LOS.h | 2 +- Tactical/Map Information.h | 2 +- Tactical/Militia Control.h | 2 +- Tactical/MiniGame.h | 2 +- Tactical/Morale.h | 2 +- Tactical/PathAIDebug.h | 2 +- Tactical/Rain.h | 2 +- Tactical/ShopKeeper Quotes.h | 2 +- Tactical/SkillCheck.h | 2 +- Tactical/SkillMenu.h | 2 +- Tactical/Soldier Ani.h | 2 +- Tactical/Soldier Create.h | 2 +- Tactical/Soldier Find.h | 2 +- Tactical/Soldier Functions.h | 2 +- Tactical/Soldier Init List.cpp | 2 +- Tactical/Soldier Init List.h | 2 +- Tactical/Soldier macros.h | 2 +- Tactical/Spread burst.h | 2 +- Tactical/Squads.h | 2 +- Tactical/Strategic Exit GUI.h | 2 +- Tactical/Structure Wrap.h | 2 +- Tactical/Tactical Turns.h | 2 +- Tactical/TeamTurns.h | 2 +- Tactical/UI Cursors.h | 2 +- Tactical/VehicleMenu.cpp | 2 +- Tactical/VehicleMenu.h | 2 +- Tactical/XML_HiddenNames.cpp | 2 +- Tactical/XML_LBEPocketPopup.cpp | 2 +- Tactical/XML_MercStartingGear.cpp | 2 +- Tactical/XML_RPCFacesSmall.cpp | 2 +- Tactical/XML_RandomStats.cpp | 2 +- Tactical/fov.h | 2 +- Tactical/opplist.h | 2 +- Tactical/qarray.h | 2 +- Tactical/rt time defines.h | 2 +- Tactical/soldier tile.h | 2 +- TileEngine/Ambient Control.cpp | 2 +- TileEngine/Ambient Control.h | 2 +- TileEngine/Buildings.h | 2 +- TileEngine/Fog Of War.h | 2 +- TileEngine/Interactive Tiles.h | 2 +- TileEngine/LightEffects.h | 2 +- TileEngine/Radar Screen.h | 2 +- TileEngine/Render Fun.h | 2 +- TileEngine/Shade Table Util.h | 2 +- TileEngine/Simple Render Utils.h | 2 +- TileEngine/SmokeEffects.h | 2 +- TileEngine/Structure Internals.h | 2 +- TileEngine/Tactical Placement GUI.h | 2 +- TileEngine/Tile Cache.h | 2 +- TileEngine/Tile Surface.h | 2 +- TileEngine/World Tileset Enums.h | 2 +- TileEngine/WorldDat.h | 2 +- TileEngine/physics.h | 2 +- TileEngine/pits.h | 2 +- TileEngine/renderworld.h | 2 +- TileEngine/structure.h | 2 +- TileEngine/sysutil.h | 2 +- TileEngine/worldman.h | 2 +- Utils/Animated ProgressBar.h | 2 +- Utils/Cinematics Bink.h | 2 +- Utils/Cursors.h | 2 +- Utils/Debug Control.h | 2 +- Utils/Encrypted File.cpp | 2 +- Utils/Encrypted File.h | 2 +- Utils/ExportStrings.h | 2 +- Utils/Multi Language Graphic Utils.h | 2 +- Utils/Multilingual Text Code Generator.h | 2 +- Utils/PopUpBox.h | 2 +- Utils/Quantize Wrap.h | 2 +- Utils/Quantize.h | 2 +- Utils/STIConvert.h | 2 +- Utils/Sound Control.h | 2 +- Utils/Text Input.h | 2 +- Utils/Timer Control.h | 2 +- Utils/XML_Language.h | 2 +- Utils/XML_SenderNameList.cpp | 2 +- Utils/maputility.h | 2 +- Utils/message.h | 2 +- Utils/popup_callback.h | 2 +- Utils/popup_class.cpp | 2 +- Utils/popup_definition.cpp | 2 +- Utils/popup_definition.h | 2 +- ext/VFS/src/Core/files.cmake | 2 +- ext/export/src/ja2/Structure Internals.h | 2 +- ext/export/src/ja2/Types.h | 2 +- sgp/Button Sound Control.cpp | 2 +- sgp/Compression.h | 2 +- sgp/DirectDraw Calls.h | 2 +- sgp/DirectX Common.h | 2 +- sgp/Ja2 Libs.h | 2 +- sgp/english.h | 2 +- sgp/imgfmt.h | 2 +- sgp/input.h | 2 +- sgp/mousesystem_macros.h | 2 +- sgp/pcx.h | 2 +- sgp/soundman.h | 2 +- sgp/timer.h | 2 +- sgp/vsurface_private.h | 2 +- 228 files changed, 228 insertions(+), 228 deletions(-) diff --git a/Console/ComBSTROut.h b/Console/ComBSTROut.h index 62bac6b8..598e5204 100644 --- a/Console/ComBSTROut.h +++ b/Console/ComBSTROut.h @@ -78,4 +78,4 @@ public: ///////////////////////////////////////////////////////////////////////////// -#endif // _COMBSTROUT_H_ \ No newline at end of file +#endif // _COMBSTROUT_H_ diff --git a/Console/ComVariantOut.h b/Console/ComVariantOut.h index 0efb673f..1e52a866 100644 --- a/Console/ComVariantOut.h +++ b/Console/ComVariantOut.h @@ -106,4 +106,4 @@ public: ///////////////////////////////////////////////////////////////////////////// -#endif // _COMVARIANTOUT_H_ \ No newline at end of file +#endif // _COMVARIANTOUT_H_ diff --git a/Editor/Cursor Modes.h b/Editor/Cursor Modes.h index a81b2be8..c4994185 100644 --- a/Editor/Cursor Modes.h +++ b/Editor/Cursor Modes.h @@ -40,4 +40,4 @@ extern BOOLEAN gfCurrentSelectionWithRightButton; #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Modes.h b/Editor/Editor Modes.h index 5b6eb61e..3eae7696 100644 --- a/Editor/Editor Modes.h +++ b/Editor/Editor Modes.h @@ -14,4 +14,4 @@ void ShowExitGrids(); void HideExitGrids(); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Creation.h b/Editor/Editor Taskbar Creation.h index 7ed74205..ca645a7e 100644 --- a/Editor/Editor Taskbar Creation.h +++ b/Editor/Editor Taskbar Creation.h @@ -7,4 +7,4 @@ void CreateEditorTaskbarInternal(); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Utils.h b/Editor/Editor Taskbar Utils.h index 9750ed03..563452e6 100644 --- a/Editor/Editor Taskbar Utils.h +++ b/Editor/Editor Taskbar Utils.h @@ -67,4 +67,4 @@ extern UINT32 guiMercTempBuffer; extern INT32 giEditMercImage[2]; #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Road Smoothing.h b/Editor/Road Smoothing.h index 872c2d6b..f1b899d9 100644 --- a/Editor/Road Smoothing.h +++ b/Editor/Road Smoothing.h @@ -61,4 +61,4 @@ void InitializeRoadMacros(); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Sector Summary.h b/Editor/Sector Summary.h index 47da8302..c1c97758 100644 --- a/Editor/Sector Summary.h +++ b/Editor/Sector Summary.h @@ -35,4 +35,4 @@ void GetSectorFromFileName(STR16 szFileName, INT16& sSectorX, INT16& sSectorY, I void ResetCustomFileSectorSummary(void);//dnl ch30 150909 #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Smoothing Utils.h b/Editor/Smoothing Utils.h index f1eeb0fd..7da29628 100644 --- a/Editor/Smoothing Utils.h +++ b/Editor/Smoothing Utils.h @@ -62,4 +62,4 @@ UINT16 GetHorizontalWallClass( INT32 iMapIndex ); BOOLEAN ValidDecalPlacement( INT32 iMapIndex ); #endif -#endif \ No newline at end of file +#endif diff --git a/Ja2/Cheats.h b/Ja2/Cheats.h index 8e683a7e..74760ab6 100644 --- a/Ja2/Cheats.h +++ b/Ja2/Cheats.h @@ -22,4 +22,4 @@ extern UINT8 gubCheatLevel; #define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 ) #define ACTIVATE_CHEAT_LEVEL() ( gubCheatLevel = 6 ) -#endif \ No newline at end of file +#endif diff --git a/Ja2/Fade Screen.h b/Ja2/Fade Screen.h index 5f764b7e..4daab22d 100644 --- a/Ja2/Fade Screen.h +++ b/Ja2/Fade Screen.h @@ -37,4 +37,4 @@ BOOLEAN HandleFadeInCallback( ); void FadeInNextFrame( ); void FadeOutNextFrame( ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/HelpScreen.h b/Ja2/HelpScreen.h index 3d22c3e9..fdee7428 100644 --- a/Ja2/HelpScreen.h +++ b/Ja2/HelpScreen.h @@ -72,4 +72,4 @@ void NewScreenSoResetHelpScreen( ); INT8 HelpScreenDetermineWhichMapScreenHelpToShow(); -#endif \ No newline at end of file +#endif diff --git a/Ja2/Intro.h b/Ja2/Intro.h index 27c51ca7..77048105 100644 --- a/Ja2/Intro.h +++ b/Ja2/Intro.h @@ -42,4 +42,4 @@ typedef struct extern INTRO_NAMES_VALUES zVideoFile[255]; -#endif \ No newline at end of file +#endif diff --git a/Ja2/JA2 Splash.h b/Ja2/JA2 Splash.h index 5c809e68..40e18fed 100644 --- a/Ja2/JA2 Splash.h +++ b/Ja2/JA2 Splash.h @@ -6,4 +6,4 @@ void InitJA2SplashScreen(); extern UINT32 guiSplashFrameFade; extern UINT32 guiSplashStartTime; -#endif \ No newline at end of file +#endif diff --git a/Ja2/Language Defines.h b/Ja2/Language Defines.h index ec64ffb4..8032d699 100644 --- a/Ja2/Language Defines.h +++ b/Ja2/Language Defines.h @@ -116,4 +116,4 @@ #define SINGLE_CHAR_WORDS #endif*/ -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPChatScreen.h b/Ja2/MPChatScreen.h index 8921fa99..af8957b9 100644 --- a/Ja2/MPChatScreen.h +++ b/Ja2/MPChatScreen.h @@ -26,4 +26,4 @@ extern BOOLEAN gfInChatBox; INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); void ChatLogMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPConnectScreen.h b/Ja2/MPConnectScreen.h index e0412279..4e091dbb 100644 --- a/Ja2/MPConnectScreen.h +++ b/Ja2/MPConnectScreen.h @@ -11,4 +11,4 @@ void SetConnectScreenHeadingA( const char* cmsg ); void SetConnectScreenSubMessageW( STR16 cmsg ); void SetConnectScreenSubMessageA( const char* cmsg ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPHostScreen.h b/Ja2/MPHostScreen.h index 051947ff..b1b44b38 100644 --- a/Ja2/MPHostScreen.h +++ b/Ja2/MPHostScreen.h @@ -9,4 +9,4 @@ UINT32 MPHostScreenShutdown( void ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPScoreScreen.h b/Ja2/MPScoreScreen.h index 70043248..d70faed9 100644 --- a/Ja2/MPScoreScreen.h +++ b/Ja2/MPScoreScreen.h @@ -9,4 +9,4 @@ UINT32 MPScoreScreenShutdown( void ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MessageBoxScreen.h b/Ja2/MessageBoxScreen.h index 79827396..737cf588 100644 --- a/Ja2/MessageBoxScreen.h +++ b/Ja2/MessageBoxScreen.h @@ -152,4 +152,4 @@ BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/Screens.h b/Ja2/Screens.h index e01af6b3..f94c05c8 100644 --- a/Ja2/Screens.h +++ b/Ja2/Screens.h @@ -34,4 +34,4 @@ extern Screens GameScreens[MAX_SCREENS]; #include "jascreens.h" -#endif \ No newline at end of file +#endif diff --git a/Ja2/gamescreen.h b/Ja2/gamescreen.h index 38403749..de0696a4 100644 --- a/Ja2/gamescreen.h +++ b/Ja2/gamescreen.h @@ -41,4 +41,4 @@ void InitHelicopterEntranceByMercs( void ); void InternalLeaveTacticalScreen( UINT32 uiNewScreen ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/jascreens.h b/Ja2/jascreens.h index 89b1a223..1822b377 100644 --- a/Ja2/jascreens.h +++ b/Ja2/jascreens.h @@ -184,4 +184,4 @@ extern std::list g_ExceptionList; void PrintExceptionList(); -#endif \ No newline at end of file +#endif diff --git a/Ja2/legion cfg.h b/Ja2/legion cfg.h index c8317c2b..cff53c95 100644 --- a/Ja2/legion cfg.h +++ b/Ja2/legion cfg.h @@ -102,4 +102,4 @@ extern void RandomStats (); #endif extern void RandomStats (); -#endif \ No newline at end of file +#endif diff --git a/Ja2/mainmenuscreen.h b/Ja2/mainmenuscreen.h index c943fa7f..616eb460 100644 --- a/Ja2/mainmenuscreen.h +++ b/Ja2/mainmenuscreen.h @@ -37,4 +37,4 @@ void ClearMainMenu( ); void InitDependingGameStyleOptions(); -#endif \ No newline at end of file +#endif diff --git a/Ja2/screenids.h b/Ja2/screenids.h index 047ad188..18457c24 100644 --- a/Ja2/screenids.h +++ b/Ja2/screenids.h @@ -47,4 +47,4 @@ enum ScreenTypes MAX_SCREENS }; -#endif \ No newline at end of file +#endif diff --git a/Ja2/ub_config.h b/Ja2/ub_config.h index 4b2c64b0..dc43d6e7 100644 --- a/Ja2/ub_config.h +++ b/Ja2/ub_config.h @@ -230,4 +230,4 @@ extern void RandomStats (); #endif extern void RandomStats (); -#endif \ No newline at end of file +#endif diff --git a/Laptop/BriefingRoom.h b/Laptop/BriefingRoom.h index b64ea822..989937dd 100644 --- a/Laptop/BriefingRoom.h +++ b/Laptop/BriefingRoom.h @@ -17,4 +17,4 @@ BOOLEAN DrawBriefingRoomDefaults(); BOOLEAN DisplayBriefingRoomSlogan(); BOOLEAN DisplayBriefingRoomCopyright(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/BriefingRoomM.h b/Laptop/BriefingRoomM.h index d223a89a..9470a9e4 100644 --- a/Laptop/BriefingRoomM.h +++ b/Laptop/BriefingRoomM.h @@ -17,4 +17,4 @@ BOOLEAN DrawBriefingRoomEnterDefaults(); BOOLEAN DisplayBriefingRoomEnterSlogan(); BOOLEAN DisplayBriefingRoomEnterCopyright(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/BriefingRoom_Data.h b/Laptop/BriefingRoom_Data.h index e9da8074..0e41225a 100644 --- a/Laptop/BriefingRoom_Data.h +++ b/Laptop/BriefingRoom_Data.h @@ -133,4 +133,4 @@ extern BOOLEAN SaveBriefingRoomToSaveGameFile( HWFILE hFile ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/CampaignHistoryData.h b/Laptop/CampaignHistoryData.h index 278dac6f..31acffeb 100644 --- a/Laptop/CampaignHistoryData.h +++ b/Laptop/CampaignHistoryData.h @@ -3,4 +3,4 @@ -#endif // __CAMPAIGNHISTORY_DATA_H \ No newline at end of file +#endif // __CAMPAIGNHISTORY_DATA_H diff --git a/Laptop/CampaignHistory_Summary.h b/Laptop/CampaignHistory_Summary.h index 75f80692..3a67e92c 100644 --- a/Laptop/CampaignHistory_Summary.h +++ b/Laptop/CampaignHistory_Summary.h @@ -27,4 +27,4 @@ void ExitCampaignHistory_News(); void HandleCampaignHistory_News(); void RenderCampaignHistory_News(); -#endif // __CAMPAIGNHISTORY_SUMMARY_H \ No newline at end of file +#endif // __CAMPAIGNHISTORY_SUMMARY_H diff --git a/Laptop/CampaignStats.h b/Laptop/CampaignStats.h index 2721ee3d..198de5a5 100644 --- a/Laptop/CampaignStats.h +++ b/Laptop/CampaignStats.h @@ -332,4 +332,4 @@ STR16 GetIncidentName( UINT32 aIncidentId ); UINT32 GetIdOfCurrentlyOngoingIncident(); -#endif // __CAMPAIGNSTATS_H \ No newline at end of file +#endif // __CAMPAIGNSTATS_H diff --git a/Laptop/IMP AboutUs.h b/Laptop/IMP AboutUs.h index 7aff8212..e2e7eb22 100644 --- a/Laptop/IMP AboutUs.h +++ b/Laptop/IMP AboutUs.h @@ -7,4 +7,4 @@ void ExitIMPAboutUs( void ); void EnterIMPAboutUs( void ); void HandleIMPAboutUs( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Attribute Entrance.h b/Laptop/IMP Attribute Entrance.h index 843340a8..b31e0026 100644 --- a/Laptop/IMP Attribute Entrance.h +++ b/Laptop/IMP Attribute Entrance.h @@ -8,4 +8,4 @@ void HandleIMPAttributeEntrance( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Attribute Finish.h b/Laptop/IMP Attribute Finish.h index 3b6af623..bea71834 100644 --- a/Laptop/IMP Attribute Finish.h +++ b/Laptop/IMP Attribute Finish.h @@ -7,4 +7,4 @@ void RenderIMPAttributeFinish( void ); void ExitIMPAttributeFinish( void ); void HandleIMPAttributeFinish( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Attribute Selection.h b/Laptop/IMP Attribute Selection.h index 12965c03..2518f5aa 100644 --- a/Laptop/IMP Attribute Selection.h +++ b/Laptop/IMP Attribute Selection.h @@ -22,4 +22,4 @@ extern BOOLEAN fReturnStatus; INT8 StartingLevelChosen(); // added - SANDRO -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Begin Screen.h b/Laptop/IMP Begin Screen.h index cbaa7594..9ec36bc6 100644 --- a/Laptop/IMP Begin Screen.h +++ b/Laptop/IMP Begin Screen.h @@ -9,4 +9,4 @@ void HandleIMPBeginScreen( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Character and Disability Entrance.h b/Laptop/IMP Character and Disability Entrance.h index 35a64a5a..72d64ba6 100644 --- a/Laptop/IMP Character and Disability Entrance.h +++ b/Laptop/IMP Character and Disability Entrance.h @@ -7,4 +7,4 @@ void RenderIMPCharacterAndDisabilityEntrance( void ); void ExitIMPCharacterAndDisabilityEntrance( void ); void HandleIMPCharacterAndDisabilityEntrance( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Compile Character.h b/Laptop/IMP Compile Character.h index 6a1d81a7..f854bd21 100644 --- a/Laptop/IMP Compile Character.h +++ b/Laptop/IMP Compile Character.h @@ -20,4 +20,4 @@ void ClearAllSkillsList( void ); extern STR8 pPlayerSelectedFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]; extern STR8 pPlayerSelectedBigFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Finish.h b/Laptop/IMP Finish.h index 789bef6d..51d9c12c 100644 --- a/Laptop/IMP Finish.h +++ b/Laptop/IMP Finish.h @@ -10,4 +10,4 @@ void HandleIMPFinish( void ); extern BOOLEAN fFinishedCharGeneration; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP HomePage.h b/Laptop/IMP HomePage.h index c6d657b8..b60a73e5 100644 --- a/Laptop/IMP HomePage.h +++ b/Laptop/IMP HomePage.h @@ -15,4 +15,4 @@ void HandleImpHomePage( void ); #define IMP_MERC_FILENAME "IMP" extern INT32 GlowColorsList[][3]; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP MainPage.h b/Laptop/IMP MainPage.h index c783e801..e75f662a 100644 --- a/Laptop/IMP MainPage.h +++ b/Laptop/IMP MainPage.h @@ -29,4 +29,4 @@ enum IMP__FINISH, }; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Personality Entrance.h b/Laptop/IMP Personality Entrance.h index 6e0a9d83..3cb27fef 100644 --- a/Laptop/IMP Personality Entrance.h +++ b/Laptop/IMP Personality Entrance.h @@ -9,4 +9,4 @@ void HandleIMPPersonalityEntrance( void ); STR16 pSkillTraitBeginIMPStrings[]; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Personality Finish.h b/Laptop/IMP Personality Finish.h index 2d1400cd..8a147e1f 100644 --- a/Laptop/IMP Personality Finish.h +++ b/Laptop/IMP Personality Finish.h @@ -9,4 +9,4 @@ void HandleIMPPersonalityFinish( void ); extern UINT8 bPersonalityEndState; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Personality Quiz.h b/Laptop/IMP Personality Quiz.h index c6c27bd9..95b8b48d 100644 --- a/Laptop/IMP Personality Quiz.h +++ b/Laptop/IMP Personality Quiz.h @@ -12,4 +12,4 @@ void BltAnswerIndents( INT32 iNumberOfIndents ); extern INT32 giCurrentPersonalityQuizQuestion; extern INT32 iCurrentAnswer; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Portraits.h b/Laptop/IMP Portraits.h index e51cda26..b91b2659 100644 --- a/Laptop/IMP Portraits.h +++ b/Laptop/IMP Portraits.h @@ -10,4 +10,4 @@ BOOLEAN RenderPortrait( INT16 sX, INT16 sY ); extern INT32 iPortraitNumber; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Text System.h b/Laptop/IMP Text System.h index 09eebada..d0d0906a 100644 --- a/Laptop/IMP Text System.h +++ b/Laptop/IMP Text System.h @@ -145,4 +145,4 @@ enum{ }; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Voices.h b/Laptop/IMP Voices.h index e65f264b..99227b53 100644 --- a/Laptop/IMP Voices.h +++ b/Laptop/IMP Voices.h @@ -9,4 +9,4 @@ UINT32 PlayVoice( void ); extern UINT32 iSelectedIMPVoiceSet; -#endif \ No newline at end of file +#endif diff --git a/Laptop/MilitiaWebsite.cpp b/Laptop/MilitiaWebsite.cpp index 67e22893..16104a7e 100644 --- a/Laptop/MilitiaWebsite.cpp +++ b/Laptop/MilitiaWebsite.cpp @@ -835,4 +835,4 @@ template<> void TestTableTemplate<3>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End AddColumnDataProvider( itemnamecol );*/ TestTable::Init( sX, sY, sX_End, sY_End ); -} \ No newline at end of file +} diff --git a/Laptop/PMC.cpp b/Laptop/PMC.cpp index 652e15c5..aac3c86f 100644 --- a/Laptop/PMC.cpp +++ b/Laptop/PMC.cpp @@ -851,4 +851,4 @@ BOOLEAN LoadPMC( HWFILE hwFile ) } return TRUE; -} \ No newline at end of file +} diff --git a/Laptop/PostalService.h b/Laptop/PostalService.h index c3a0aaf1..dfd4df5c 100644 --- a/Laptop/PostalService.h +++ b/Laptop/PostalService.h @@ -254,4 +254,4 @@ private: protected: }; -#endif \ No newline at end of file +#endif diff --git a/Laptop/Speck Quotes.h b/Laptop/Speck Quotes.h index a1db2643..eadeda0b 100644 --- a/Laptop/Speck Quotes.h +++ b/Laptop/Speck Quotes.h @@ -305,4 +305,4 @@ enum{ }; #endif -#endif \ No newline at end of file +#endif diff --git a/Laptop/XML_AIMAvailability.cpp b/Laptop/XML_AIMAvailability.cpp index 76f7b2c0..981c9129 100644 --- a/Laptop/XML_AIMAvailability.cpp +++ b/Laptop/XML_AIMAvailability.cpp @@ -227,4 +227,4 @@ BOOLEAN WriteAimAvailability(STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/XML_ConditionsForMercAvailability.cpp b/Laptop/XML_ConditionsForMercAvailability.cpp index cd50b18c..0ef09034 100644 --- a/Laptop/XML_ConditionsForMercAvailability.cpp +++ b/Laptop/XML_ConditionsForMercAvailability.cpp @@ -287,4 +287,4 @@ BOOLEAN WriteMercAvailability(STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/XML_DeliveryMethods.cpp b/Laptop/XML_DeliveryMethods.cpp index 375ce4c4..07751b22 100644 --- a/Laptop/XML_DeliveryMethods.cpp +++ b/Laptop/XML_DeliveryMethods.cpp @@ -268,4 +268,4 @@ BOOLEAN ReadInDeliveryMethods(STR fileName) return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/XML_ShippingDestinations.cpp b/Laptop/XML_ShippingDestinations.cpp index 925465bf..e17b76ea 100644 --- a/Laptop/XML_ShippingDestinations.cpp +++ b/Laptop/XML_ShippingDestinations.cpp @@ -236,4 +236,4 @@ BOOLEAN ReadInShippingDestinations(STR fileName, BOOLEAN localizedVersion) XML_ParserFree(parser); return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/florist Cards.h b/Laptop/florist Cards.h index 4a51c2dc..fb28fde6 100644 --- a/Laptop/florist Cards.h +++ b/Laptop/florist Cards.h @@ -16,4 +16,4 @@ void RenderFloristCards(); extern INT8 gbCurrentlySelectedCard; -#endif \ No newline at end of file +#endif diff --git a/Laptop/florist Gallery.h b/Laptop/florist Gallery.h index 4f9517ab..85939211 100644 --- a/Laptop/florist Gallery.h +++ b/Laptop/florist Gallery.h @@ -21,4 +21,4 @@ extern UINT32 guiCurrentlySelectedFlower; extern UINT8 gubCurFlowerIndex; -#endif \ No newline at end of file +#endif diff --git a/Laptop/florist Order Form.h b/Laptop/florist Order Form.h index 92823531..701eb35e 100644 --- a/Laptop/florist Order Form.h +++ b/Laptop/florist Order Form.h @@ -12,4 +12,4 @@ void InitFloristOrderForm(); void InitFloristOrderFormVariables(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/insurance Comments.h b/Laptop/insurance Comments.h index b2b32ac7..71b9c2e2 100644 --- a/Laptop/insurance Comments.h +++ b/Laptop/insurance Comments.h @@ -7,4 +7,4 @@ void ExitInsuranceComments(); void HandleInsuranceComments(); void RenderInsuranceComments(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/insurance Contract.h b/Laptop/insurance Contract.h index c7dcf460..8aa3d231 100644 --- a/Laptop/insurance Contract.h +++ b/Laptop/insurance Contract.h @@ -28,4 +28,4 @@ void InsuranceContractEndGameShutDown(); void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsuranceLength ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/insurance Info.h b/Laptop/insurance Info.h index 98c727b5..3a143936 100644 --- a/Laptop/insurance Info.h +++ b/Laptop/insurance Info.h @@ -9,4 +9,4 @@ void RenderInsuranceInfo(); void EnterInitInsuranceInfo(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/mercs Account.h b/Laptop/mercs Account.h index 33af5c78..c71a499c 100644 --- a/Laptop/mercs Account.h +++ b/Laptop/mercs Account.h @@ -9,4 +9,4 @@ void RenderMercsAccount(); UINT32 CalculateHowMuchPlayerOwesSpeck(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/mercs Files.h b/Laptop/mercs Files.h index 02142305..3491eeac 100644 --- a/Laptop/mercs Files.h +++ b/Laptop/mercs Files.h @@ -7,4 +7,4 @@ void ExitMercsFiles(); void HandleMercsFiles(); void RenderMercsFiles(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/mercs No Account.h b/Laptop/mercs No Account.h index 5872d69c..46def55f 100644 --- a/Laptop/mercs No Account.h +++ b/Laptop/mercs No Account.h @@ -7,4 +7,4 @@ void ExitMercsNoAccount(); void HandleMercsNoAccount(); void RenderMercsNoAccount(); -#endif \ No newline at end of file +#endif diff --git a/Multiplayer/fresh_header.h b/Multiplayer/fresh_header.h index 58afdf26..403793df 100644 --- a/Multiplayer/fresh_header.h +++ b/Multiplayer/fresh_header.h @@ -65,4 +65,4 @@ BOOLEAN check_status (void); extern UINT8 NumEnemyInSector( ); extern INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); void send_heal (SOLDIERTYPE *pSoldier ); -void requestAIint(SOLDIERTYPE *pSoldier ); \ No newline at end of file +void requestAIint(SOLDIERTYPE *pSoldier ); diff --git a/Multiplayer/network.h b/Multiplayer/network.h index b2571b4f..e90064f6 100644 --- a/Multiplayer/network.h +++ b/Multiplayer/network.h @@ -159,4 +159,4 @@ namespace ja2 { void InitializeMultiplayerProfile(vfs::Path const& profileRoot); } -} \ No newline at end of file +} diff --git a/Multiplayer/raknet/AsynchronousFileIO.h b/Multiplayer/raknet/AsynchronousFileIO.h index e2de9189..e1dc25c5 100644 --- a/Multiplayer/raknet/AsynchronousFileIO.h +++ b/Multiplayer/raknet/AsynchronousFileIO.h @@ -88,4 +88,4 @@ void WriteAsynch( HANDLE handle, ExtendedOverlappedStruct *extended ); BOOL ReadAsynch( HANDLE handle, ExtendedOverlappedStruct *extended ); #endif -*/ \ No newline at end of file +*/ diff --git a/Multiplayer/raknet/BitStream_NoTemplate.h b/Multiplayer/raknet/BitStream_NoTemplate.h index 79aca6c4..afbc313c 100644 --- a/Multiplayer/raknet/BitStream_NoTemplate.h +++ b/Multiplayer/raknet/BitStream_NoTemplate.h @@ -781,4 +781,4 @@ namespace RakNet #endif // VC6 -#endif \ No newline at end of file +#endif diff --git a/Multiplayer/raknet/PacketPool.h b/Multiplayer/raknet/PacketPool.h index b534cac4..76ba0fc6 100644 --- a/Multiplayer/raknet/PacketPool.h +++ b/Multiplayer/raknet/PacketPool.h @@ -1 +1 @@ -// REMOVEME \ No newline at end of file +// REMOVEME diff --git a/Multiplayer/raknet/SimpleTCPServer.h b/Multiplayer/raknet/SimpleTCPServer.h index 1181cd0d..fc79bf1a 100644 --- a/Multiplayer/raknet/SimpleTCPServer.h +++ b/Multiplayer/raknet/SimpleTCPServer.h @@ -1 +1 @@ -// Eraseme \ No newline at end of file +// Eraseme diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 03672ed7..61d59e05 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -592,4 +592,4 @@ UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier ); // Flugente: administration assignment FLOAT GetAdministrationPercentage( INT16 sX, INT16 sY ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Auto Resolve.h b/Strategic/Auto Resolve.h index a1d0acb5..d848c976 100644 --- a/Strategic/Auto Resolve.h +++ b/Strategic/Auto Resolve.h @@ -60,4 +60,4 @@ void AutoResolveMilitiaDropAndPromote(); BOOLEAN IndividualMilitiaInUse_AutoResolve( UINT32 aMilitiaId ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Campaign Init.h b/Strategic/Campaign Init.h index c0765bd2..e730c689 100644 --- a/Strategic/Campaign Init.h +++ b/Strategic/Campaign Init.h @@ -6,4 +6,4 @@ extern void InitNewCampaign(); extern void BuildUndergroundSectorInfoList(); extern void TrashUndergroundSectorInfo(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 37be5a19..2c17739b 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -656,4 +656,4 @@ enum CreateMusic CM_ALWAYS, }; -#endif \ No newline at end of file +#endif diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 13581a26..fac95c5a 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -2422,4 +2422,4 @@ void ResetCreatureAttackVariables() gubAdultFemalesAttackingTown = 0; gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; gubSectorIDOfCreatureAttack = 0; -} \ No newline at end of file +} diff --git a/Strategic/Creature Spreading.h b/Strategic/Creature Spreading.h index e7e812c6..acc408e1 100644 --- a/Strategic/Creature Spreading.h +++ b/Strategic/Creature Spreading.h @@ -114,4 +114,4 @@ extern CREATURECOMPOSITION gCreatureComposition[ MAX_NUMBER_OF_CREATURE_COMPOSIT // Flugente: reset code for creature attacks void ResetCreatureAttackVariables(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Facilities.h b/Strategic/Facilities.h index 6c0d5526..887e4344 100644 --- a/Strategic/Facilities.h +++ b/Strategic/Facilities.h @@ -80,4 +80,4 @@ INT32 GetTotalFacilityHourlyCosts( BOOLEAN fPositive ); void InitFacilities(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Game Init.h b/Strategic/Game Init.h index 77532945..fa07026f 100644 --- a/Strategic/Game Init.h +++ b/Strategic/Game Init.h @@ -18,4 +18,4 @@ void InitBloodCatSectors(); void InitVIPSectors(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Ja25 Strategic Ai.h b/Strategic/Ja25 Strategic Ai.h index 4de27d9a..2404b35a 100644 --- a/Strategic/Ja25 Strategic Ai.h +++ b/Strategic/Ja25 Strategic Ai.h @@ -333,4 +333,4 @@ extern void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCat #endif -#endif \ No newline at end of file +#endif diff --git a/Strategic/Luaglobal.cpp b/Strategic/Luaglobal.cpp index 3abb4a73..3c13deea 100644 --- a/Strategic/Luaglobal.cpp +++ b/Strategic/Luaglobal.cpp @@ -742,4 +742,4 @@ void IniGlobalGameSetting(lua_State *L) lua_pushinteger(L, MORRIS_INSTRUCTION_NOTE); lua_setglobal(L, "UB_itemMORRIS_INSTRUCTION_NOTE"); #endif -} \ No newline at end of file +} diff --git a/Strategic/Map Screen Helicopter.h b/Strategic/Map Screen Helicopter.h index e8256701..05c8e7bf 100644 --- a/Strategic/Map Screen Helicopter.h +++ b/Strategic/Map Screen Helicopter.h @@ -310,4 +310,4 @@ BOOLEAN SoldierAboardAirborneHeli( SOLDIERTYPE *pSoldier ); UINT8 MoveAllInHelicopterToFootMovementGroup( INT8 bNewSquad = 0 ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface Border.h b/Strategic/Map Screen Interface Border.h index c17ef7b1..1447b461 100644 --- a/Strategic/Map Screen Interface Border.h +++ b/Strategic/Map Screen Interface Border.h @@ -107,4 +107,4 @@ void InitMapBorderButtonCoordinates(); void DisableMapBorderButtons(void); void EnableMapBorderButtons(void); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index c43ebe14..0c7dd8c6 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -76,4 +76,4 @@ void MoveToEndOfMapScreenMessageList( void ); // HEADROCK HAM 3.6: Reset coordinates for slider bar and message window void InitMapScreenInterfaceBottomCoords( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface TownMine Info.h b/Strategic/Map Screen Interface TownMine Info.h index 2c092f6b..73d210f6 100644 --- a/Strategic/Map Screen Interface TownMine Info.h +++ b/Strategic/Map Screen Interface TownMine Info.h @@ -12,4 +12,4 @@ void DisplayTownInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); void CreateDestroyTownInfoBox( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 4e0ad4ed..5e7aafaf 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -745,4 +745,4 @@ extern BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbError extern BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/MilitiaIndividual.h b/Strategic/MilitiaIndividual.h index e03e7a95..cf3b24e1 100644 --- a/Strategic/MilitiaIndividual.h +++ b/Strategic/MilitiaIndividual.h @@ -195,4 +195,4 @@ UINT32 GetDailyUpkeep_IndividualMilitia( UINT32& arNumGreen, UINT32& arNumRegula void PickIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); void DropIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index f86a8a62..499bd38c 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -50,4 +50,4 @@ void DissolveAllMilitiaGroupsInSector( INT16 sMapX, INT16 sMapY ); BOOLEAN MilitiaGroupEntersCurrentSector( UINT8 usGroupId, INT16 sMapX, INT16 sMapY ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Player Command.h b/Strategic/Player Command.h index c4bcee2f..8b56835d 100644 --- a/Strategic/Player Command.h +++ b/Strategic/Player Command.h @@ -30,4 +30,4 @@ void MakePlayerPerceptionOfSectorControlCorrect( INT16 sMapX, INT16 sMapY, INT8 void ReplaceSoldierProfileInPlayerGroup( UINT8 ubGroupID, UINT8 ubOldProfile, UINT8 ubNewProfile ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Quest Debug System.h b/Strategic/Quest Debug System.h index 46cf6a5c..2de86c5d 100644 --- a/Strategic/Quest Debug System.h +++ b/Strategic/Quest Debug System.h @@ -13,4 +13,4 @@ void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT void NpcRecordLogging( UINT8 ubApproach, STR pStringA, ...); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Reinforcement.h b/Strategic/Reinforcement.h index e6017b51..caf7008f 100644 --- a/Strategic/Reinforcement.h +++ b/Strategic/Reinforcement.h @@ -14,4 +14,4 @@ UINT8 DoReinforcementAsPendingNonPlayer( INT16 sMapX, INT16 sMapY, UINT8 usTeam void AddPossiblePendingMilitiaToBattle(); GROUP* GetNonPlayerGroupInSectorForReinforcement( INT16 sMapX, INT16 sMapY, UINT8 usTeam ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic AI.h b/Strategic/Strategic AI.h index 5c7986af..9f494f72 100644 --- a/Strategic/Strategic AI.h +++ b/Strategic/Strategic AI.h @@ -181,4 +181,4 @@ typedef struct GARRISON_GROUP #define REGULAR_MILITIA_POINTS_MODIFIER 2 #define ELITE_MILITIA_POINTS_MODIFIER 3 -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Event Handler.h b/Strategic/Strategic Event Handler.h index 1f30da0f..65e78aaa 100644 --- a/Strategic/Strategic Event Handler.h +++ b/Strategic/Strategic Event Handler.h @@ -27,4 +27,4 @@ void MakeCivGroupHostileOnNextSectorEntrance( UINT8 ubCivGroup ); void RemoveAssassin( UINT8 ubProfile ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Mines.h b/Strategic/Strategic Mines.h index b7ad4048..63351652 100644 --- a/Strategic/Strategic Mines.h +++ b/Strategic/Strategic Mines.h @@ -218,4 +218,4 @@ BOOLEAN AreThereMinersInsideThisMine( UINT8 ubMineIndex ); // use this to determine whether or not the player has spoken to a head miner BOOLEAN SpokenToHeadMiner( UINT8 ubMineIndex ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Pathing.cpp b/Strategic/Strategic Pathing.cpp index f39d47b5..37c260bf 100644 --- a/Strategic/Strategic Pathing.cpp +++ b/Strategic/Strategic Pathing.cpp @@ -2221,4 +2221,4 @@ PathStPtr GetLastNodeOfPath(PathStPtr pNode) } return pNode; -} \ No newline at end of file +} diff --git a/Strategic/Strategic Status.h b/Strategic/Strategic Status.h index e3ad182f..a7bb86a3 100644 --- a/Strategic/Strategic Status.h +++ b/Strategic/Strategic Status.h @@ -167,4 +167,4 @@ UINT8 RankIndexToSoldierClass( UINT8 ubRankIndex ); void UpdateLastDayOfPlayerActivity( UINT16 usDay ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Town Loyalty.h b/Strategic/Strategic Town Loyalty.h index 2cde0c52..2d420c2f 100644 --- a/Strategic/Strategic Town Loyalty.h +++ b/Strategic/Strategic Town Loyalty.h @@ -224,4 +224,4 @@ void MaximizeLoyaltyForDeidrannaKilled( void ); // HEADROCK HAM 3.6: Loyalty hit for owing too much money on facility work void HandleFacilityDebtLoyaltyHit( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Turns.h b/Strategic/Strategic Turns.h index febe75c1..26d2399c 100644 --- a/Strategic/Strategic Turns.h +++ b/Strategic/Strategic Turns.h @@ -8,4 +8,4 @@ void HandleStrategicTurn( ); void SyncStrategicTurnTimes( ); void HandleStrategicTurnImplicationsOfExitingCombatMode( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Town Militia.h b/Strategic/Town Militia.h index 33824893..a9ef3536 100644 --- a/Strategic/Town Militia.h +++ b/Strategic/Town Militia.h @@ -135,4 +135,4 @@ FLOAT GetIntel(); void AddRaidPersonnel( INT32 aBloodcats, INT32 aZombie, INT32 aBandits ); void GetRaidPersonnel( INT32& arBloodcats, INT32& arZombie, INT32& arBandits ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/XML_Creatures.cpp b/Strategic/XML_Creatures.cpp index d0b482f2..d6fcc9d4 100644 --- a/Strategic/XML_Creatures.cpp +++ b/Strategic/XML_Creatures.cpp @@ -648,4 +648,4 @@ BOOLEAN ReadInCreaturePlacements(STR fileName) XML_ParserFree(parser); return TRUE; -} \ No newline at end of file +} diff --git a/Strategic/XML_SquadNames.cpp b/Strategic/XML_SquadNames.cpp index d41cd8bc..8d82d6b7 100644 --- a/Strategic/XML_SquadNames.cpp +++ b/Strategic/XML_SquadNames.cpp @@ -160,4 +160,4 @@ BOOLEAN ReadInSquadNamesStats(STR fileName) BOOLEAN WriteSquadNamesStats() { return( TRUE ); -} \ No newline at end of file +} diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 16188e05..9bf934e0 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -228,4 +228,4 @@ void RetreatBandageCallback( UINT8 ubResult ); bool isWidescreenUI(void); -#endif \ No newline at end of file +#endif diff --git a/Strategic/strategic town reputation.h b/Strategic/strategic town reputation.h index 853a4ac2..2ad89fa9 100644 --- a/Strategic/strategic town reputation.h +++ b/Strategic/strategic town reputation.h @@ -33,4 +33,4 @@ void HandleSpreadOfTownsOpinionForCurrentMercs( void ); void HandleSpreadOfTownOpinionForMercForSoldier( SOLDIERTYPE *pSoldier ); */ -#endif \ No newline at end of file +#endif diff --git a/Strategic/strategic.h b/Strategic/strategic.h index 082b3f95..c8d86357 100644 --- a/Strategic/strategic.h +++ b/Strategic/strategic.h @@ -65,4 +65,4 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ); BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Action Items.h b/Tactical/Action Items.h index cb90e2c5..551a4fc0 100644 --- a/Tactical/Action Items.h +++ b/Tactical/Action Items.h @@ -40,4 +40,4 @@ typedef enum #endif } ItemActionType; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Air Raid.h b/Tactical/Air Raid.h index 919c8f15..14fc7cbd 100644 --- a/Tactical/Air Raid.h +++ b/Tactical/Air Raid.h @@ -62,4 +62,4 @@ BOOLEAN LoadAirRaidInfoFromSaveGameFile( HWFILE hFile ); void EndAirRaid( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Animation Cache.h b/Tactical/Animation Cache.h index bf2753b8..78ad2ac3 100644 --- a/Tactical/Animation Cache.h +++ b/Tactical/Animation Cache.h @@ -26,4 +26,4 @@ void UnLoadCachedAnimationSurfaces( UINT16 usSoldierID, AnimationSurfaceCacheTyp -#endif \ No newline at end of file +#endif diff --git a/Tactical/Arms Dealer Init.h b/Tactical/Arms Dealer Init.h index cccc3af2..1a409002 100644 --- a/Tactical/Arms Dealer Init.h +++ b/Tactical/Arms Dealer Init.h @@ -393,4 +393,4 @@ extern void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemInd extern void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Auto Bandage.h b/Tactical/Auto Bandage.h index 796e9dff..057990b1 100644 --- a/Tactical/Auto Bandage.h +++ b/Tactical/Auto Bandage.h @@ -25,4 +25,4 @@ UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ); void HandleRetreatBandaging( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Boxing.h b/Tactical/Boxing.h index 89787494..8c9222f6 100644 --- a/Tactical/Boxing.h +++ b/Tactical/Boxing.h @@ -43,4 +43,4 @@ extern BOOLEAN BoxerExists( void ); extern UINT8 CountPeopleInBoxingRing( void ); extern void ClearAllBoxerFlags( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Bullets.h b/Tactical/Bullets.h index db087445..4bff3c42 100644 --- a/Tactical/Bullets.h +++ b/Tactical/Bullets.h @@ -107,4 +107,4 @@ BOOLEAN SaveBulletStructureToSaveGameFile( HWFILE hFile ); BOOLEAN LoadBulletStructureFromSavedGameFile( HWFILE hFile ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Civ Quotes.h b/Tactical/Civ Quotes.h index 0c466651..8cc83770 100644 --- a/Tactical/Civ Quotes.h +++ b/Tactical/Civ Quotes.h @@ -179,4 +179,4 @@ void BeginChatQuote( SOLDIERTYPE *pCiv, INT16 sX, INT16 sY ); BOOLEAN CivQuoteActive(); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index 1b469faf..f2aca38e 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -489,4 +489,4 @@ void SetExternMapscreenSpeechPanelXY( INT16 sXPos, INT16 sYPos ); void RemoveJerryMiloBrokenLaptopOverlay(); #endif -#endif \ No newline at end of file +#endif diff --git a/Tactical/End Game.h b/Tactical/End Game.h index a5c8da35..d7bdf22b 100644 --- a/Tactical/End Game.h +++ b/Tactical/End Game.h @@ -25,4 +25,4 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLe void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ); #endif -#endif \ No newline at end of file +#endif diff --git a/Tactical/Enemy Soldier Save.h b/Tactical/Enemy Soldier Save.h index 9d22adf6..1c82ced2 100644 --- a/Tactical/Enemy Soldier Save.h +++ b/Tactical/Enemy Soldier Save.h @@ -22,4 +22,4 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto extern BOOLEAN gfRestoringEnemySoldiersFromTempFile; -#endif \ No newline at end of file +#endif diff --git a/Tactical/EnemyItemDrops.cpp b/Tactical/EnemyItemDrops.cpp index 30e61581..0d720289 100644 --- a/Tactical/EnemyItemDrops.cpp +++ b/Tactical/EnemyItemDrops.cpp @@ -6,4 +6,4 @@ WEAPON_DROPS gEnemyWeaponDrops[MAX_DROP_ITEMS]; AMMO_DROPS gEnemyAmmoDrops[MAX_DROP_ITEMS]; EXPLOSIVE_DROPS gEnemyExplosiveDrops[MAX_DROP_ITEMS]; ARMOUR_DROPS gEnemyArmourDrops[MAX_DROP_ITEMS]; -MISC_DROPS gEnemyMiscDrops[MAX_DROP_ITEMS]; \ No newline at end of file +MISC_DROPS gEnemyMiscDrops[MAX_DROP_ITEMS]; diff --git a/Tactical/EnemyItemDrops.h b/Tactical/EnemyItemDrops.h index f2bc9169..7b531cb4 100644 --- a/Tactical/EnemyItemDrops.h +++ b/Tactical/EnemyItemDrops.h @@ -49,4 +49,4 @@ extern EXPLOSIVE_DROPS gEnemyExplosiveDrops[MAX_DROP_ITEMS]; extern ARMOUR_DROPS gEnemyArmourDrops[MAX_DROP_ITEMS]; extern MISC_DROPS gEnemyMiscDrops[MAX_DROP_ITEMS]; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Handle Doors.h b/Tactical/Handle Doors.h index 95a68305..6376ee6c 100644 --- a/Tactical/Handle Doors.h +++ b/Tactical/Handle Doors.h @@ -26,4 +26,4 @@ void HandleDoorChangeFromGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN f -#endif \ No newline at end of file +#endif diff --git a/Tactical/Handle UI Plan.h b/Tactical/Handle UI Plan.h index b4ccc3b2..5861c34b 100644 --- a/Tactical/Handle UI Plan.h +++ b/Tactical/Handle UI Plan.h @@ -14,4 +14,4 @@ void EndUIPlan( ); BOOLEAN InUIPlanMode( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 5937d911..896cf34b 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -382,4 +382,4 @@ void GetGridNoScreenXY( INT32 sGridNo, INT16 *pScreenX, INT16 *pScreenY ); //Legion by Jazz void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Control.h b/Tactical/Interface Control.h index 5fc96c36..8131ab3c 100644 --- a/Tactical/Interface Control.h +++ b/Tactical/Interface Control.h @@ -73,4 +73,4 @@ void DrawExplosionWarning( INT32 sGridno, INT8 sLevel, INT8 sDelay ); // For now, we aren't using usColour, but that will likely change in the future void DrawTraitRadius( INT32 sGridno, INT8 sLevel, INT32 sRadius, INT16 sThickness, UINT16 usColour ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Cursors.h b/Tactical/Interface Cursors.h index 0c89da40..507ab6ea 100644 --- a/Tactical/Interface Cursors.h +++ b/Tactical/Interface Cursors.h @@ -249,4 +249,4 @@ extern UINT32 gusCurMousePos; UINT16 GetSnapCursorIndex( UINT16 usAdditionalData ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 923eb108..5e5699e0 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -168,4 +168,4 @@ extern UINT8 gubDescBoxTotalAdvLines; // Jenilee: determine the cost of moving this item around in our inventory UINT16 GetInvMovementCost(OBJECTTYPE* pObj, INT16 old_pos, INT16 new_pos); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Utils.h b/Tactical/Interface Utils.h index a8e128ca..5a421c0d 100644 --- a/Tactical/Interface Utils.h +++ b/Tactical/Interface Utils.h @@ -27,4 +27,4 @@ void UnLoadCarPortraits( void ); void DrawItemOutlineZoomedInventory( INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, INT16 sColor, UINT32 uiBuffer ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface.h b/Tactical/Interface.h index 0df8a4c6..18f4bd33 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -581,4 +581,4 @@ void NCTHShowMounted( SOLDIERTYPE* pSoldier, UINT16* ptrBuf, UINT32 uiPitch, INT BOOLEAN HasBackgroundFlag( UINT8 usProfile, UINT64 aFlag ); INT16 GetBackgroundValue( UINT8 usProfile, UINT16 aNr ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Inventory Choosing.h b/Tactical/Inventory Choosing.h index 6f75e339..396f13fe 100644 --- a/Tactical/Inventory Choosing.h +++ b/Tactical/Inventory Choosing.h @@ -126,4 +126,4 @@ void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 // take militia items from sector void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 4f086238..2c5f2156 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -151,4 +151,4 @@ extern void InitGridNoUB(); #endif -#endif \ No newline at end of file +#endif diff --git a/Tactical/Keys.h b/Tactical/Keys.h index 8937d292..cd92ae38 100644 --- a/Tactical/Keys.h +++ b/Tactical/Keys.h @@ -281,4 +281,4 @@ void AttachStringToDoor( INT32 sGridNo ); void DropKeysInKeyRing( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, INT8 bVisible, BOOLEAN fAddToDropList, INT32 iDropListSlot, BOOLEAN fUseUnLoaded ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/LOS.h b/Tactical/LOS.h index 64c3fc80..41748872 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -261,4 +261,4 @@ void DamageRiotShield( SOLDIERTYPE* pSoldier, INT32& rsDamage, INT32& rsSecondar extern INT8 GetStealth(SOLDIERTYPE* pSoldier); extern INT8 GetSightAdjustmentBasedOnLBE(SOLDIERTYPE* pSoldier); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Map Information.h b/Tactical/Map Information.h index bbda9ca2..76d4e36b 100644 --- a/Tactical/Map Information.h +++ b/Tactical/Map Information.h @@ -66,4 +66,4 @@ BOOLEAN ValidateEntryPointGridNo( INT32 *sGridNo ); extern BOOLEAN gfWorldLoaded; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Militia Control.h b/Tactical/Militia Control.h index 68113765..b309e288 100644 --- a/Tactical/Militia Control.h +++ b/Tactical/Militia Control.h @@ -28,4 +28,4 @@ BOOLEAN CreateDestroyMilitiaControlPopUpBoxes( void ); BOOLEAN CheckIfRadioIsEquipped( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/MiniGame.h b/Tactical/MiniGame.h index a1f634ae..550634db 100644 --- a/Tactical/MiniGame.h +++ b/Tactical/MiniGame.h @@ -43,4 +43,4 @@ void SetInteractivePicture( std::string aStr, bool aVal ); void MiniGame_Init_Picture(); UINT32 MiniGame_Handle_Picture(); -#endif //__MINIGAME_H \ No newline at end of file +#endif //__MINIGAME_H diff --git a/Tactical/Morale.h b/Tactical/Morale.h index db146a76..c423faa3 100644 --- a/Tactical/Morale.h +++ b/Tactical/Morale.h @@ -160,4 +160,4 @@ void DailyMoraleUpdate( SOLDIERTYPE *pSoldier ); void DecayTacticalMoraleModifiers( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/PathAIDebug.h b/Tactical/PathAIDebug.h index 2bc3342e..0eec71c0 100644 --- a/Tactical/PathAIDebug.h +++ b/Tactical/PathAIDebug.h @@ -1 +1 @@ -//#define PATHAI_VISIBLE_DEBUG \ No newline at end of file +//#define PATHAI_VISIBLE_DEBUG diff --git a/Tactical/Rain.h b/Tactical/Rain.h index f7c78c74..de20e8b6 100644 --- a/Tactical/Rain.h +++ b/Tactical/Rain.h @@ -5,4 +5,4 @@ BOOLEAN IsItAllowedToRenderRain(); void RenderRain(); void ResetRain(); -#endif \ No newline at end of file +#endif diff --git a/Tactical/ShopKeeper Quotes.h b/Tactical/ShopKeeper Quotes.h index 48bd83f6..a7a05a10 100644 --- a/Tactical/ShopKeeper Quotes.h +++ b/Tactical/ShopKeeper Quotes.h @@ -83,4 +83,4 @@ enum #define ARNIE_QUOTE_NOT_REPAIRED_YET 33 -#endif \ No newline at end of file +#endif diff --git a/Tactical/SkillCheck.h b/Tactical/SkillCheck.h index d1e203b7..e166c09b 100644 --- a/Tactical/SkillCheck.h +++ b/Tactical/SkillCheck.h @@ -46,4 +46,4 @@ enum SkillChecks -#endif \ No newline at end of file +#endif diff --git a/Tactical/SkillMenu.h b/Tactical/SkillMenu.h index c24958d9..13676ff9 100644 --- a/Tactical/SkillMenu.h +++ b/Tactical/SkillMenu.h @@ -197,4 +197,4 @@ public: void EquipmentListMenu(); void EquipmentListMenuCancel(); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Ani.h b/Tactical/Soldier Ani.h index f18e5802..0865019f 100644 --- a/Tactical/Soldier Ani.h +++ b/Tactical/Soldier Ani.h @@ -15,4 +15,4 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ); void KickOutWheelchair( SOLDIERTYPE *pSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index d98f9c01..06398454 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -600,4 +600,4 @@ INT32 ChooseHairColor( UINT8 usBodyType, INT32 skin ); // Flugente: set palettes for vest/shirt void SetClothes( SOLDIERTYPE* pSoldier, INT8 aVest, INT8 aPants, INT8 aHair = -1, INT8 aSkin = -1 ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Find.h b/Tactical/Soldier Find.h index de256761..e4e64dc4 100644 --- a/Tactical/Soldier Find.h +++ b/Tactical/Soldier Find.h @@ -53,4 +53,4 @@ void GetGridNoScreenPos( INT32 sGridNo, UINT8 ubLevel, INT16 *psScreenX, INT16 * -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Functions.h b/Tactical/Soldier Functions.h index 5bf64b68..a48fb12a 100644 --- a/Tactical/Soldier Functions.h +++ b/Tactical/Soldier Functions.h @@ -25,4 +25,4 @@ void HandleCrowShadowVisibility( SOLDIERTYPE *pSoldier ); BOOLEAN DoesSoldierWearGasMask(SOLDIERTYPE *pSoldier);//dnl ch40 200909 -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 785359da..85b2e5cf 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -3325,4 +3325,4 @@ void SectorAddDownedPilot( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // remove the flag. We can only find the pilot the first time we visit this sector after the heli was shut down pSector->usSectorInfoFlag &= ~SECTORINFO_ENEMYHELI_SHOTDOWN; } -} \ No newline at end of file +} diff --git a/Tactical/Soldier Init List.h b/Tactical/Soldier Init List.h index ac47d25d..d501c910 100644 --- a/Tactical/Soldier Init List.h +++ b/Tactical/Soldier Init List.h @@ -69,4 +69,4 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); // Flugente: decide wether to add a downed pilot if a helicopter was shot down here void SectorAddDownedPilot( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier macros.h b/Tactical/Soldier macros.h index af0a32fe..a436a3cd 100644 --- a/Tactical/Soldier macros.h +++ b/Tactical/Soldier macros.h @@ -41,4 +41,4 @@ //#define OK_ENTERABLE_VEHICLE( p ) ( ( p->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !TANK( p ) && p->stats.bLife >= OKLIFE ) #define OK_ENTERABLE_VEHICLE( p ) ( ( p->flags.uiStatusFlags & SOLDIER_VEHICLE ) && (!ARMED_VEHICLE( p ) || !(p->flags.uiStatusFlags & SOLDIER_ENEMY) ) && p->stats.bLife >= OKLIFE ) -#endif \ No newline at end of file +#endif diff --git a/Tactical/Spread burst.h b/Tactical/Spread burst.h index cfd040f2..fe074cfd 100644 --- a/Tactical/Spread burst.h +++ b/Tactical/Spread burst.h @@ -23,4 +23,4 @@ void AIPickBurstLocations( SOLDIERTYPE *pSoldier, INT8 bTargets, SOLDIERTYPE *pT void RenderAccumulatedBurstLocations( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Squads.h b/Tactical/Squads.h index 904cc5db..e37900d5 100644 --- a/Tactical/Squads.h +++ b/Tactical/Squads.h @@ -175,4 +175,4 @@ void CheckSquadMovementGroups( void ); //SQUAD10: Check for squads that are oversized at current resolution and move them to another squad void FixOversizedSquadsInSector( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Strategic Exit GUI.h b/Tactical/Strategic Exit GUI.h index 2bfb23df..b3cae78c 100644 --- a/Tactical/Strategic Exit GUI.h +++ b/Tactical/Strategic Exit GUI.h @@ -25,4 +25,4 @@ BOOLEAN HandleSectorExitMenu( ); void RemoveSectorExitMenu( BOOLEAN fOK ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Structure Wrap.h b/Tactical/Structure Wrap.h index 0679e26c..5238a8be 100644 --- a/Tactical/Structure Wrap.h +++ b/Tactical/Structure Wrap.h @@ -53,4 +53,4 @@ BOOLEAN SetOpenableStructureToClosed( INT32 sGridNo, UINT8 ubLevel ); BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo , INT8 direction2, BOOLEAN fIntactWindowsAlso ); //legion 2 Windows BOOLEAN IsLegionWallPresentAtGridno( INT32 sGridNo ); //legion 2 Fence -#endif \ No newline at end of file +#endif diff --git a/Tactical/Tactical Turns.h b/Tactical/Tactical Turns.h index 173f2fd4..0a9ce4c1 100644 --- a/Tactical/Tactical Turns.h +++ b/Tactical/Tactical Turns.h @@ -4,4 +4,4 @@ void HandleTacticalEndTurn( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/TeamTurns.h b/Tactical/TeamTurns.h index 1d14dbcf..664f6b70 100644 --- a/Tactical/TeamTurns.h +++ b/Tactical/TeamTurns.h @@ -30,4 +30,4 @@ void EndTurnEvents( void ); BOOLEAN NPCFirstDraw( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/UI Cursors.h b/Tactical/UI Cursors.h index c74a1804..3c9af7cf 100644 --- a/Tactical/UI Cursors.h +++ b/Tactical/UI Cursors.h @@ -30,4 +30,4 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs // based on how trained the shooter is. UINT32 ChanceToHitApproximation( SOLDIERTYPE * pSoldier, UINT32 uiChance ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/VehicleMenu.cpp b/Tactical/VehicleMenu.cpp index c5cb8e3c..ca4d704a 100644 --- a/Tactical/VehicleMenu.cpp +++ b/Tactical/VehicleMenu.cpp @@ -219,4 +219,4 @@ void VehicleMenu( INT32 usMapPos, SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ) pCurrentSoldier = pSoldier; pCurrentVehicle = pVehicle; gVehicleSelection.Setup(0); -} \ No newline at end of file +} diff --git a/Tactical/VehicleMenu.h b/Tactical/VehicleMenu.h index 7d5a418c..bd21ab3d 100644 --- a/Tactical/VehicleMenu.h +++ b/Tactical/VehicleMenu.h @@ -82,4 +82,4 @@ private: void VehicleMenu( INT32 usMapPos, SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/XML_HiddenNames.cpp b/Tactical/XML_HiddenNames.cpp index a3382066..c86f9840 100644 --- a/Tactical/XML_HiddenNames.cpp +++ b/Tactical/XML_HiddenNames.cpp @@ -212,4 +212,4 @@ void LoadHiddenNames() strcat(fileName, HIDDENNAMESFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHiddenNamesStats(zHiddenNames,fileName), HIDDENNAMESFILENAME); -} \ No newline at end of file +} diff --git a/Tactical/XML_LBEPocketPopup.cpp b/Tactical/XML_LBEPocketPopup.cpp index bcf2ed49..40c959bf 100644 --- a/Tactical/XML_LBEPocketPopup.cpp +++ b/Tactical/XML_LBEPocketPopup.cpp @@ -489,4 +489,4 @@ BOOLEAN ReadInLBEPocketPopups(STR fileName) return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_MercStartingGear.cpp b/Tactical/XML_MercStartingGear.cpp index e2430171..1713ea75 100644 --- a/Tactical/XML_MercStartingGear.cpp +++ b/Tactical/XML_MercStartingGear.cpp @@ -757,4 +757,4 @@ BOOLEAN WriteMercStartingGearStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_RPCFacesSmall.cpp b/Tactical/XML_RPCFacesSmall.cpp index 0ff4d3c4..dee7f4c1 100644 --- a/Tactical/XML_RPCFacesSmall.cpp +++ b/Tactical/XML_RPCFacesSmall.cpp @@ -231,4 +231,4 @@ BOOLEAN WriteSmallFacesStats(RPC_SMALL_FACE_VALUES *pSmallFaces, STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_RandomStats.cpp b/Tactical/XML_RandomStats.cpp index b1531b23..c9489e97 100644 --- a/Tactical/XML_RandomStats.cpp +++ b/Tactical/XML_RandomStats.cpp @@ -298,4 +298,4 @@ BOOLEAN WriteRandomStats( STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/fov.h b/Tactical/fov.h index c1e115f6..82b57eff 100644 --- a/Tactical/fov.h +++ b/Tactical/fov.h @@ -20,4 +20,4 @@ void ExamineSlantRoofFOVSlots( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/opplist.h b/Tactical/opplist.h index 9330b7e6..f63f3873 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -177,4 +177,4 @@ INT32 MaxDistanceVisible( void ); // HEADROCK HAM 3.6: Moved here from cpp void MakeBloodcatsHostile( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/qarray.h b/Tactical/qarray.h index 19f57e68..8027ef55 100644 --- a/Tactical/qarray.h +++ b/Tactical/qarray.h @@ -29,4 +29,4 @@ extern QARRAY_VALUES QuoteExp[NUM_PROFILES]; -#endif \ No newline at end of file +#endif diff --git a/Tactical/rt time defines.h b/Tactical/rt time defines.h index 445ee50a..e112bc99 100644 --- a/Tactical/rt time defines.h +++ b/Tactical/rt time defines.h @@ -22,4 +22,4 @@ #define RT_COMPRESSION_TACTICAL_TURN_MODIFIER 10 -#endif \ No newline at end of file +#endif diff --git a/Tactical/soldier tile.h b/Tactical/soldier tile.h index 66ebf4cf..e20e3232 100644 --- a/Tactical/soldier tile.h +++ b/Tactical/soldier tile.h @@ -27,4 +27,4 @@ void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT32 sCauseGridNo, INT8 bVal BOOLEAN CanExchangePlaces( SOLDIERTYPE *pSoldier1, SOLDIERTYPE *pSoldier2, BOOLEAN fShow ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Ambient Control.cpp b/TileEngine/Ambient Control.cpp index 321ebcdc..cf42114a 100644 --- a/TileEngine/Ambient Control.cpp +++ b/TileEngine/Ambient Control.cpp @@ -721,4 +721,4 @@ void SetSSA(void) //guiCurrentSteadyStateSoundHandle = SoundPlay( zFileName, &spParms ); guiCurrentSteadyStateSoundHandle = SoundPlayStreamedFile(zFileName, &spParms); -} \ No newline at end of file +} diff --git a/TileEngine/Ambient Control.h b/TileEngine/Ambient Control.h index 2668d25e..01035d22 100644 --- a/TileEngine/Ambient Control.h +++ b/TileEngine/Ambient Control.h @@ -51,4 +51,4 @@ typedef struct -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Buildings.h b/TileEngine/Buildings.h index 998551cc..b7f9022c 100644 --- a/TileEngine/Buildings.h +++ b/TileEngine/Buildings.h @@ -29,4 +29,4 @@ void GenerateBuildings( void ); INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sDesiredGridNo, BOOLEAN fClimbUp ); BOOLEAN SameBuilding( INT32 sGridNo1, INT32 sGridNo2 ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Fog Of War.h b/TileEngine/Fog Of War.h index 7ac4b40f..4dd33c30 100644 --- a/TileEngine/Fog Of War.h +++ b/TileEngine/Fog Of War.h @@ -5,4 +5,4 @@ //Removes and smooths the adjacent tiles. void RemoveFogFromGridNo( INT32 uiGridNo ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Interactive Tiles.h b/TileEngine/Interactive Tiles.h index 01ec0aa3..00700e0a 100644 --- a/TileEngine/Interactive Tiles.h +++ b/TileEngine/Interactive Tiles.h @@ -46,4 +46,4 @@ LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT32 *psGridNo, -#endif \ No newline at end of file +#endif diff --git a/TileEngine/LightEffects.h b/TileEngine/LightEffects.h index 783f6695..fb34c466 100644 --- a/TileEngine/LightEffects.h +++ b/TileEngine/LightEffects.h @@ -58,4 +58,4 @@ BOOLEAN IsLightEffectAtTile( INT32 sGridNo ); void CreatePersonalLight( INT32 sGridNo, UINT8 ubID ); void RemovePersonalLights( UINT8 ubID ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Radar Screen.h b/TileEngine/Radar Screen.h index 666a7fc2..7d5b3adb 100644 --- a/TileEngine/Radar Screen.h +++ b/TileEngine/Radar Screen.h @@ -41,4 +41,4 @@ void ClearOutRadarMapImage( void ); // do we render the radar screen?..or the squad list? extern BOOLEAN fRenderRadarScreen; -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Render Fun.h b/TileEngine/Render Fun.h index e3d8ad4c..dda58f34 100644 --- a/TileEngine/Render Fun.h +++ b/TileEngine/Render Fun.h @@ -34,4 +34,4 @@ void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo ); void SetRecalculateWireFrameFlagRadius(INT16 sX, INT16 sY, INT16 sRadius); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Shade Table Util.h b/TileEngine/Shade Table Util.h index c0cac312..e26e9588 100644 --- a/TileEngine/Shade Table Util.h +++ b/TileEngine/Shade Table Util.h @@ -13,4 +13,4 @@ extern BOOLEAN gfForceBuildShadeTables; BOOLEAN DeleteShadeTableDir( ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Simple Render Utils.h b/TileEngine/Simple Render Utils.h index ad1e1aa1..1e76db85 100644 --- a/TileEngine/Simple Render Utils.h +++ b/TileEngine/Simple Render Utils.h @@ -5,4 +5,4 @@ void MarkMapIndexDirty( INT32 iMapIndex ); void CenterScreenAtMapIndex( INT32 iMapIndex ); void MarkWorldDirty(); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 996a40d6..6b776e32 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -77,4 +77,4 @@ BOOLEAN CheckSmokeEffect(INT32 sGridNo, INT8 bLevel, INT8 bType); // find smoke effect on visible screen BOOLEAN FindVisibleSmokeEffect(INT8 bType); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Structure Internals.h b/TileEngine/Structure Internals.h index fcf95687..d05a043a 100644 --- a/TileEngine/Structure Internals.h +++ b/TileEngine/Structure Internals.h @@ -250,4 +250,4 @@ typedef struct TAG_STRUCTURE_FILE_HEADER #define STRUCTURE_FILE_CONTAINS_AUXIMAGEDATA 0x01 #define STRUCTURE_FILE_CONTAINS_STRUCTUREDATA 0x02 -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tactical Placement GUI.h b/TileEngine/Tactical Placement GUI.h index 06307750..1571bf57 100644 --- a/TileEngine/Tactical Placement GUI.h +++ b/TileEngine/Tactical Placement GUI.h @@ -26,4 +26,4 @@ extern SOLDIERTYPE *gpTacticalPlacementHilightedSoldier; //Saved value. Contains the last choice for future battles. extern UINT8 gubDefaultButton; -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tile Cache.h b/TileEngine/Tile Cache.h index 5cca3600..9753b3b2 100644 --- a/TileEngine/Tile Cache.h +++ b/TileEngine/Tile Cache.h @@ -45,4 +45,4 @@ void CheckForAndDeleteTileCacheStructInfo( LEVELNODE *pNode, UINT16 usIndex ); void GetRootName( STR8 pDestStr, const STR8 pSrcStr ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tile Surface.h b/TileEngine/Tile Surface.h index e19d8f93..4ccd6ecf 100644 --- a/TileEngine/Tile Surface.h +++ b/TileEngine/Tile Surface.h @@ -14,4 +14,4 @@ void DeleteTileSurface( PTILE_IMAGERY pTileSurf ); void SetRaisedObjectFlag( char *cFilename, TILE_IMAGERY *pTileSurf ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/World Tileset Enums.h b/TileEngine/World Tileset Enums.h index a9039b98..7c90c5b3 100644 --- a/TileEngine/World Tileset Enums.h +++ b/TileEngine/World Tileset Enums.h @@ -170,4 +170,4 @@ enum }; #endif -#endif \ No newline at end of file +#endif diff --git a/TileEngine/WorldDat.h b/TileEngine/WorldDat.h index f70dfa3f..5d020aa2 100644 --- a/TileEngine/WorldDat.h +++ b/TileEngine/WorldDat.h @@ -34,4 +34,4 @@ void SetTilesetTwoTerrainValues( ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/physics.h b/TileEngine/physics.h index e27d8aad..4ff5afdf 100644 --- a/TileEngine/physics.h +++ b/TileEngine/physics.h @@ -183,4 +183,4 @@ INT32 RandomGridFromRadius( INT32 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRad UINT32 GetArtilleryTargetGridNo( UINT32 sTargetGridNo, INT8 bRadius ); BOOLEAN GetArtilleryLaunchParams(UINT32 sStartingGridNo, UINT32 sTargetGridNo, UINT8 ubTargetLevel, INT16 sStartZ, INT16 sEndZ, UINT16 usLauncher, OBJECTTYPE* pObj, FLOAT* pdForce, FLOAT* pdDegrees); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/pits.h b/TileEngine/pits.h index 0ffb99c1..3dbff9e6 100644 --- a/TileEngine/pits.h +++ b/TileEngine/pits.h @@ -17,4 +17,4 @@ extern BOOLEAN gfLoadPitsWithoutArming; void HandleFallIntoPitFromAnimation( UINT8 ubID ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/renderworld.h b/TileEngine/renderworld.h index 140e5d5f..124487e6 100644 --- a/TileEngine/renderworld.h +++ b/TileEngine/renderworld.h @@ -227,4 +227,4 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip(UINT16 *pBuffer, UINT32 uiD BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows = FALSE); BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, HVOBJECT hAlphaVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows = FALSE); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/structure.h b/TileEngine/structure.h index d9fd6793..a5bf6bd5 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -136,4 +136,4 @@ UINT8 StructureFlagToType( UINT32 uiFlag ); UINT32 GetStructureOpenSound( STRUCTURE *pStructure, BOOLEAN fClose ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/sysutil.h b/TileEngine/sysutil.h index f067d71f..5b460d63 100644 --- a/TileEngine/sysutil.h +++ b/TileEngine/sysutil.h @@ -18,4 +18,4 @@ BOOLEAN InitializeSystemVideoObjects( ); BOOLEAN InitializeGameVideoObjects( ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/worldman.h b/TileEngine/worldman.h index 7e504d12..37773459 100644 --- a/TileEngine/worldman.h +++ b/TileEngine/worldman.h @@ -179,4 +179,4 @@ BOOLEAN IsLegionLevel( INT32 sGridNo ); BOOLEAN FindStruct(INT32 sSpot, INT8 bLevel, UINT16 usIndex); BOOLEAN FindStructFlag(INT32 sSpot, INT8 bLevel, UINT32 uiFlag); -#endif \ No newline at end of file +#endif diff --git a/Utils/Animated ProgressBar.h b/Utils/Animated ProgressBar.h index ac9aab75..d1beb047 100644 --- a/Utils/Animated ProgressBar.h +++ b/Utils/Animated ProgressBar.h @@ -149,4 +149,4 @@ void SetProgressBarRenderBuffer( UINT32 ubID , UINT32 uiBufferID ); void CreateProgressBarNoBorder( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Cinematics Bink.h b/Utils/Cinematics Bink.h index f45ec3d4..7989488b 100644 --- a/Utils/Cinematics Bink.h +++ b/Utils/Cinematics Bink.h @@ -46,4 +46,4 @@ void BinkShutdownVideo(void); BINKFLIC *BinkPlayFlic(const CHAR8 *cFilename, UINT32 uiLeft, UINT32 uiTop, UINT32 uiFlags ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Cursors.h b/Utils/Cursors.h index 0a763a15..32f194a2 100644 --- a/Utils/Cursors.h +++ b/Utils/Cursors.h @@ -318,4 +318,4 @@ void SetCursorFlags( UINT32 uiCursor, UINT8 ubFlags ); void RemoveCursorFlags( UINT32 uiCursor, UINT8 ubFlags ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Debug Control.h b/Utils/Debug Control.h index 8d562fa5..3609c3d9 100644 --- a/Utils/Debug Control.h +++ b/Utils/Debug Control.h @@ -55,4 +55,4 @@ extern void AiDbgMessage( CHAR8 *Str); #endif -#endif \ No newline at end of file +#endif diff --git a/Utils/Encrypted File.cpp b/Utils/Encrypted File.cpp index 4238886b..16886459 100644 --- a/Utils/Encrypted File.cpp +++ b/Utils/Encrypted File.cpp @@ -230,4 +230,4 @@ void DecodeString(STR16 pDestString, UINT32 uiSeekAmount) // } //#endif } -} \ No newline at end of file +} diff --git a/Utils/Encrypted File.h b/Utils/Encrypted File.h index 110b31d5..26806730 100644 --- a/Utils/Encrypted File.h +++ b/Utils/Encrypted File.h @@ -7,4 +7,4 @@ BOOLEAN LoadEncryptedDataFromFile(STR pFileName, STR16 pDestString, UINT32 uiSee BOOLEAN LoadEncryptedDataFromFileRandomLine(STR pFileName, STR16 pDestString, UINT32 uiSeekAmount); void DecodeString(STR16 pDestString, UINT32 uiSeekAmount); -#endif \ No newline at end of file +#endif diff --git a/Utils/ExportStrings.h b/Utils/ExportStrings.h index f2156ed5..bd228813 100644 --- a/Utils/ExportStrings.h +++ b/Utils/ExportStrings.h @@ -6,4 +6,4 @@ namespace Loc bool ExportStrings(); } -#endif // _EXPORTSTRINGS_H_ \ No newline at end of file +#endif // _EXPORTSTRINGS_H_ diff --git a/Utils/Multi Language Graphic Utils.h b/Utils/Multi Language Graphic Utils.h index dcedbcc1..44d0bf07 100644 --- a/Utils/Multi Language Graphic Utils.h +++ b/Utils/Multi Language Graphic Utils.h @@ -50,4 +50,4 @@ enum BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Multilingual Text Code Generator.h b/Utils/Multilingual Text Code Generator.h index 653fd559..1df17a81 100644 --- a/Utils/Multilingual Text Code Generator.h +++ b/Utils/Multilingual Text Code Generator.h @@ -9,4 +9,4 @@ BOOLEAN ProcessIfMultilingualCmdLineArgDetected( STR8 str ); //macro function out #define ProcessIfMultilingualCmdLineArgDetected( a ) 0 -#endif \ No newline at end of file +#endif diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index 033e6227..dbdb0cdb 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -167,4 +167,4 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ); // min width for box void SpecifyBoxMinWidth( INT32 hBoxHandle, INT32 iMinWidth ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Quantize Wrap.h b/Utils/Quantize Wrap.h index daec31a1..92003163 100644 --- a/Utils/Quantize Wrap.h +++ b/Utils/Quantize Wrap.h @@ -18,4 +18,4 @@ void MapPalette( UINT8 *pDest, UINT8 *pSrc, INT16 sWidth, INT16 sHeight, INT16 s -#endif \ No newline at end of file +#endif diff --git a/Utils/Quantize.h b/Utils/Quantize.h index 508ebdeb..0a3e15ec 100644 --- a/Utils/Quantize.h +++ b/Utils/Quantize.h @@ -40,4 +40,4 @@ protected: void GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex); }; -#endif \ No newline at end of file +#endif diff --git a/Utils/STIConvert.h b/Utils/STIConvert.h index 39d44ba8..4cfb1f34 100644 --- a/Utils/STIConvert.h +++ b/Utils/STIConvert.h @@ -9,4 +9,4 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s UINT32 ETRLECompressSubImage( UINT8 * pDest, UINT32 uiDestLen, UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 usHeight, STCISubImage * pSubImage ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 51a31a9b..656be5ce 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -465,4 +465,4 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Text Input.h b/Utils/Text Input.h index ad6d60df..c713056c 100644 --- a/Utils/Text Input.h +++ b/Utils/Text Input.h @@ -192,4 +192,4 @@ void KillClipboard(); extern BOOLEAN gfNoScroll; -#endif \ No newline at end of file +#endif diff --git a/Utils/Timer Control.h b/Utils/Timer Control.h index 50636184..16b25c3b 100644 --- a/Utils/Timer Control.h +++ b/Utils/Timer Control.h @@ -129,4 +129,4 @@ void ZeroTimeCounter(INT32& timer); #define ZEROTIMECOUNTER(c) ZeroTimeCounter(c) void SetTileAnimCounter( INT32 iTime ); -#endif \ No newline at end of file +#endif diff --git a/Utils/XML_Language.h b/Utils/XML_Language.h index 3269c316..a039faa6 100644 --- a/Utils/XML_Language.h +++ b/Utils/XML_Language.h @@ -14,4 +14,4 @@ typedef struct extern LANGUAGE_LOCATION zlanguageText[1000]; -#endif \ No newline at end of file +#endif diff --git a/Utils/XML_SenderNameList.cpp b/Utils/XML_SenderNameList.cpp index e0bedaee..6baad540 100644 --- a/Utils/XML_SenderNameList.cpp +++ b/Utils/XML_SenderNameList.cpp @@ -167,4 +167,4 @@ BOOLEAN ReadInSenderNameList(STR fileName, BOOLEAN localizedVersion) return( TRUE ); -} \ No newline at end of file +} diff --git a/Utils/maputility.h b/Utils/maputility.h index 276af932..26084b9b 100644 --- a/Utils/maputility.h +++ b/Utils/maputility.h @@ -5,4 +5,4 @@ void GenerateAllMapsInit(void); #endif -#endif \ No newline at end of file +#endif diff --git a/Utils/message.h b/Utils/message.h index cb2e94e7..360a764d 100644 --- a/Utils/message.h +++ b/Utils/message.h @@ -118,4 +118,4 @@ void DisplayLastMessage( void ); */ -#endif \ No newline at end of file +#endif diff --git a/Utils/popup_callback.h b/Utils/popup_callback.h index 8bceddc7..f38b103e 100644 --- a/Utils/popup_callback.h +++ b/Utils/popup_callback.h @@ -337,4 +337,4 @@ }; }; -#endif \ No newline at end of file +#endif diff --git a/Utils/popup_class.cpp b/Utils/popup_class.cpp index b35cee4b..fec319e9 100644 --- a/Utils/popup_class.cpp +++ b/Utils/popup_class.cpp @@ -1861,4 +1861,4 @@ void popupMouseClickCallback(MOUSE_REGION *pRegion, INT32 iReason) if (p) { p->MenuBtnCallBack(pRegion, iReason); } -} \ No newline at end of file +} diff --git a/Utils/popup_definition.cpp b/Utils/popup_definition.cpp index 25b3f0dd..261db649 100644 --- a/Utils/popup_definition.cpp +++ b/Utils/popup_definition.cpp @@ -232,4 +232,4 @@ return applyPopupContentGenerator( popup, this->generatorId ); } - \ No newline at end of file + diff --git a/Utils/popup_definition.h b/Utils/popup_definition.h index 2b687f8f..79a3e5bd 100644 --- a/Utils/popup_definition.h +++ b/Utils/popup_definition.h @@ -106,4 +106,4 @@ protected: UINT16 generatorId; }; -#endif \ No newline at end of file +#endif diff --git a/ext/VFS/src/Core/files.cmake b/ext/VFS/src/Core/files.cmake index ce308133..ab8fa54e 100644 --- a/ext/VFS/src/Core/files.cmake +++ b/ext/VFS/src/Core/files.cmake @@ -77,4 +77,4 @@ set(${mod}_files ${INCLUDE_Core_Interface} ${SOURCE_Core_Interface} ${INCLUDE_Core_Location} ${SOURCE_Core_Location} CACHE INTERNAL "" -) \ No newline at end of file +) diff --git a/ext/export/src/ja2/Structure Internals.h b/ext/export/src/ja2/Structure Internals.h index 3d86fe57..639e74a9 100644 --- a/ext/export/src/ja2/Structure Internals.h +++ b/ext/export/src/ja2/Structure Internals.h @@ -240,4 +240,4 @@ typedef struct TAG_STRUCTURE_FILE_HEADER #define STRUCTURE_FILE_CONTAINS_AUXIMAGEDATA 0x01 #define STRUCTURE_FILE_CONTAINS_STRUCTUREDATA 0x02 -#endif \ No newline at end of file +#endif diff --git a/ext/export/src/ja2/Types.h b/ext/export/src/ja2/Types.h index b6e9ba28..78047e54 100644 --- a/ext/export/src/ja2/Types.h +++ b/ext/export/src/ja2/Types.h @@ -100,4 +100,4 @@ typedef VECTOR4 MATRIX4[4]; // 4x4 matrix typedef VECTOR4 COLOR; // rgba color array -#endif \ No newline at end of file +#endif diff --git a/sgp/Button Sound Control.cpp b/sgp/Button Sound Control.cpp index a2479e9c..b9187034 100644 --- a/sgp/Button Sound Control.cpp +++ b/sgp/Button Sound Control.cpp @@ -180,4 +180,4 @@ void PlayButtonSound( INT32 iButtonID, INT32 iSoundType ) } -} \ No newline at end of file +} diff --git a/sgp/Compression.h b/sgp/Compression.h index f1fb6210..d9b9fefc 100644 --- a/sgp/Compression.h +++ b/sgp/Compression.h @@ -49,4 +49,4 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ); UINT32 Compress( PTR pCompPtr, BYTE * pBuffer, UINT32 uiBufferLen ); void CompressFini( PTR pCompPtr ); -#endif \ No newline at end of file +#endif diff --git a/sgp/DirectDraw Calls.h b/sgp/DirectDraw Calls.h index e94ed8c5..f7ba9a91 100644 --- a/sgp/DirectDraw Calls.h +++ b/sgp/DirectDraw Calls.h @@ -95,4 +95,4 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe #endif -#endif // __DirectDraw_Calls_H__ \ No newline at end of file +#endif // __DirectDraw_Calls_H__ diff --git a/sgp/DirectX Common.h b/sgp/DirectX Common.h index af2c448c..e25890da 100644 --- a/sgp/DirectX Common.h +++ b/sgp/DirectX Common.h @@ -26,4 +26,4 @@ extern "C" { } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/Ja2 Libs.h b/sgp/Ja2 Libs.h index 72d67aaa..87319f10 100644 --- a/sgp/Ja2 Libs.h +++ b/sgp/Ja2 Libs.h @@ -58,4 +58,4 @@ }; -#endif \ No newline at end of file +#endif diff --git a/sgp/english.h b/sgp/english.h index 09d1f54a..8ac75ff1 100644 --- a/sgp/english.h +++ b/sgp/english.h @@ -128,4 +128,4 @@ #define COMMA 188 #define FULLSTOP 190 -#endif \ No newline at end of file +#endif diff --git a/sgp/imgfmt.h b/sgp/imgfmt.h index 1d3b4463..6bdb6919 100644 --- a/sgp/imgfmt.h +++ b/sgp/imgfmt.h @@ -89,4 +89,4 @@ typedef struct #define STCI_PALETTE_ELEMENT_SIZE 3 #define STCI_8BIT_PALETTE_SIZE 768 -#endif \ No newline at end of file +#endif diff --git a/sgp/input.h b/sgp/input.h index a6ac866b..e045be02 100644 --- a/sgp/input.h +++ b/sgp/input.h @@ -151,4 +151,4 @@ extern BOOLEAN gfSGPInputReceived; } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/mousesystem_macros.h b/sgp/mousesystem_macros.h index 2670f71e..1e081e90 100644 --- a/sgp/mousesystem_macros.h +++ b/sgp/mousesystem_macros.h @@ -37,4 +37,4 @@ extern void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type, UINT16 Xcoord, UINT16 Ycoor } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/pcx.h b/sgp/pcx.h index 555eef6b..db3a3a59 100644 --- a/sgp/pcx.h +++ b/sgp/pcx.h @@ -37,4 +37,4 @@ BOOLEAN LoadPCXFileToImage( HIMAGE hImage, UINT16 fContents ); PcxObject *LoadPcx(STR8 pFilename); BOOLEAN BlitPcxToBuffer( PcxObject *pCurrentPcxObject, UINT8 *pBuffer, UINT16 usBufferWidth, UINT16 usBufferHeight, UINT16 usX, UINT16 usY, BOOLEAN fTransp); -#endif \ No newline at end of file +#endif diff --git a/sgp/soundman.h b/sgp/soundman.h index be09f429..ac29eb72 100644 --- a/sgp/soundman.h +++ b/sgp/soundman.h @@ -105,4 +105,4 @@ extern void SoundLog(CHAR8 *strMessage); #endif */ -#endif \ No newline at end of file +#endif diff --git a/sgp/timer.h b/sgp/timer.h index e94e9ea5..75770151 100644 --- a/sgp/timer.h +++ b/sgp/timer.h @@ -27,4 +27,4 @@ UINT32 ClockIsTicking(TIMER uiTimer); } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/vsurface_private.h b/sgp/vsurface_private.h index 29310d90..b60cc0a7 100644 --- a/sgp/vsurface_private.h +++ b/sgp/vsurface_private.h @@ -15,4 +15,4 @@ LPDIRECTDRAWPALETTE GetVideoSurfaceDDPalette( HVSURFACE hVSurface ); HVSURFACE CreateVideoSurfaceFromDDSurface( LPDIRECTDRAWSURFACE2 lpDDSurface ); -#endif \ No newline at end of file +#endif From 184b44c386e4f67f0ff13530f4bebe3424948fc1 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Sat, 14 Dec 2024 19:41:19 -0300 Subject: [PATCH 015/118] a couple consistency extension changes iniErrorReport is a log file, all other log files have .log extension, so make it consistent with that make Ja2_settings.ini's extension lowercase. OCD, sorry. --- Ja2/GameSettings.cpp | 2 +- Ja2/jascreens.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index e6ac7a4f..054da671 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -45,7 +45,7 @@ #include #include -#define GAME_SETTINGS_FILE "Ja2_Settings.INI" +#define GAME_SETTINGS_FILE "Ja2_Settings.ini" #define FEATURE_FLAGS_FILE "Ja2_Features.ini" diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index b431dd2e..b1dfe4e8 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -397,7 +397,7 @@ UINT32 InitScreenHandle(void) // Handle queued .ini file error messages int y = 40; sgp::Logger_ID ini_id = sgp::Logger::instance().createLogger(); - sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.txt", false, sgp::Logger::FLUSH_ON_DELETE); + sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.log", false, sgp::Logger::FLUSH_ON_DELETE); sgp::Logger::LogInstance logger = sgp::Logger::instance().logger(ini_id); while (! iniErrorMessages.empty()) { static BOOL iniErrorMessage_create_out_file = TRUE; @@ -407,7 +407,7 @@ UINT32 InitScreenHandle(void) if (iniErrorMessage_create_out_file) { y += 25; - swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.txt has been created." ); + swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.log has been created." ); DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_ORANGE, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED ); iniErrorMessage_create_out_file = FALSE; } From 2fcba8b9f76885018fe03a0686e2a83ed45f87f4 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:54:54 +0100 Subject: [PATCH 016/118] Reworked foodsystem exclusive items: no food items if the food system is off whether the item is exclusive is defined by tag in items.xml replaced previous way of decision, which used Item[usItemIndex].foodtype > 0 as criteria that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.) --- Tactical/Item Types.h | 1 + Tactical/Items.cpp | 13 ++++++++----- Tactical/Items.h | 1 + Utils/XML_Items.cpp | 7 +++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 78f1f5d5..37ba1be2 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -871,6 +871,7 @@ extern OBJECTTYPE gTempObject; #define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments #define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments #define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments +#define ITEM_FoodSystemExclusive 0x0000080000000000 // kitty: item exclusively available with food feature // ---------------------------------------------------------------- diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 10ac4652..5dd52f89 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1271,12 +1271,14 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; - // silversurfer: no food items if the food system is off - if ( !UsingFoodSystem() && Item[ usItemIndex ].foodtype > 0 ) + + // kitty: no food items if the food system is off + // whether the item is exclusive is defined by tag + // replaced previous system which used Item[usItemIndex].foodtype > 0 as criteria + // that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.) + if (!gGameExternalOptions.fFoodSystem && ItemIsOnlyInFood(usItemIndex)) { - // Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. - if ( Food[Item[usItemIndex].foodtype].bFoodPoints > 0 ) - return FALSE; + return FALSE; } // kitty: no disease items if the disease system is off @@ -16128,3 +16130,4 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_Di BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); } BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); } BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); } +BOOLEAN ItemIsOnlyInFood(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_FoodSystemExclusive); } diff --git a/Tactical/Items.h b/Tactical/Items.h index 6aa26659..cf58ac72 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -251,6 +251,7 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem); BOOLEAN ItemProvidesRobotCamo(UINT16 usItem); BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem); BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem); +BOOLEAN ItemIsOnlyInFood(UINT16 usItem); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 412a96fa..d1ecf8a6 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -1592,6 +1592,12 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.iTransportGroupMaxProgress = (INT8)atoi(pData->szCharData); } + else if (strcmp(name, "FoodSystemExclusive") == 0) + { + pData->curElement = ELEMENT; + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_FoodSystemExclusive; + } --pData->maxReadDepth; } @@ -2225,6 +2231,7 @@ BOOLEAN WriteItemStats() if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInFood(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\r\n"); } From 0bd932f20fb4b7408e9c65cf8c1c6818523bf00d Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:13:37 +0100 Subject: [PATCH 017/118] Simplified rework foodsystem allowed items simplified the previous commit, now no more need for a tag when checking IsItemLegal for Food System, ontop of checking for foodpoints, now also check if is drug as a result, as previously, all eatable food will be excluded without food system, but now only if it isn't a drug at the same time and no more tag to check for that in items.xml needed --- Tactical/Item Types.h | 1 - Tactical/Items.cpp | 16 +++++++--------- Tactical/Items.h | 1 - Utils/XML_Items.cpp | 7 ------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 37ba1be2..78f1f5d5 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -871,7 +871,6 @@ extern OBJECTTYPE gTempObject; #define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments #define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments #define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments -#define ITEM_FoodSystemExclusive 0x0000080000000000 // kitty: item exclusively available with food feature // ---------------------------------------------------------------- diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 5dd52f89..1dd9c4c6 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1271,14 +1271,13 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; - - // kitty: no food items if the food system is off - // whether the item is exclusive is defined by tag - // replaced previous system which used Item[usItemIndex].foodtype > 0 as criteria - // that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.) - if (!gGameExternalOptions.fFoodSystem && ItemIsOnlyInFood(usItemIndex)) - { - return FALSE; + // silversurfer: no food items if the food system is off + if (!UsingFoodSystem() && Item[usItemIndex].foodtype > 0) + { + // silversurfer: Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. + // kitty: and only if food isn't a drug at the same time, to make sure using those drugs without food system is possible + if (Food[Item[usItemIndex].foodtype].bFoodPoints > 0 && Item[usItemIndex].drugtype == 0 ) + return FALSE; } // kitty: no disease items if the disease system is off @@ -16130,4 +16129,3 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_Di BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); } BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); } BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); } -BOOLEAN ItemIsOnlyInFood(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_FoodSystemExclusive); } diff --git a/Tactical/Items.h b/Tactical/Items.h index cf58ac72..6aa26659 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -251,7 +251,6 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem); BOOLEAN ItemProvidesRobotCamo(UINT16 usItem); BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem); BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem); -BOOLEAN ItemIsOnlyInFood(UINT16 usItem); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index d1ecf8a6..412a96fa 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -1592,12 +1592,6 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.iTransportGroupMaxProgress = (INT8)atoi(pData->szCharData); } - else if (strcmp(name, "FoodSystemExclusive") == 0) - { - pData->curElement = ELEMENT; - if ((BOOLEAN)atol(pData->szCharData)) - pData->curItem.usItemFlag2 |= ITEM_FoodSystemExclusive; - } --pData->maxReadDepth; } @@ -2231,7 +2225,6 @@ BOOLEAN WriteItemStats() if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInFood(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\r\n"); } From c7d021f5f3dccb024ee9dddac29d25eb03d1ed70 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:04:07 +0200 Subject: [PATCH 018/118] Read updated items.xml format Requires accompanying GameDir change. Removed ItemFlag as an xml tag and added bitmask flags as their own individual tags. Makes modding easier when the flags can be modified without math in the xml files --- Tactical/Item Types.h | 52 ++-- Utils/XML_Items.cpp | 600 +++++++++++++++++++++++++++++------------- 2 files changed, 438 insertions(+), 214 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 78f1f5d5..44a8b23d 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -738,18 +738,18 @@ extern OBJECTTYPE gTempObject; // note that these should not be used to determine what kind of an attachment an item is, that is determined by attachmentclass and the AC_xxx flags above #define BLOOD_BAG 0x00000001 //1 // this item is a blood bag can can be used to boost surgery #define MANPAD 0x00000002 //2 // this item is a MAn-Portable Air-Defense System -#define BEARTRAP 0x00000004 //4 // a mechanical trap that does no explosion, but causes leg damage to whoever activates it +#define BEARTRAP 0x00000004 //4 // a mechanical trap that does no explosion, but causes leg damage to whoever activates it #define CAMERA 0x00000008 //8 #define WATER_DRUM 0x00000010 //16 // water drums allow to refill canteens in the sector they are in #define MEAT_BLOODCAT 0x00000020 //32 // retrieve this by gutting a bloodcat #define MEAT_COW 0x00000040 //64 // retrieve this by gutting a cow -#define BELT_FED 0x00000080 //128 // item can be fed externally +#define BELT_FED 0x00000080 //128 // item can be fed externally #define AMMO_BELT 0x00000100 //256 // this item can be used to feed externally #define AMMO_BELT_VEST 0x00000200 //512 // this is a vest that can contain AMMO_BELT items in its medium slots -#define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo -#define CLEANING_KIT 0x00000800 //2048 // weapon cleaning kit +#define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo +#define CLEANING_KIT 0x00000800 //2048 // weapon cleaning kit #define ATTENTION_ITEM 0x00001000 //4096 // this item is 'interesting' to the AI. Dumb soldiers may try to pick it up #define GAROTTE 0x00002000 //8192 // this item is a garotte @@ -758,18 +758,18 @@ extern OBJECTTYPE gTempObject; #define SKIN_BLOODCAT 0x00010000 //65536 // retrieve this by skinning (=decapitating) a bloodcat #define NO_METAL_DETECTION 0x00020000 //131072 // a planted bomb with this flag can NOT be detected via metal detector. Use sparingly! -#define JUMP_GRENADE 0x00040000 //262144 // add +25 heigth to explosion, used for bouncing grenades and jumping mines +#define JUMP_GRENADE 0x00040000 //262144 // add +25 heigth to explosion, used for bouncing grenades and jumping mines #define HANDCUFFS 0x00080000 //524288 // item can be used to capture soldiers #define TASER 0x00100000 //1048576 // item is a taser, melee hits with this will drain breath (if batteries are supplied) -#define SCUBA_BOTTLE 0x00200000 //2097152 // item is a scuba gear air bottle +#define SCUBA_BOTTLE 0x00200000 //2097152 // item is a scuba gear air bottle #define SCUBA_MASK 0x00400000 //4194304 // item is a scuba gear breathing mask #define SCUBA_FINS 0x00800000 //8388608 // this item speed up swimming, but slows walking and running -#define TRIPWIREROLL 0x01000000 //16777216 // this item is a tripwire roll +#define TRIPWIREROLL 0x01000000 //16777216 // this item is a tripwire roll #define RADIO_SET 0x02000000 //33554432 // item can be used to radio militia/squads in other sectors -#define SIGNAL_SHELL 0x04000000 //67108864 // this is a signal shell that precedes artillery barrages -#define SODA 0x08000000 //134217728 // item is a can of soda, sold in vending machines +#define SIGNAL_SHELL 0x04000000 //67108864 // this is a signal shell that precedes artillery barrages +#define SODA 0x08000000 //134217728 // item is a can of soda, sold in vending machines #define ROOF_COLLAPSE_ITEM 0x10000000 //268435456 // this item is required in the collapsing of roof tiles. It is used internally and should never be seen by the player #define DISEASEPROTECTION_1 0x20000000 //536870912 // this item protects us from getting diseases by human contact if kept in inventory @@ -787,40 +787,40 @@ extern OBJECTTYPE gTempObject; #define ITEM_sinks 0x0000004000000000 #define ITEM_showstatus 0x0000008000000000 -#define ITEM_hiddenaddon 0x0000010000000000 +#define ITEM_hiddenaddon 0x0000010000000000 #define ITEM_twohanded 0x0000020000000000 #define ITEM_notbuyable 0x0000040000000000 #define ITEM_attachment 0x0000080000000000 #define ITEM_hiddenattachment 0x0000100000000000 #define ITEM_biggunlist 0x0000200000000000 -#define ITEM_notineditor 0x0000400000000000 +#define ITEM_notineditor 0x0000400000000000 #define ITEM_defaultundroppable 0x0000800000000000 #define ITEM_unaerodynamic 0x0001000000000000 #define ITEM_electronic 0x0002000000000000 #define ITEM_cannon 0x0004000000000000 -#define ITEM_rocketrifle 0x0008000000000000 +#define ITEM_rocketrifle 0x0008000000000000 #define ITEM_fingerprintid 0x0010000000000000 #define ITEM_metaldetector 0x0020000000000000 -#define ITEM_gasmask 0x0040000000000000 +#define ITEM_gasmask 0x0040000000000000 #define ITEM_lockbomb 0x0080000000000000 #define ITEM_flare 0x0100000000000000 -#define ITEM_grenadelauncher 0x0200000000000000 +#define ITEM_grenadelauncher 0x0200000000000000 #define ITEM_mortar 0x0400000000000000 #define ITEM_duckbill 0x0800000000000000 #define ITEM_detonator 0x1000000000000000 -#define ITEM_remotedetonator 0x2000000000000000 -#define ITEM_hidemuzzleflash 0x4000000000000000 +#define ITEM_remotedetonator 0x2000000000000000 +#define ITEM_hidemuzzleflash 0x4000000000000000 #define ITEM_rocketlauncher 0x8000000000000000 // New UINT64 Item Flag => usItemFlag2 #define ITEM_singleshotrocketlauncher 0x00000001 #define ITEM_brassknuckles 0x00000002 -#define ITEM_crowbar 0x00000004 +#define ITEM_crowbar 0x00000004 #define ITEM_glgrenade 0x00000008 #define ITEM_flakjacket 0x00000010 @@ -829,17 +829,17 @@ extern OBJECTTYPE gTempObject; #define ITEM_needsbatteries 0x00000080 #define ITEM_xray 0x00000100 -#define ITEM_wirecutters 0x00000200 -#define ITEM_toolkit 0x00000400 -#define ITEM_firstaidkit 0x00000800 +#define ITEM_wirecutters 0x00000200 +#define ITEM_toolkit 0x00000400 +#define ITEM_firstaidkit 0x00000800 #define ITEM_medicalkit 0x00001000 -#define ITEM_canteen 0x00002000 -#define ITEM_jar 0x00004000 +#define ITEM_canteen 0x00002000 +#define ITEM_jar 0x00004000 #define ITEM_canandstring 0x00008000 -#define ITEM_marbles 0x00010000 -#define ITEM_walkman 0x00020000 +#define ITEM_marbles 0x00010000 +#define ITEM_walkman 0x00020000 #define ITEM_remotetrigger 0x00040000 #define ITEM_robotremotecontrol 0x00080000 @@ -849,7 +849,7 @@ extern OBJECTTYPE gTempObject; #define ITEM_antitankmine 0x00800000 #define ITEM_hardware 0x01000000 -#define ITEM_medical 0x02000000 +#define ITEM_medical 0x02000000 #define ITEM_gascan 0x04000000 #define ITEM_containsliquid 0x08000000 @@ -863,7 +863,7 @@ extern OBJECTTYPE gTempObject; #define ITEM_tripwireactivation 0x0000000400000000 // item (mine) can be activated by nearby tripwire #define ITEM_tripwire 0x0000000800000000 // item is tripwire -#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting) +#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting) #define ITEM_blockironsight 0x0000002000000000 // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight) #define ITEM_fAllowClimbing 0x0000004000000000 // JMich: BackpackClimb does item allow climbing while wearing it #define ITEM_cigarette 0x0000008000000000 // Flugente: this item can be smoked diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 412a96fa..0373b4aa 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -205,7 +205,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "CamouflageKit") == 0 || strcmp(name, "LocksmithKit") == 0 || strcmp(name, "Mine") == 0 || - strcmp(name, "antitankmine" ) == 0 || + strcmp(name, "AntitankMine" ) == 0 || strcmp(name, "GasCan") == 0 || strcmp(name, "ContainsLiquid") == 0 || strcmp(name, "Rock") == 0 || @@ -248,7 +248,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "RecoilModifierX") == 0 || strcmp(name, "RecoilModifierY") == 0 || strcmp(name, "PercentRecoilModifier") == 0 || - strcmp(name, "barrel") == 0 || + strcmp(name, "Barrel") == 0 || strcmp(name, "usOverheatingCooldownFactor") == 0 || strcmp(name, "overheatTemperatureModificator") == 0 || strcmp(name, "overheatCooldownModificator") == 0 || @@ -284,16 +284,16 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "SleepModifier") == 0 || strcmp(name, "usSpotting") == 0 || strcmp(name, "sBackpackWeightModifier") == 0 || - strcmp(name, "fAllowClimbing") == 0 || + strcmp(name, "AllowClimbing") == 0 || strcmp(name, "cigarette" ) == 0 || strcmp(name, "usPortionSize" ) == 0 || - strcmp(name, "diseaseprotectionface" ) == 0 || - strcmp(name, "diseaseprotectionhand" ) == 0|| + strcmp(name, "DiseaseprotectionFace" ) == 0 || + strcmp(name, "DiseaseprotectionHand" ) == 0|| strcmp(name, "usRiotShieldStrength" ) == 0 || strcmp(name, "usRiotShieldGraphic" ) == 0 || - strcmp(name, "bloodbag" ) == 0 || - strcmp(name, "emptybloodbag" ) == 0 || - strcmp(name, "medicalsplint" ) == 0 || + strcmp(name, "Bloodbag" ) == 0 || + strcmp(name, "EmptyBloodbag" ) == 0 || + strcmp(name, "MedicalSplint" ) == 0 || strcmp(name, "sFireResistance" ) == 0 || strcmp(name, "usAdministrationModifier" ) == 0) || strcmp(name, "RobotDamageReduction") == 0 || @@ -1098,7 +1098,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ((BOOLEAN)atol(pData->szCharData)) pData->curItem.usItemFlag2 |= ITEM_mine; } - else if ( strcmp( name, "antitankmine" ) == 0 ) + else if ( strcmp( name, "AntitankMine" ) == 0 ) { pData->curElement = ELEMENT; if ((BOOLEAN)atol(pData->szCharData)) @@ -1277,7 +1277,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) } // Flugente - else if(strcmp(name, "barrel") == 0) + else if(strcmp(name, "Barrel") == 0) { pData->curElement = ELEMENT; if ((BOOLEAN)atol(pData->szCharData)) @@ -1342,11 +1342,6 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ((BOOLEAN)atol(pData->szCharData)) pData->curItem.usItemFlag2 |= ITEM_blockironsight; } - else if(strcmp(name, "ItemFlag") == 0) - { - pData->curElement = ELEMENT; - pData->curItem.usItemFlag = (UINT64) strtoul(pData->szCharData, NULL, 0); - } else if(strcmp(name, "FoodType") == 0) { pData->curElement = ELEMENT; @@ -1448,7 +1443,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.sBackpackWeightModifier = (INT16)atol(pData->szCharData); } - else if (strcmp(name, "fAllowClimbing") == 0) + else if (strcmp(name, "AllowClimbing") == 0) { pData->curElement = ELEMENT; if ((BOOLEAN)atol(pData->szCharData)) @@ -1466,7 +1461,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curItem.usPortionSize = (UINT8)atol( pData->szCharData ); } // Flugente: simple tags in the xml get translated into flags - else if ( strcmp( name, "diseaseprotectionface" ) == 0 ) + else if ( strcmp( name, "DiseaseprotectionFace" ) == 0 ) { pData->curElement = ELEMENT; BOOLEAN val = (BOOLEAN)atol( pData->szCharData ); @@ -1474,7 +1469,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ( val ) pData->curItem.usItemFlag |= DISEASEPROTECTION_1; } - else if ( strcmp( name, "diseaseprotectionhand" ) == 0 ) + else if ( strcmp( name, "DiseaseprotectionHand" ) == 0 ) { pData->curElement = ELEMENT; BOOLEAN val = (BOOLEAN)atol( pData->szCharData ); @@ -1492,21 +1487,224 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.usRiotShieldGraphic = (UINT16)atol( pData->szCharData ); } - else if ( strcmp( name, "bloodbag" ) == 0 ) + else if ( strcmp( name, "Bloodbag" ) == 0 ) { pData->curElement = ELEMENT; if ( (BOOLEAN)atol( pData->szCharData ) ) pData->curItem.usItemFlag |= BLOOD_BAG; } - else if ( strcmp( name, "emptybloodbag" ) == 0 ) + else if ( strcmp( name, "Manpad" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= MANPAD; + } + else if ( strcmp( name, "Beartrap" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= BEARTRAP; + } + else if ( strcmp( name, "Camera" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CAMERA; + } + else if ( strcmp( name, "Waterdrum" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= WATER_DRUM; + } + else if ( strcmp( name, "BloodcatMeat" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= MEAT_BLOODCAT; + } + else if ( strcmp( name, "CowMeat" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= MEAT_COW; + } + else if ( strcmp( name, "Beltfed" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= BELT_FED; + } + else if ( strcmp( name, "Ammobelt" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= AMMO_BELT; + } + else if ( strcmp( name, "AmmobeltVest" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= AMMO_BELT_VEST; + } + else if ( strcmp( name, "CamoRemoval" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CAMO_REMOVAL; + } + else if ( strcmp( name, "Cleaningkit" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CLEANING_KIT; + } + else if ( strcmp( name, "AttentionItem" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= ATTENTION_ITEM; + } + else if ( strcmp( name, "Garotte" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= GAROTTE; + } + else if ( strcmp( name, "Covert" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= COVERT; + } + else if ( strcmp( name, "Corpse" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CORPSE; + } + else if ( strcmp( name, "BloodcatSkin" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SKIN_BLOODCAT; + } + else if ( strcmp( name, "NoMetalDetection" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= NO_METAL_DETECTION; + } + else if ( strcmp( name, "JumpGrenade" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= JUMP_GRENADE; + } + else if ( strcmp( name, "Handcuffs" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= HANDCUFFS; + } + else if ( strcmp( name, "Taser" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= TASER; + } + else if ( strcmp( name, "ScubaBottle" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SCUBA_BOTTLE; + } + else if ( strcmp( name, "ScubaMask" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SCUBA_MASK; + } + else if ( strcmp( name, "ScubaFins" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SCUBA_FINS; + } + else if ( strcmp( name, "TripwireRoll" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= TRIPWIREROLL; + } + else if ( strcmp( name, "Radioset" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= RADIO_SET; + } + else if ( strcmp( name, "SignalShell" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SIGNAL_SHELL; + } + else if ( strcmp( name, "Soda" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SODA; + } + else if ( strcmp( name, "RoofcollapseItem" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= ROOF_COLLAPSE_ITEM; + } + else if ( strcmp( name, "LBEexplosionproof" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= LBE_EXPLOSIONPROOF; + } + else if ( strcmp( name, "EmptyBloodbag" ) == 0 ) { pData->curElement = ELEMENT; if ( (BOOLEAN)atol( pData->szCharData ) ) pData->curItem.usItemFlag |= EMPTY_BLOOD_BAG; } - else if ( strcmp( name, "medicalsplint" ) == 0 ) + else if ( strcmp( name, "MedicalSplint" ) == 0 ) { pData->curElement = ELEMENT; @@ -1971,153 +2169,88 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\r\n"); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemClass); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasAttachmentClass); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasLayoutClass); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubClassIndex); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCursor); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bSoundType); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasAttachmentClass); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasLayoutClass); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubClassIndex); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCursor); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bSoundType); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubGraphicType); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubGraphicNum); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubWeight); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubPerPocket); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ItemSize); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPrice); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCoolness); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRepairEase); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubWeight); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubPerPocket); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ItemSize); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPrice); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCoolness); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRepairEase); - if (ItemIsDamageable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRepairable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDamagedByWater(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMetal(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemSinks(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (HasItemFlag2(cnt, ITEM_showstatus)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsHiddenAddon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsTwoHanded(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsNotBuyable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsHiddenAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInTonsOfGuns(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInScifi(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInNIV(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsNotInEditor(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsUndroppableByDefault(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsUnaerodynamic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsElectronic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemHasHiddenMuzzleFlash(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubAttachmentSystem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubAttachmentSystem ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].inseparable ); - FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][0] ); - FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][1] ); - FilePrintf(hFile,"\t\t%d\r\n", WeaponROF[cnt]); + FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][0] ); + FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][1] ); + FilePrintf(hFile,"\t\t%d\r\n", WeaponROF[cnt]); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentnoisereduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bipod ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tohitbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].aimbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].minrangeforaimbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentnoisereduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bipod ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tohitbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].aimbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].minrangeforaimbonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].magsizebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rateoffirebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bulletspeedbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].burstsizebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bestlaserrange ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bursttohitbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].autofiretohitbonus); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].APBonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rateoffirebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bulletspeedbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].burstsizebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bestlaserrange ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bursttohitbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].autofiretohitbonus); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].APBonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentburstfireapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentautofireapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreadytimeapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreloadtimeapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentstatusdrainreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentburstfireapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentautofireapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreadytimeapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreloadtimeapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentstatusdrainreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); - if (ItemIsMortar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsSingleShotRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGrenadeLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDuckbill(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGLgrenade(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsATMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRocketRifle(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemHasFingerPrintID(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCannon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); for(UINT8 cnt2 = 0; cnt2 < MAX_DEFAULT_ATTACHMENTS; cnt2++){ if(Item[cnt].defaultattachments[cnt2] != 0){ - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultattachments[cnt2] ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultattachments[cnt2] ); } } - if (ItemIsBrassKnuckles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCrowbar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRock(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bloodieditem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camobonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].urbanCamobonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].desertCamobonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].snowCamobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].urbanCamobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].desertCamobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].snowCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].stealthbonus ); - if (ItemIsFlakJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsLeatherJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRemoteDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRemoteTrigger(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsLockBomb(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsFlare(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRobotRemote(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsWalkman(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsThermalOptics(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGasmask(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hearingrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].visionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nightvisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cavevisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); - FilePrintf(hFile,"\t\t%3.2f\r\n", Item[cnt].alcohol ); - - if (ItemIsHardware(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMedical(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCamoKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsLocksmithKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsToolkit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsFirstAidKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMedicalKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsWirecutters(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCanteen(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGascan(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMarbles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCanAndString(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsJar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemHasXRay(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemNeedsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemContainsLiquid(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMetalDetector(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].visionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nightvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cavevisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); + FilePrintf(hFile,"\t\t%3.2f\r\n", Item[cnt].alcohol ); // HEADROCK HAM 4: Print out new values FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scopemagfactor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].projectionfactor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentaccuracymodifier ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierX ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierY ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].PercentRecoilModifier ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].projectionfactor ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentaccuracymodifier ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierX ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierY ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].PercentRecoilModifier ); // HEADROCK HAM 4: Print out stance-based values FilePrintf(hFile,"\t\t\r\n"); @@ -2130,7 +2263,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].percentdropcompensationmodifier[0] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].maxcounterforcemodifier[0] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].counterforceaccuracymodifier[0] ); - FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[0] ); + FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[0] ); FilePrintf(hFile,"\t\t\r\n"); FilePrintf(hFile,"\t\t\r\n"); @@ -2143,7 +2276,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].percentdropcompensationmodifier[1] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].maxcounterforcemodifier[1] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].counterforceaccuracymodifier[1] ); - FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[1] ); + FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[1] ); FilePrintf(hFile,"\t\t\r\n"); FilePrintf(hFile,"\t\t\r\n"); @@ -2156,58 +2289,42 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].percentdropcompensationmodifier[2] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].maxcounterforcemodifier[2] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].counterforceaccuracymodifier[2] ); - FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[2] ); + FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[2] ); FilePrintf(hFile,"\t\t\r\n"); // Flugente FTW 1.2 - if (ItemIsBarrel(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].usOverheatingCooldownFactor ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatTemperatureModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatCooldownModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatJamThresholdModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatDamageThresholdModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].usOverheatingCooldownFactor ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatTemperatureModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatCooldownModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatJamThresholdModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatDamageThresholdModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].attachmentclass ); - - if (ItemHasTripwireActivation(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsTripwire(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDirectional(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemBlocksIronsight(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemFlag ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].foodtype ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].attachmentclass ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].foodtype ); //JMich_SkillModifiers: Adding the values here as well - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].LockPickModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].LockPickModifier ); FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].CrowbarModifier ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DisarmModifier ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].RepairModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DisarmModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].RepairModifier ); FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].usHackingModifier ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].usBurialModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].usBurialModifier ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usDamageChance ); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].dirtIncreaseFactor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usActionItemFlag ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].clothestype ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].randomitem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usActionItemFlag ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].clothestype ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].randomitem ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].randomitemcoolnessmodificator ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usFlashLightRange ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemChoiceTimeSetting ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usBuddyItem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubSleepModifier ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usSpotting ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sBackpackWeightModifier); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPortionSize ); - - if (ItemAllowsClimbing(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCigarette(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if ( HasItemFlag( cnt, DISEASEPROTECTION_1 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, DISEASEPROTECTION_2 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, BLOOD_BAG) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, EMPTY_BLOOD_BAG ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, MEDICAL_SPLINT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usFlashLightRange ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemChoiceTimeSetting ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usBuddyItem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubSleepModifier ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usSpotting ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sBackpackWeightModifier); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPortionSize ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usRiotShieldStrength ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usRiotShieldGraphic ); @@ -2221,10 +2338,117 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotChassisSkillGrant ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotUtilitySkillGrant ); - if (ItemProvidesRobotCamo(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + // usItemFlag + if ( HasItemFlag( cnt, BLOOD_BAG ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MANPAD ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, BEARTRAP ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CAMERA ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, WATER_DRUM ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MEAT_BLOODCAT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MEAT_COW ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, BELT_FED ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, AMMO_BELT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, AMMO_BELT_VEST ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CAMO_REMOVAL ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CLEANING_KIT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, ATTENTION_ITEM ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, GAROTTE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, COVERT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CORPSE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SKIN_BLOODCAT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, NO_METAL_DETECTION ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, JUMP_GRENADE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, HANDCUFFS ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, TASER ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SCUBA_BOTTLE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SCUBA_MASK ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SCUBA_FINS ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, TRIPWIREROLL ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, RADIO_SET ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SIGNAL_SHELL ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SODA ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, ROOF_COLLAPSE_ITEM ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, DISEASEPROTECTION_1 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, DISEASEPROTECTION_2 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, LBE_EXPLOSIONPROOF ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, EMPTY_BLOOD_BAG ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MEDICAL_SPLINT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDamageable( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRepairable( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDamagedByWater( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMetal( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemSinks( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, ITEM_showstatus ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsHiddenAddon( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsTwoHanded( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsNotBuyable( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsAttachment( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsHiddenAttachment( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInTonsOfGuns( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsNotInEditor( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsUndroppableByDefault( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsUnaerodynamic( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsElectronic( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCannon( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRocketRifle( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasFingerPrintID( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMetalDetector( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGasmask( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsLockBomb( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsFlare( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGrenadeLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMortar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDuckbill( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRemoteDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasHiddenMuzzleFlash( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + + // usItemFlag2 + if ( ItemIsSingleShotRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsBrassKnuckles( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCrowbar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGLgrenade( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsFlakJacket( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsLeatherJacket( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsBatteries( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemNeedsBatteries( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasXRay( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsWirecutters( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsToolkit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsFirstAidKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMedicalKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCanteen( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsJar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCanAndString( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMarbles( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsWalkman( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRemoteTrigger( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRobotRemote( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCamoKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsLocksmithKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMine( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsATMine( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsHardware( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMedical( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGascan( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemContainsLiquid( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRock( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsThermalOptics( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInScifi( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInNIV( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInDisease( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsBarrel( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasTripwireActivation( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsTripwire( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDirectional( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemBlocksIronsight( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemAllowsClimbing( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCigarette( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemProvidesRobotCamo( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemProvidesRobotNightvision( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemProvidesRobotLaserBonus( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + FilePrintf(hFile,"\t\r\n"); } From 7fa8ff930b42550567bf0436972600047d66d628 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:16:22 +0200 Subject: [PATCH 019/118] Remove unused tag PercentCounterForceFrequency is never read from items.xml and INVTYPE doesn't have a field for it either --- Utils/XML_Items.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 0373b4aa..a92ce594 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -353,7 +353,6 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "PercentDropCompensation") == 0 || strcmp(name, "PercentMaxCounterForce") == 0 || strcmp(name, "PercentCounterForceAccuracy") == 0 || - strcmp(name, "PercentCounterForceFrequency") == 0 || strcmp(name, "AimLevels") == 0)) { pData->curElement = ELEMENT_SUBLIST_PROPERTY; From a580052e40c3c92c6ecda00b0110c4ce82779cd1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 19:24:40 +0200 Subject: [PATCH 020/118] Read new tags Maybe *this* time it'll finally be fixed. Sigh... --- Utils/XML_Items.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index a92ce594..0b2c3c91 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -291,7 +291,36 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "DiseaseprotectionHand" ) == 0|| strcmp(name, "usRiotShieldStrength" ) == 0 || strcmp(name, "usRiotShieldGraphic" ) == 0 || - strcmp(name, "Bloodbag" ) == 0 || + strcmp(name, "Bloodbag") == 0 || + strcmp(name, "Manpad" ) == 0 || + strcmp(name, "Beartrap") == 0 || + strcmp(name, "Camera") == 0 || + strcmp(name, "Waterdrum") == 0 || + strcmp(name, "BloodcatMeat") == 0 || + strcmp(name, "CowMeat") == 0 || + strcmp(name, "Beltfed") == 0 || + strcmp(name, "Ammobelt") == 0 || + strcmp(name, "AmmobeltVest") == 0 || + strcmp(name, "CamoRemoval") == 0 || + strcmp(name, "Cleaningkit") == 0 || + strcmp(name, "AttentionItem") == 0 || + strcmp(name, "Garotte") == 0 || + strcmp(name, "Covert") == 0 || + strcmp(name, "Corpse") == 0 || + strcmp(name, "BloodcatSkin") == 0 || + strcmp(name, "NoMetalDetection") == 0 || + strcmp(name, "JumpGrenade") == 0 || + strcmp(name, "Handcuffs") == 0 || + strcmp(name, "Taser") == 0 || + strcmp(name, "ScubaBottle") == 0 || + strcmp(name, "ScubaMask") == 0 || + strcmp(name, "ScubaFins") == 0 || + strcmp(name, "TripwireRoll") == 0 || + strcmp(name, "Radioset") == 0 || + strcmp(name, "SignalShell") == 0 || + strcmp(name, "Soda") == 0 || + strcmp(name, "RoofcollapseItem") == 0 || + strcmp(name, "LBEexplosionproof") == 0 || strcmp(name, "EmptyBloodbag" ) == 0 || strcmp(name, "MedicalSplint" ) == 0 || strcmp(name, "sFireResistance" ) == 0 || From c88fbbe7495fcbc683de4f5cc7a372829c0ec110 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:40:10 +0200 Subject: [PATCH 021/118] Fix assertion error due to too long filenames --- Editor/LoadScreen.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Editor/LoadScreen.cpp b/Editor/LoadScreen.cpp index 7c7d70b4..cba550c2 100644 --- a/Editor/LoadScreen.cpp +++ b/Editor/LoadScreen.cpp @@ -173,7 +173,15 @@ void LoadSaveScreenEntry() vfs::CVirtualProfile* prof = it.value(); memset(&FileInfo, 0, sizeof(GETFILESTRUCT)); strcpy(FileInfo.zFileName, "< "); - strcat(FileInfo.zFileName, prof->cName.utf8().c_str()); + // Cut filename off if it's too long for the buffer + if (strlen(prof->cName.utf8().c_str()) > FILENAME_BUFLEN-4) + { + strncpy(FileInfo.zFileName+1, prof->cName.utf8().c_str(), FILENAME_BUFLEN-4); + } + else + { + strcat(FileInfo.zFileName, prof->cName.utf8().c_str()); + } strcat(FileInfo.zFileName, " >"); FileInfo.zFileName[FILENAME_BUFLEN] = 0; FileInfo.uiFileAttribs = FILE_IS_DIRECTORY; From eb7837bc3ebf61697484f6995be93f83d404bff5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:41:02 +0200 Subject: [PATCH 022/118] Increase filename buffer length The mapeditor filedialog is big enough to show longer filenames than 20 characters. --- Editor/LoadScreen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/LoadScreen.h b/Editor/LoadScreen.h index c8adac4c..24518194 100644 --- a/Editor/LoadScreen.h +++ b/Editor/LoadScreen.h @@ -1,7 +1,7 @@ #include "BuildDefines.h" #include "Fileman.h" -#define FILENAME_BUFLEN (20 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213 +#define FILENAME_BUFLEN (30 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213 #ifdef JA2EDITOR From 5b966b4df99fd0bebd9002a21101483aed9c90be Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:54:22 +0200 Subject: [PATCH 023/118] Provide MAX_TACTICAL_ENEMIES to lua --- Strategic/UndergroundInit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Strategic/UndergroundInit.cpp b/Strategic/UndergroundInit.cpp index a5ea0904..d6b8c410 100644 --- a/Strategic/UndergroundInit.cpp +++ b/Strategic/UndergroundInit.cpp @@ -64,6 +64,7 @@ BOOLEAN LuaUnderground::InitializeSectorList() .TableOpen() .TParam("difficultyLevel", int(gGameOptions.ubDifficultyLevel)) .TParam("gameStyle", int(gGameOptions.ubGameStyle)) + .TParam("maxTacticalEnemies", int(gGameExternalOptions.ubGameMaximumNumberOfEnemies)) .TableClose(); SGP_THROW_IFFALSE(initsectorlist_func.Call(1), "call to lua function BuildUndergroundSectorList failed"); From f4f48f23c79209a0dab05d79e0369437aaf6c0e2 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Tue, 24 Dec 2024 02:52:48 -0300 Subject: [PATCH 024/118] cmake: favor vertical layout and absolute paths for include_directories just the way git works should tilt us towards tall code rather than very long lines, easier for merging/conflicts --- CMakeLists.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e70ac481..403a2f55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,23 @@ set(usingMsBuild $) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE) -include_directories(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console) +include_directories( + "${CMAKE_SOURCE_DIR}/Ja2" + "${CMAKE_SOURCE_DIR}/ext/VFS/include" + "${CMAKE_SOURCE_DIR}/Utils" + "${CMAKE_SOURCE_DIR}/TileEngine" + "${CMAKE_SOURCE_DIR}/TacticalAI" + "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" + "${CMAKE_SOURCE_DIR}/Tactical" + "${CMAKE_SOURCE_DIR}/Strategic" + "${CMAKE_SOURCE_DIR}/sgp" + "${CMAKE_SOURCE_DIR}/Ja2/Res" + "${CMAKE_SOURCE_DIR}/Lua" + "${CMAKE_SOURCE_DIR}/Laptop" + "${CMAKE_SOURCE_DIR}/Multiplayer" + "${CMAKE_SOURCE_DIR}/Editor" + "${CMAKE_SOURCE_DIR}/Console" +) # external libraries add_subdirectory("ext/libpng") From c30b1c1b25a10a031e285400976145a327d64e23 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Dec 2024 22:45:31 +0200 Subject: [PATCH 025/118] Reimplement UB pricing for AIM --- Laptop/AimMembers.cpp | 96 ++++++++++++++++++++++++++++++++++++------ Utils/Text.h | 1 + Utils/_ChineseText.cpp | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 1 + 10 files changed, 92 insertions(+), 13 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index aa045033..02d806cb 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -148,10 +148,16 @@ #define FEE_X PRICE_X + 7 #define FEE_Y NAME_Y #define FEE_WIDTH 37 +#define FEE_X_UB PRICE_X + 40 +#define FEE_Y_UB STATS_Y + 28 +#define FEE_Y_UB_NSGI STATS_Y #define AIM_CONTRACT_X PRICE_X + 51 #define AIM_CONTRACT_Y FEE_Y #define AIM_CONTRACT_WIDTH 59 +#define AIM_CONTRACT_X_UB PRICE_X + 19 +#define AIM_OFFER_X PRICE_X + 3 +#define AIM_OFFER_WIDTH 110 #define ONEDAY_X AIM_CONTRACT_X #define ONEWEEK_X AIM_CONTRACT_X @@ -1120,7 +1126,13 @@ BOOLEAN RenderAIMMembers() UpdateMercInfo(); + //Display AIM Member text + DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + //Draw fee & contract +#ifdef JA2UB + DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); +#else DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X_NSGI, FEE_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X_NSGI, AIM_CONTRACT_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -1129,9 +1141,6 @@ BOOLEAN RenderAIMMembers() DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X_NSGI, MARKSMAN_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X_NSGI, MECHANAICAL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); - //Display AIM Member text - DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //Display Option Gear Cost text DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_MEMBER_OPTIONAL_GEAR_X_NSGI, EXPLOSIVE_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -1140,6 +1149,7 @@ BOOLEAN RenderAIMMembers() InsertDollarSignInToString( wTemp ); uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X_NSGI + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_M_FONT_STATIC_TEXT) + 5; DrawTextToScreen(wTemp, AIM_MEMBER_OPTIONAL_GEAR_COST_X_NSGI, EXPLOSIVE_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); +#endif // JA2UB } else { @@ -1163,6 +1173,12 @@ BOOLEAN RenderAIMMembers() UpdateMercInfo(); + //Display AIM Member text + DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + +#ifdef JA2UB + DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); +#else //Draw fee & contract DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X, FEE_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X, AIM_CONTRACT_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -1172,9 +1188,6 @@ BOOLEAN RenderAIMMembers() DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X, MARKSMAN_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X, MECHANAICAL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); - //Display AIM Member text - DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //Display Option Gear Cost text DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_MEMBER_OPTIONAL_GEAR_X, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); @@ -1183,6 +1196,7 @@ BOOLEAN RenderAIMMembers() InsertDollarSignInToString( wTemp ); uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_M_FONT_STATIC_TEXT) + 5; DrawTextToScreen(wTemp, uiPosX, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); +#endif } DisableAimButton(); @@ -1309,6 +1323,10 @@ BOOLEAN UpdateMercInfo(void) if(gGameExternalOptions.gfUseNewStartingGearInterface) { +#ifdef JA2UB + DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X_UB, FEE_Y_UB_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT); + DisplayWrappedString(AIM_OFFER_X, AGILITY_Y_NSGI, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +#else //Display the salaries DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH_NSGI, FEE_X_NSGI, HEALTH_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH_NSGI, FEE_X_NSGI, AGILITY_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); @@ -1335,6 +1353,8 @@ BOOLEAN UpdateMercInfo(void) else DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X_NSGI, AIM_MEDICAL_DEPOSIT_Y_NSGI, AIM_MEDICAL_DEPOSIT_WIDTH_NSGI, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } +#endif // JA2UB + if(!g_bUseXML_Strings) { // LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); @@ -1363,6 +1383,10 @@ BOOLEAN UpdateMercInfo(void) } else { +#ifdef JA2UB + DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X_UB, FEE_Y_UB, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT); + DisplayWrappedString(AIM_OFFER_X, AGILITY_Y, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +#else //Display the salaries DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH, FEE_X, HEALTH_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X, AGILITY_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); @@ -1389,6 +1413,7 @@ BOOLEAN UpdateMercInfo(void) else DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } +#endif if(!g_bUseXML_Strings) { // LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); @@ -2528,6 +2553,21 @@ BOOLEAN DisplayVideoConferencingDisplay() DisplayMercChargeAmount(); +#ifdef JA2UB + if (gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE) + { + CHAR16 offerText[190]; + swprintf(offerText, zNewTacticalMessages[TACT_MSG__AIMMEMBER_ONE_TIME_FEE], gMercProfiles[gbCurrentSoldier].zNickname); + const auto xCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_X + 115; + const auto yCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_Y + 45; + const auto textAreaWidth = 245; + SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); + DisplayWrappedString(xCoord, yCoord, textAreaWidth, 2, AIM_M_FONT_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, offerText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + SetFontShadow(DEFAULT_SHADOW); + } +#endif // JA2UB + + // if( gfMercIsTalking && !gfIsAnsweringMachineActive) if( gfMercIsTalking && gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) { @@ -2577,6 +2617,9 @@ BOOLEAN DisplayMercsVideoFace() void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) { +#ifdef JA2UB + return; +#else UINT16 i, usPosY, usPosX; //First draw the select light for the contract length buttons @@ -2630,6 +2673,8 @@ void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; } InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + +#endif // JA2UB } @@ -2653,7 +2698,10 @@ UINT32 DisplayMercChargeAmount() giContractAmount = 0; //the contract charge amount - +#ifdef JA2UB + // Special offer for a limited time! Act fast! + giContractAmount = gMercProfiles[gbCurrentSoldier].uiWeeklySalary; +#else // Get the salary rate if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY) giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary; @@ -2675,6 +2723,7 @@ UINT32 DisplayMercChargeAmount() { giContractAmount += gMercProfiles[gbCurrentSoldier].usOptionalGearCost; } +#endif } @@ -2685,10 +2734,15 @@ UINT32 DisplayMercChargeAmount() //if the merc hasnt just been hired // if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) { +#ifdef JA2UB + // Don't even have to pay for medical insurance! What a DEAL! + swprintf(wTemp, L"%s", wDollarTemp); +#else if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) swprintf(wTemp, L"%s %s", wDollarTemp, VideoConfercingText[AIM_MEMBER_WITH_MEDICAL] ); else swprintf(wTemp, L"%s", wDollarTemp ); +#endif // JA2UB DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X+1, AIM_CONTRACT_CHARGE_AMOUNNT_Y+3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } @@ -3887,14 +3941,14 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) MSYS_DisableRegion(&gSelectedShutUpMercRegion); //Enable the ability to click on the BIG face to go to different screen - MSYS_EnableRegion(&gSelectedFaceRegion); + MSYS_EnableRegion(&gSelectedFaceRegion); // EnableDisableCurrentVideoConferenceButtons(FALSE); - if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) - { - // Enable the current video conference buttons - EnableDisableCurrentVideoConferenceButtons(FALSE); - } + if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Enable the current video conference buttons + EnableDisableCurrentVideoConferenceButtons(FALSE); + } fVideoConferenceCreated = FALSE; @@ -4085,6 +4139,22 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) // InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT); DelayMercSpeech( gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT, 750, TRUE, FALSE ); + +#ifdef JA2UB + // Disable and hide contract length & gear purchase buttons + gfBuyEquipment = TRUE; + for (size_t i = 0; i < 3; i++) + { + DisableButton(giContractLengthButton[i]); + HideButton(giContractLengthButton[i]); + + if (i < 2) + { + DisableButton(giBuyEquipmentButton[i]); + HideButton(giBuyEquipmentButton[i]); + } + } +#endif // JA2UB } diff --git a/Utils/Text.h b/Utils/Text.h index e2c3251c..a71e194d 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -1624,6 +1624,7 @@ enum AIM_MEMBER_GEAR_KIT_THREE, AIM_MEMBER_GEAR_KIT_FOUR, AIM_MEMBER_GEAR_KIT_FIVE, + AIM_MEMBER_UB_MISSION_FEE, TEXT_NUM_AIM_MEMBER_CHARINFO, }; extern STR16 CharacterInfo[]; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 30fd7ce4..46845d9d 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -5916,6 +5916,7 @@ STR16 CharacterInfo[] = L"装备3", // Text on Starting Gear Selection Button 3 L"装备4", // Text on Starting Gear Selection Button 4 L"装备5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 4c56a70b..c6ddf46a 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -5919,6 +5919,7 @@ STR16 CharacterInfo[] = L"Uitrusting 3", // Text on Starting Gear Selection Button 3 L"Uitrusting 4", // Text on Starting Gear Selection Button 4 L"Uitrusting 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 820bef40..91d15743 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -5916,6 +5916,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 77fc295f..fb8e314b 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -5923,6 +5923,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 62bc2deb..721d099f 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -5827,6 +5827,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; //Aim Member.c diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 1968ae29..58a63f5c 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -5905,6 +5905,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 379f3f5a..860c2887 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -5919,6 +5919,7 @@ STR16 CharacterInfo[] = L"Zestaw nr 3", // Text on Starting Gear Selection Button 3 L"Zestaw nr 4", // Text on Starting Gear Selection Button 4 L"Zestaw nr 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 9b9b99e2..62b72e2f 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -5912,6 +5912,7 @@ STR16 CharacterInfo[] = L"Набор 3", // Text on Starting Gear Selection Button 3 L"Набор 4", // Text on Starting Gear Selection Button 4 L"Набор 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; From a9ab60e5e5b5a5e5aa5603fa4222aca209f039c3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 17:31:42 +0200 Subject: [PATCH 026/118] Fix road tiles for big maps --- Editor/Road Smoothing.cpp | 40 +++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp index 5f7376f5..26787509 100644 --- a/Editor/Road Smoothing.cpp +++ b/Editor/Road Smoothing.cpp @@ -403,14 +403,42 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ) while( gRoadMacros[ i ].sMacroID == iMacroID ) { // need to recalc MACROSTRUCT::sOffset 'cause it sticked to 160*160 old map size - INT32 sdX = gRoadMacros[ i ].sOffset % OLD_WORLD_COLS; - INT32 sdY = gRoadMacros[ i ].sOffset / OLD_WORLD_COLS; - INT32 sOffset = sdY*WORLD_COLS + sdX; + INT32 sdY = gRoadMacros[ i ].sOffset / (OLD_WORLD_COLS); + INT32 sdX = gRoadMacros[ i ].sOffset - (sdY*OLD_WORLD_COLS); + + // Take into account the dfference between old and new row size for tiles that are shifted + // by one row due to X offset + // For example: + // {RBR, 159}, + //{ RBR, -159 }, + // + // Offsets for 160x160 map + // [] [] [-159] + // [] [0] [] + // [159] [] [] // - AddToUndoList( iMapIndex + sOffset ); - RemoveAllObjectsOfTypeRange( iMapIndex + sOffset, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); + // Converted to 200x200 map + // [] [] [-199] + // [] [0] [] + // [199] [] [] + // + // Without this the original conversion would output 159 and -159 for X coordinate + if (sdX < -OLD_WORLD_COLS/2) + { + sdX -= WORLD_COLS - OLD_WORLD_COLS; + } + else if (sdX > OLD_WORLD_COLS / 2) + { + sdX += WORLD_COLS - OLD_WORLD_COLS; + } + + INT32 sOffset = sdY*WORLD_COLS + sdX; + INT32 newGridNo = iMapIndex + sOffset; + + AddToUndoList( newGridNo ); + RemoveAllObjectsOfTypeRange( newGridNo, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex ); - AddObjectToHead( iMapIndex + sOffset, usTileIndex ); + AddObjectToHead( newGridNo, usTileIndex ); i++; } } From 22af6e8ec8fe94fb7405a1f3163b54427d955f7f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:09:33 +0200 Subject: [PATCH 027/118] Implement mousewheel scroll for selection window --- Editor/editscreen.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 1cd2ceb3..8fa8204f 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -2954,6 +2954,23 @@ UINT32 WaitForSelectionWindowResponse( void ) } } + // Mousewheel scroll + if (_WheelValue > 0) + { + while (_WheelValue--) + { + ScrollSelWinUp(); + } + } + else + { + while (_WheelValue++) + { + ScrollSelWinDown(); + } + } + _WheelValue = 0; + if ( DoWindowSelection( ) ) { fSelectionWindow = FALSE; From 5499d1fba2bfb3c588f6536d29cc0acf88bce21a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:09:45 +0200 Subject: [PATCH 028/118] Whitespace formatting --- Editor/editscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 8fa8204f..64eba6c4 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -1,4 +1,4 @@ - #include "builddefines.h" +#include "builddefines.h" #ifdef JA2EDITOR From 4ed7b1fb987cdf42c86599b3c776324f50c6a116 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:02:01 +0200 Subject: [PATCH 029/118] Increase selection window size --- Editor/selectwin.cpp | 96 +++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 36 deletions(-) diff --git a/Editor/selectwin.cpp b/Editor/selectwin.cpp index 06ee221b..baf826a4 100644 --- a/Editor/selectwin.cpp +++ b/Editor/selectwin.cpp @@ -29,6 +29,16 @@ extern BOOLEAN fDontUseRandom; extern UINT16 GenericButtonFillColors[40]; +struct SelectionWindow +{ + SGPRect window; + SGPPoint displayAreaStart; // Area where selectable items are drawn + SGPPoint displayAreaEnd; + SGPPoint spacing; // For displayed items +}; + +SelectionWindow gSelection; + BOOLEAN gfRenderSquareArea = FALSE; INT16 iStartClickX,iStartClickY; INT16 iEndClickX,iEndClickY; @@ -40,7 +50,6 @@ INT32 iSelectWin,iCancelWin,iScrollUp,iScrollDown,iOkWin; BOOLEAN fAllDone=FALSE; BOOLEAN fButtonsPresent=FALSE; -SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint; //These definitions help define the start and end of the various wall indices. //This needs to be maintained if the walls change. @@ -172,6 +181,30 @@ UINT16 SelWinHilightFillColor = 0x23BA; //blue, formerly 0x000d a kind of mediu // void CreateJA2SelectionWindow( INT16 sWhat ) { + auto selectWinWidth = 600; + const auto selectWinHeight = SCREEN_HEIGHT - 120; // From top edge to taskbar + if (iResolution > _800x600) + { + selectWinWidth = 900; + } + auto tlX = 0; + auto tlY = 0; + auto brX = tlX + selectWinWidth; + auto brY = tlY + selectWinHeight; + gSelection.window.iLeft = tlX; + gSelection.window.iTop = tlY; + gSelection.window.iRight = brX; + gSelection.window.iBottom = brY; + gSelection.displayAreaStart.iX = tlX + 1; + gSelection.displayAreaStart.iY = tlY + 15; + gSelection.displayAreaEnd.iX = brX - 1; + gSelection.displayAreaEnd.iY= brY - 1; + gSelection.spacing.iX = 2; + gSelection.spacing.iY = 2; + + iTopWinCutOff = gSelection.displayAreaStart.iY; + iBotWinCutOff = gSelection.displayAreaEnd.iY; + DisplaySpec *pDSpec; UINT16 usNSpecs; @@ -185,32 +218,33 @@ void CreateJA2SelectionWindow( INT16 sWhat ) iButtonIcons[ SEL_WIN_DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" ); iButtonIcons[ SEL_WIN_OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" ); - iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH, + + iSelectWin = CreateHotSpot(0, 0, selectWinWidth, selectWinHeight, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, SelWinClkCallback); iOkWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_OK_ICON], 0, - BUTTON_USE_DEFAULT, 600, 0, + BUTTON_USE_DEFAULT, selectWinWidth, 0, 40, 40, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, OkClkCallback); SetButtonFastHelpText(iOkWin,pDisplaySelectionWindowButtonText[0]); iCancelWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_CANCEL_ICON], 0, - BUTTON_USE_DEFAULT, 600, 40, + BUTTON_USE_DEFAULT, selectWinWidth, 40, 40, 40, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, CnclClkCallback); SetButtonFastHelpText(iCancelWin,pDisplaySelectionWindowButtonText[1]); iScrollUp = CreateIconButton((INT16)iButtonIcons[SEL_WIN_UP_ICON], 0, - BUTTON_USE_DEFAULT, 600, 80, + BUTTON_USE_DEFAULT, selectWinWidth, 80, 40, 160, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, UpClkCallback); SetButtonFastHelpText(iScrollUp,pDisplaySelectionWindowButtonText[2]); iScrollDown = CreateIconButton((INT16)iButtonIcons[SEL_WIN_DOWN_ICON], 0, - BUTTON_USE_DEFAULT, 600, 240, + BUTTON_USE_DEFAULT, selectWinWidth, 240, 40, 160, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DwnClkCallback); @@ -218,18 +252,6 @@ void CreateJA2SelectionWindow( INT16 sWhat ) fButtonsPresent = TRUE; - SelWinSpacing.iX = 2; - SelWinSpacing.iY = 2; - - SelWinStartPoint.iX = 1; - SelWinStartPoint.iY = 15; - - iTopWinCutOff = 15; - - SelWinEndPoint.iX = 599; - SelWinEndPoint.iY = 359; - - iBotWinCutOff = 359; switch( sWhat ) { @@ -347,8 +369,8 @@ void CreateJA2SelectionWindow( INT16 sWhat ) return; } - BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, - &SelWinSpacing, CLEAR_BACKGROUND); + BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &gSelection.displayAreaStart , &gSelection.displayAreaEnd, + &gSelection.spacing, CLEAR_BACKGROUND); } @@ -849,12 +871,14 @@ void RenderSelectionWindow( void ) return; ColorFillVideoSurfaceArea(FRAME_BUFFER, - 0, 0, 600, 400, - GenericButtonFillColors[0]); + gSelection.window.iLeft, gSelection.window.iTop, gSelection.window.iRight, gSelection.window.iBottom, + GenericButtonFillColors[0] + ); DrawSelections( ); MarkButtonsDirty(); RenderButtons( ); + // Draw selection rectangle if ( gfRenderSquareArea ) { button = ButtonList[iSelectWin]; @@ -862,7 +886,7 @@ void RenderSelectionWindow( void ) return; if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) || - (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) ) + (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY)) > 9) ) { // iSX = (INT32)iStartClickX; // iEX = (INT32)button->Area.MouseXPos; @@ -870,7 +894,7 @@ void RenderSelectionWindow( void ) // iEY = (INT32)(button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY); iSX = iStartClickX; - iSY = iStartClickY - iTopWinCutOff + SelWinStartPoint.iY; + iSY = iStartClickY - iTopWinCutOff + gSelection.displayAreaStart.iY; iEX = gusMouseXPos; iEY = gusMouseYPos; @@ -889,10 +913,10 @@ void RenderSelectionWindow( void ) iEY ^= iSY; } - iEX = min( iEX, 600 ); - iSY = max( SelWinStartPoint.iY, iSY ); - iEY = min( 359, iEY ); - iEY = max( SelWinStartPoint.iY, iEY ); + iEX = min( gSelection.displayAreaEnd.iX, iEX); + iSY = max( gSelection.displayAreaStart.iY, iSY ); + iEY = min( gSelection.displayAreaEnd.iY, iEY ); + iEY = max( gSelection.displayAreaStart.iY, iEY ); usFillColor = Get16BPPColor(FROMRGB(255, usFillGreen, 0)); usFillGreen += usDir; @@ -928,7 +952,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason ) return; iClickX = button->Area.MouseXPos; - iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; + iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY; if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { @@ -1035,9 +1059,9 @@ void DisplaySelectionWindowGraphicalInformation() UINT16 y; //Determine if there is a valid picture at cursor position. //iRelX = gusMouseXPos; - //iRelY = gusMouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; + //iRelY = gusMouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY; - y = gusMouseYPos + iTopWinCutOff - (UINT16)SelWinStartPoint.iY; + y = gusMouseYPos + iTopWinCutOff - (UINT16)gSelection.displayAreaStart.iY; pNode = pDispList; fDone = FALSE; while( (pNode != NULL) && !fDone ) @@ -1470,10 +1494,10 @@ void DrawSelections( void ) { SGPRect ClipRect, NewRect; - NewRect.iLeft = SelWinStartPoint.iX; - NewRect.iTop = SelWinStartPoint.iY; - NewRect.iRight = SelWinEndPoint.iX; - NewRect.iBottom = SelWinEndPoint.iY; + NewRect.iLeft = gSelection.displayAreaStart.iX; + NewRect.iTop = gSelection.displayAreaStart.iY; + NewRect.iRight = gSelection.displayAreaEnd.iX; + NewRect.iBottom = gSelection.displayAreaEnd.iY; GetClippingRect(&ClipRect); SetClippingRect(&NewRect); @@ -1483,7 +1507,7 @@ void DrawSelections( void ) SetObjectShade( gvoLargeFontType1, 0 ); // SetObjectShade( gvoLargeFont, 0 ); - DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND ); + DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &gSelection.displayAreaStart, CLEAR_BACKGROUND ); SetObjectShade( gvoLargeFontType1, 4 ); From 6b9997b9c59655e8688bc28679f9facbb86520ef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:11:31 -0300 Subject: [PATCH 030/118] we don't use USE_CODE_PAGE anymore --- Laptop/IMP Begin Screen.cpp | 4 ---- Utils/Text Input.cpp | 20 -------------------- sgp/sgp.cpp | 30 ------------------------------ 3 files changed, 54 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index c140ee92..846666ec 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -577,7 +577,6 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) if( uiKey != '#') #else - #ifndef USE_CODE_PAGE if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || @@ -585,9 +584,6 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) uiKey == ' ' || uiKey == '"' || uiKey == 39 // This is ' which cannot be written explicitly here of course ) - #else - if( charSet::IsFromSet( uiKey, charSet::CS_SPACE|charSet::CS_ALPHA_NUM|charSet::CS_SPECIAL_ALPHA ) ) - #endif #endif { // if the current string position is at max or great, do nothing diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index 3efcb415..7f403388 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -937,11 +937,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) UINT32 key = Event->usParam; UINT16 type = gpActive->usInputType; //Handle space key -#ifndef USE_CODE_PAGE if( key == SPACE && type & INPUTTYPE_SPACES ) -#else - if( charSet::IsFromSet(key, charSet::CS_SPACE) && type & INPUTTYPE_SPACES ) -#endif { AddChar( key ); return TRUE; @@ -953,11 +949,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) return TRUE; } //Handle numerics -#ifndef USE_CODE_PAGE if( key >= '0' && key <= '9' && type & INPUTTYPE_NUMERICSTRICT ) -#else - if( charSet::IsFromSet(key, charSet::CS_NUMERIC) && type & INPUTTYPE_NUMERICSTRICT ) -#endif { AddChar( key ); return TRUE; @@ -965,22 +957,14 @@ BOOLEAN HandleTextInput( InputAtom *Event ) //Handle alphas if( type & INPUTTYPE_ALPHA ) { -#ifndef USE_CODE_PAGE if( key >= 'A' && key <= 'Z' ) -#else - if( charSet::IsFromSet(key, charSet::CS_ALPHA_UC) ) -#endif { if( type & INPUTTYPE_LOWERCASE ) key -= 32; // won't work for non-ascii alpha characters AddChar( key ); return TRUE; } -#ifndef USE_CODE_PAGE if( key >= 'a' && key <= 'z' ) -#else - if( charSet::IsFromSet(key, charSet::CS_ALPHA_LC) ) -#endif { if( type & INPUTTYPE_UPPERCASE ) key += 32; // won't work for non-ascii alpha characters @@ -992,14 +976,10 @@ BOOLEAN HandleTextInput( InputAtom *Event ) if( type & INPUTTYPE_SPECIAL ) { //More can be added, but not all of the fonts support these -#ifndef USE_CODE_PAGE if( key >= 0x21 && key <= 0x2f || // ! " # $ % & ' ( ) * + , - . / key >= 0x3a && key <= 0x40 || // : ; < = > ? @ key >= 0x5b && key <= 0x5f || // [ \ ] ^ _ key >= 0x7b && key <= 0x7d ) // { | } -#else - if( charSet::IsFromSet(key, charSet::CS_SPECIAL_ALPHA|charSet::CS_SPECIAL_NON_CHAR) ) -#endif { AddChar( key ); return TRUE; diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index 6686d637..de26331d 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -367,14 +367,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WM_SYSKEYDOWN: case WM_KEYDOWN: -#ifdef USE_CODE_PAGE - if(s_DebugKeyboardInput) - { - static vfs::Log& debugKeys = *vfs::Log::Create(L"DebugKeys.txt"); - static int input_counter = 1; - debugKeys << (input_counter++) << " : " << (int)wParam << vfs::Log::endl; - } -#endif // USE_CODE_PAGE KeyDown(wParam, lParam); gfSGPInputReceived = TRUE; break; @@ -514,24 +506,6 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) } } -#ifdef USE_CODE_PAGE - charSet::InitializeCharSets(); - - if(!s_CodePage.empty()) - { - try - { - CodePageReader cpr; - cpr.ReadCodePage(s_CodePage); - } - catch(std::exception& ex) - { - std::wstringstream wss; - wss << L"Could not process codepage file \"" << s_CodePage() << L"\""; - SGP_RETHROW(wss.str().c_str(), ex); - } - } -#endif // USE_CODE_PAGE if(g_bUseXML_Strings) { @@ -1255,10 +1229,6 @@ void GetRuntimeSettings( ) // haydent: mouse scrolling iDisableMouseScrolling = (int)oProps.getIntProperty("Ja2 Settings","DISABLE_MOUSE_SCROLLING", iDisableMouseScrolling); -#ifdef USE_CODE_PAGE - s_DebugKeyboardInput = oProps.getBoolProperty(L"Ja2 Settings", L"DEBUG_KEYS", false); - s_CodePage = oProps.getStringProperty(L"Ja2 Settings", L"CODE_PAGE"); -#endif // USE_CODE_PAGE // WANNE: Highspeed Timer always ON (no more optional in the ja2.ini) // get timer/clock initialization state From 0993789430b0f493375680aabfb4da967f827910 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:00:41 -0300 Subject: [PATCH 031/118] remove Language Defines file we don't do it like that anymore, the build system takes care of it --- Ja2/CMakeLists.txt | 1 - Ja2/Language Defines.cpp | 21 ------- Ja2/Language Defines.h | 119 --------------------------------------- 3 files changed, 141 deletions(-) delete mode 100644 Ja2/Language Defines.cpp delete mode 100644 Ja2/Language Defines.h diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index d4b60792..7f8806f9 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -14,7 +14,6 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp" diff --git a/Ja2/Language Defines.cpp b/Ja2/Language Defines.cpp deleted file mode 100644 index 2c7be02d..00000000 --- a/Ja2/Language Defines.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Language Defines.h" - -#if defined(ENGLISH) -# pragma message(" (Language set to ENGLISH, You'll need english CDs)") -#elif defined(GERMAN) -# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)") -#elif defined(RUSSIAN) -# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)") -#elif defined(DUTCH) -# pragma message(" (Language set to DUTCH, You'll need dutch CDs)") -#elif defined(POLISH) -# pragma message(" (Language set to POLISH, You'll need polish CDs)") -#elif defined(FRENCH) -# pragma message(" (Language set to FRENCH, You'll need french CDs)") -#elif defined(ITALIAN) -# pragma message(" (Language set to ITALIAN, You'll need italian CDs)") -#elif defined(CHINESE) -# pragma message(" (Language set to CHINESE, You'll need chinese CDs)") -#else -# error "At least You have to specify a Language somewhere. See comments above." -#endif diff --git a/Ja2/Language Defines.h b/Ja2/Language Defines.h deleted file mode 100644 index 8032d699..00000000 --- a/Ja2/Language Defines.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __LANGUAGE_DEFINES_H -#define __LANGUAGE_DEFINES_H - -#pragma once - -/* ============================================================================ - * ONLY ONE OF THESE LANGUAGES CAN BE DEFINED AT A TIME! - * BUT now You can define it _here_ by uncommenting one _or_ (better): - * You can comment them all out and then set it _global_ in "Preprocessor - * options" (do it for ALL projects in the workspace and both debug & release) - * _or_ - * give it do Your MAKEFILE, f.i. make ENGLISH, but keep in mind that some - * weird make tools will require 'make ENGLISH=1' instead - * - * using one of the two later methods will keep this SVN file unchanged for the - * future, only Your private project files (workspace/solution) will differ - * from the SVN stuff. - * (2006-10-10, Sergeant_Kolja) - */ - - -/* The recommend approach for VS2010 multi-language builds is to use the command line or the ja2.props file. - - By default the language is ENGLISH and the Language Prefix is EN. - - There are 3 ways you can build the JA2 1.13 executable file: - - // ------------------------------------------------------- - // 1. Using the command line - // ------------------------------------------------------- - - For example, where msbuild is located in %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ if not on your path - msbuild.exe /p:Configuration=Release ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=PL /p:JA2Language=POLISH ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=RU /p:JA2Language=RUSSIAN ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=NL /p:JA2Language=DUTCH ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=FR /p:JA2Language=FRENCH ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=IT /p:JA2Language=ITALIAN ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=CN /p:JA2Language=CHINESE ja2_VS2010.sln - - Note: If you want to build "Unfinished Business" version, just append the /p:JA2Config=JA2UB in the command line - msbuild.exe /p:Configuration=Release /p:JA2Config=JA2UB ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB ja2_VS2010.sln - - Note2: You can also specify the target output name with the parameter /p:TargetName - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB /p:TargetName="JA2UB_113" ja2_VS2010.sln - - // -------------------------------------------------------- - // 2. Editing the ja2.props file and then build in VS 2010 - // ------------------------------------------------------- - - 1. Open the "ja2.props" file in a text editor and set the tags to your likeing. - - For example: If you want to build Russian Version (normal JA2, not UB) then set the following: - - - - - - RU - - - RUSSIAN - - - 2. Save the file - 3. Build the project in Visual Studio 2010 - - // -------------------------------------------------------- - // 3. The "old" way for building the executable - // ------------------------------------------------------- - - 1. Enable the "#undef ENGLISH" define below, so English will not be used anymore - 2. Set the desired language below - 3. If you want to build "Unfinished Business" version, enable "#define JA2UB" and "#define JA2UBMAPS" in builddefines.h" - 4. Build the executable in VS 2005 / 2008 / 2010 - 5. The output will be placed in the "Build\bin\" folder -*/ - -// Only enable this "undef", if you use the 3. way of building the executable! -#undef ENGLISH - -#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE) -/* please set one manually here (by uncommenting) if not willingly to set Workspace wide */ - -#define ENGLISH -//#define GERMAN -//#define RUSSIAN -//#define DUTCH -//#define FRENCH -//#define ITALIAN -//#define POLISH - -// INFO: For Chinese 1.13 version, you also have to set USE_WINFONTS = 1 in ja2.ini inside your JA2 installation directory! -//#define CHINESE - -#endif - -//**ddd direct link libraries -#pragma comment (lib, "user32.lib") -#pragma comment (lib, "gdi32.lib") -#pragma comment (lib, "advapi32.lib") -#pragma comment (lib, "shell32.lib") - -/* ==================================================================== - * Regardless of if we did it Workspace wide or by uncommenting above, - * HERE we must see, what language was selected. If one, we - */ -#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE) -# error "At least You have to specify a Language somewhere. See comments above." -#endif - -//if the language represents words as single chars -/*#ifdef TAIWAN - #define SINGLE_CHAR_WORDS -#endif*/ - -#endif From 897f684705594f5e898342c5cab0e16b061816f5 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:01:01 -0300 Subject: [PATCH 032/118] remove all #include's for Language Defines scripted diff: find . -type f -iname "*.h" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \; find . -type f -iname "*.cpp" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \; --- Ja2/Cheats.h | 1 - Ja2/Credits.cpp | 1 - Ja2/FeaturesScreen.cpp | 1 - Ja2/GameSettings.cpp | 1 - Ja2/Options Screen.cpp | 1 - Ja2/builddefines.h | 2 -- Ja2/jascreens.cpp | 1 - Laptop/AimMembers.cpp | 1 - Tactical/Interface Enhanced.cpp | 1 - Tactical/Interface Items.cpp | 1 - Utils/Encrypted File.cpp | 1 - Utils/ImportStrings.cpp | 1 - Utils/Multi Language Graphic Utils.cpp | 1 - Utils/Multilingual Text Code Generator.cpp | 1 - Utils/Utils All.h | 1 - Utils/_ChineseText.cpp | 1 - Utils/_DutchText.cpp | 1 - Utils/_EnglishText.cpp | 1 - Utils/_FrenchText.cpp | 1 - Utils/_GermanText.cpp | 1 - Utils/_ItalianText.cpp | 1 - Utils/_Ja25ChineseText.cpp | 1 - Utils/_Ja25DutchText.cpp | 1 - Utils/_Ja25EnglishText.cpp | 1 - Utils/_Ja25FrenchText.cpp | 1 - Utils/_Ja25GermanText.cpp | 1 - Utils/_Ja25ItalianText.cpp | 1 - Utils/_Ja25PolishText.cpp | 1 - Utils/_Ja25RussianText.cpp | 1 - Utils/_PolishText.cpp | 1 - Utils/_RussianText.cpp | 1 - 31 files changed, 32 deletions(-) diff --git a/Ja2/Cheats.h b/Ja2/Cheats.h index 74760ab6..2cd58cd1 100644 --- a/Ja2/Cheats.h +++ b/Ja2/Cheats.h @@ -1,7 +1,6 @@ #ifndef _CHEATS__H_ #define _CHEATS__H_ -#include "Language Defines.h" extern UINT8 gubCheatLevel; diff --git a/Ja2/Credits.cpp b/Ja2/Credits.cpp index 7a1f8d25..f2d1fdeb 100644 --- a/Ja2/Credits.cpp +++ b/Ja2/Credits.cpp @@ -1,6 +1,5 @@ #include "Types.h" #include "Credits.h" - #include "Language Defines.h" #include "vsurface.h" #include "mousesystem.h" #include "Text.h" diff --git a/Ja2/FeaturesScreen.cpp b/Ja2/FeaturesScreen.cpp index 92d0b60f..50535f97 100644 --- a/Ja2/FeaturesScreen.cpp +++ b/Ja2/FeaturesScreen.cpp @@ -26,7 +26,6 @@ #include "Text.h" #include "Interface Control.h" #include "Message.h" -#include "Language Defines.h" #include "Multi Language Graphic Utils.h" #include "Map Information.h" #include "Sys Globals.h" diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index 054da671..35f99674 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -10,7 +10,6 @@ #include "GameVersion.h" #include "LibraryDataBase.h" #include "Debug.h" - #include "Language Defines.h" #include "HelpScreen.h" #include "INIReader.h" #include "Shade Table Util.h" diff --git a/Ja2/Options Screen.cpp b/Ja2/Options Screen.cpp index 43fd9b1f..6a9ce3d1 100644 --- a/Ja2/Options Screen.cpp +++ b/Ja2/Options Screen.cpp @@ -29,7 +29,6 @@ #include "Text.h" #include "Interface Control.h" #include "Message.h" - #include "Language Defines.h" #include "Multi Language Graphic Utils.h" #include "Map Information.h" #include "SmokeEffects.h" diff --git a/Ja2/builddefines.h b/Ja2/builddefines.h index 5e48f506..eb71defe 100644 --- a/Ja2/builddefines.h +++ b/Ja2/builddefines.h @@ -1,8 +1,6 @@ #ifndef _BUILDDEFINES_H #define _BUILDDEFINES_H -#include "Language Defines.h" - //----- Briefing Room (Mission based JA2 like in JA/DG) - by Jazz ----- // Once enabled here and also enabled in the ja2_options.ini (BRIEFING_ROOM), // you can access the briefing room feature from the laptop diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index b1dfe4e8..4e1d8897 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -45,7 +45,6 @@ #include "Sound Control.h" #include "WordWrap.h" #include "text.h" - #include "Language Defines.h" #include "IniReader.h" #include "sgp_logger.h" diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 02d806cb..05d63151 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -36,7 +36,6 @@ #include "Strategic Status.h" #include "Merc Contract.h" #include "Strategic Merc Handler.h" - #include "Language Defines.h" #include "Assignments.h" #include "Sound Control.h" #include "Quests.h" diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index c6eee82c..f992338c 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -44,7 +44,6 @@ #include "soldier macros.h" #include "squads.h" #include "MessageBoxScreen.h" - #include "Language Defines.h" #include "GameSettings.h" #include "Map Screen Interface Map Inventory.h" #include "Quests.h" diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 18f635db..78f7933d 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -57,7 +57,6 @@ #include "game clock.h" #include "squads.h" #include "MessageBoxScreen.h" - #include "Language Defines.h" #include "GameSettings.h" #include "Map Screen Interface Map Inventory.h" #include "Quests.h" diff --git a/Utils/Encrypted File.cpp b/Utils/Encrypted File.cpp index 16886459..20fba544 100644 --- a/Utils/Encrypted File.cpp +++ b/Utils/Encrypted File.cpp @@ -2,7 +2,6 @@ #include "FileMan.h" #include "Debug.h" -#include "Language Defines.h" // anv: for selecting random line #include "Random.h" diff --git a/Utils/ImportStrings.cpp b/Utils/ImportStrings.cpp index 1d4131c4..cbe3a711 100644 --- a/Utils/ImportStrings.cpp +++ b/Utils/ImportStrings.cpp @@ -1,6 +1,5 @@ #include "ImportStrings.h" #include "LocalizedStrings.h" -#include "Language Defines.h" #include #include diff --git a/Utils/Multi Language Graphic Utils.cpp b/Utils/Multi Language Graphic Utils.cpp index 102c7d3f..4d444fb9 100644 --- a/Utils/Multi Language Graphic Utils.cpp +++ b/Utils/Multi Language Graphic Utils.cpp @@ -4,7 +4,6 @@ #include "Types.h" #include "Multi Language Graphic Utils.h" -#include "Language Defines.h" //SB #include "FileMan.h" diff --git a/Utils/Multilingual Text Code Generator.cpp b/Utils/Multilingual Text Code Generator.cpp index 256f9280..2bdfcb2a 100644 --- a/Utils/Multilingual Text Code Generator.cpp +++ b/Utils/Multilingual Text Code Generator.cpp @@ -32,7 +32,6 @@ CREATED: Feb 16, 1999 #include "builddefines.h" #include #include "types.h" -#include "Language Defines.h" #include "debug.h" #include "Fileman.h" diff --git a/Utils/Utils All.h b/Utils/Utils All.h index 208f4990..3b6750c6 100644 --- a/Utils/Utils All.h +++ b/Utils/Utils All.h @@ -41,7 +41,6 @@ #include "opplist.h" #include "himage.h" #include "vsurface_private.h" -#include "Language Defines.h" #include "text.h" #include "Screens.h" #include "Maputility.h" diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 46845d9d..622b69f5 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("CHINESE") - #include "Language Defines.h" #if defined( CHINESE ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index c6ddf46a..976ea802 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("DUTCH") - #include "Language Defines.h" #if defined( DUTCH ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 91d15743..0f5f947e 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ENGLISH") - #include "Language Defines.h" #if defined( ENGLISH ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index fb8e314b..6a259577 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("FRENCH") - #include "Language Defines.h" #ifdef FRENCH #include "text.h" #include "Fileman.h" diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 721d099f..53bb2601 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("GERMAN") - #include "Language Defines.h" #ifdef GERMAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 58a63f5c..6f9cbb10 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ITALIAN") - #include "Language Defines.h" #if defined( ITALIAN ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25ChineseText.cpp b/Utils/_Ja25ChineseText.cpp index 919f2d14..1bfcf23e 100644 --- a/Utils/_Ja25ChineseText.cpp +++ b/Utils/_Ja25ChineseText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("CHINESE") - #include "Language Defines.h" #ifdef CHINESE #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25DutchText.cpp b/Utils/_Ja25DutchText.cpp index a2234862..396f8ac5 100644 --- a/Utils/_Ja25DutchText.cpp +++ b/Utils/_Ja25DutchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("DUTCH") - #include "Language Defines.h" #ifdef DUTCH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25EnglishText.cpp b/Utils/_Ja25EnglishText.cpp index b58a080d..70a0c7e2 100644 --- a/Utils/_Ja25EnglishText.cpp +++ b/Utils/_Ja25EnglishText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ENGLISH") - #include "Language Defines.h" #ifdef ENGLISH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25FrenchText.cpp b/Utils/_Ja25FrenchText.cpp index f20af04a..17f9fa2a 100644 --- a/Utils/_Ja25FrenchText.cpp +++ b/Utils/_Ja25FrenchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("FRENCH") - #include "Language Defines.h" #ifdef FRENCH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25GermanText.cpp b/Utils/_Ja25GermanText.cpp index b402f410..663aba59 100644 --- a/Utils/_Ja25GermanText.cpp +++ b/Utils/_Ja25GermanText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("GERMAN") - #include "Language Defines.h" #ifdef GERMAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25ItalianText.cpp b/Utils/_Ja25ItalianText.cpp index 4ffb9454..06d7f298 100644 --- a/Utils/_Ja25ItalianText.cpp +++ b/Utils/_Ja25ItalianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ITALIAN") - #include "Language Defines.h" #ifdef ITALIAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25PolishText.cpp b/Utils/_Ja25PolishText.cpp index 9446a5b2..f7835402 100644 --- a/Utils/_Ja25PolishText.cpp +++ b/Utils/_Ja25PolishText.cpp @@ -2,7 +2,6 @@ // WANNE: Yes we need this here exclusivly in Polish version, because we do not have a codepage in the code like for other versions. //#pragma setlocale("POLISH") - #include "Language Defines.h" #ifdef POLISH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25RussianText.cpp b/Utils/_Ja25RussianText.cpp index 8ce7b35f..77e48edd 100644 --- a/Utils/_Ja25RussianText.cpp +++ b/Utils/_Ja25RussianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("RUSSIAN") - #include "Language Defines.h" #ifdef RUSSIAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 860c2887..8445de0d 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2,7 +2,6 @@ // WANNE: Yes we need this here exclusivly in Polish version, because we do not have a codepage in the code like for other versions. //#pragma setlocale("POLISH") - #include "Language Defines.h" #if defined( POLISH ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 62b72e2f..110c38e7 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("RUSSIAN") - #include "Language Defines.h" #if defined( RUSSIAN ) #include "text.h" #include "Fileman.h" From dc72a43a19f39294bdb8e8fb951e46b3dc6aae22 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 02:27:52 -0300 Subject: [PATCH 033/118] silence narrowing conversions in MSVC we all know they're there, whenever someone fixes it (lol), this should be removed --- CMakeLists.txt | 4 ++++ TODO | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 403a2f55..eaff0652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ if(ADDRESS_SANITIZER) add_compile_options($,$>,-fsanitize=address,>) endif() +if(MSVC) + add_compile_options("/wd4838") +endif() + # whether we are using MSBuild as a generator set(usingMsBuild $) diff --git a/TODO b/TODO index 8b137891..e4bb3a3c 100644 --- a/TODO +++ b/TODO @@ -1 +1,4 @@ +# stuff that needs doing +# priority (LOW,HIGH) and description +LOW readd the C4838 (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4838) warning to CMakeLists.txt once they're all fixed in the code From a83dfbefb0dc4cf8ace9ffbe3291f07e93da7493 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 18:14:29 -0300 Subject: [PATCH 034/118] add option to enable link time optimization a bit slower to compile for developing so defaults to 'false', but might be a good idea for the releases. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eaff0652..6cd0d74e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,14 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +include(CheckIPOSupported) +check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX) +if(LinkTimeOptimization) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +else() + message(WARNING "IPO is not supported: ${IpoError}") +endif() + option(ADDRESS_SANITIZER OFF) if(ADDRESS_SANITIZER) message(STATUS "AddressSanitizer ENABLED for non-Release builds") From dd5cabc6ba67ca37cf5c33b58852aa7481592fb3 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 07:26:42 -0300 Subject: [PATCH 035/118] actually make link-time optimization default to OFF sorry, I lied in the last commit. didn't mean to --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cd0d74e..139335b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,12 +9,15 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +option(LTO_OPTION "Enable link-time optimization if supported by compiler" OFF) + include(CheckIPOSupported) check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX) -if(LinkTimeOptimization) +if(LinkTimeOptimization AND LTO_OPTION) + message(STATUS "Configuring WITH link-time optimization") set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) else() - message(WARNING "IPO is not supported: ${IpoError}") + message(STATUS "Configuring WITHOUT link-time optimization ${IpoError}") endif() option(ADDRESS_SANITIZER OFF) From 3cfde817bab38f12ba360f63cda45a3dce0a9454 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:19:51 +0200 Subject: [PATCH 036/118] Set table mouse_region priorities lower than bookmark bar --- Laptop/BaseTable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Laptop/BaseTable.cpp b/Laptop/BaseTable.cpp index 14f3697f..8bf31a55 100644 --- a/Laptop/BaseTable.cpp +++ b/Laptop/BaseTable.cpp @@ -627,7 +627,7 @@ TestTable::Display( ) { MSYS_DefineRegion( &it->mMouseRegion[i - mFirstEntryShown], usPosX, usPosY, usPosX + it->GetRequiredLength(), usPosY + heightperrow, - MSYS_PRIORITY_HIGHEST, CURSOR_WWW, + MSYS_PRIORITY_HIGHEST-3, CURSOR_WWW, MSYS_NO_CALLBACK, ( *it ).RegionClickCallBack ); MSYS_AddRegion( &it->mMouseRegion[i - mFirstEntryShown] ); From 4d4e039da7a02725729e12f6715b6b5c5f516d42 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 10:18:34 -0300 Subject: [PATCH 037/118] add an internationalization constant gather all ENGLISH|GERMAN|CHINESE etc preprocessor hell into a single library, so to restrict the number of targets that need to be built 8x this still has UB/EDITOR definitions so that still needs to be dealt with before we can build it only 8 times --- CMakeLists.txt | 2 ++ i18n/CMakeLists.txt | 4 ++++ i18n/include/language.hpp | 17 +++++++++++++++++ i18n/language.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 i18n/CMakeLists.txt create mode 100644 i18n/include/language.hpp create mode 100644 i18n/language.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 139335b3..f1842724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/Multiplayer" "${CMAKE_SOURCE_DIR}/Editor" "${CMAKE_SOURCE_DIR}/Console" + "${CMAKE_SOURCE_DIR}/i18n/include" ) # external libraries @@ -85,6 +86,7 @@ Editor Console Tactical ModularizedTacticalAI +i18n ) foreach(lib IN LISTS Ja2_Libs) add_subdirectory(${lib}) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt new file mode 100644 index 00000000..e3100765 --- /dev/null +++ b/i18n/CMakeLists.txt @@ -0,0 +1,4 @@ +set(i18nSrc +"${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" +PARENT_SCOPE +) diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp new file mode 100644 index 00000000..469d104e --- /dev/null +++ b/i18n/include/language.hpp @@ -0,0 +1,17 @@ +#pragma once + +namespace i18n { +enum class Lang +{ + en, + de, + ru, + nl, + pl, + fr, + it, + zh +}; +} + +extern const i18n::Lang g_lang; diff --git a/i18n/language.cpp b/i18n/language.cpp new file mode 100644 index 00000000..4850fbca --- /dev/null +++ b/i18n/language.cpp @@ -0,0 +1,24 @@ +#include + +/* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language + * (ideally text and voice separately) be set in the options menu would be + * ideal. */ +const i18n::Lang g_lang{ + #if defined(ENGLISH) + i18n::Lang::en +#elif defined(CHINESE) + i18n::Lang::zh +#elif defined(DUTCH) + i18n::Lang::nl +#elif defined(FRENCH) + i18n::Lang::fr +#elif defined(GERMAN) + i18n::Lang::de +#elif defined(ITALIAN) + i18n::Lang::it +#elif defined(POLISH) + i18n::Lang::pl +#elif defined(RUSSIAN) + i18n::Lang::ru +#endif +}; From 3acd2cea97308548be8303e2d62d2e0373495332 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 10:22:25 -0300 Subject: [PATCH 038/118] move Ja 2 Libs.* to i18n it has preprocessor silliness in it --- i18n/CMakeLists.txt | 1 + {sgp => i18n}/Ja2 Libs.cpp | 0 {sgp => i18n/include}/Ja2 Libs.h | 0 sgp/CMakeLists.txt | 1 - 4 files changed, 1 insertion(+), 1 deletion(-) rename {sgp => i18n}/Ja2 Libs.cpp (100%) rename {sgp => i18n/include}/Ja2 Libs.h (100%) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index e3100765..6c40cf61 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,4 +1,5 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" PARENT_SCOPE ) diff --git a/sgp/Ja2 Libs.cpp b/i18n/Ja2 Libs.cpp similarity index 100% rename from sgp/Ja2 Libs.cpp rename to i18n/Ja2 Libs.cpp diff --git a/sgp/Ja2 Libs.h b/i18n/include/Ja2 Libs.h similarity index 100% rename from sgp/Ja2 Libs.h rename to i18n/include/Ja2 Libs.h diff --git a/sgp/CMakeLists.txt b/sgp/CMakeLists.txt index ddf04225..c1df77f3 100644 --- a/sgp/CMakeLists.txt +++ b/sgp/CMakeLists.txt @@ -14,7 +14,6 @@ set(sgpSrc "${CMAKE_CURRENT_SOURCE_DIR}/himage.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/impTGA.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/input.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/LibraryDataBase.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/line.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MemMan.cpp" From 4624fe92f05c10f8b86be2b628e23aa93bf8c335 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:08:08 -0300 Subject: [PATCH 039/118] leave CHINESE struct member UINT8 Width[0x80] this might cause a horrifying alignment bug, but I doubt it --- sgp/WinFont.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index bd046f7c..574235cf 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -37,9 +37,7 @@ typedef struct COLORVAL BackColor; UINT8 Height; UINT8 InternalLeading; -#ifdef CHINESE UINT8 Width[0x80]; -#endif } HWINFONT; LONG gWinFontAdjust; From 5d19c1fe2587a7660ea4c7cd49cf12ec8eb33493 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:19:05 -0300 Subject: [PATCH 040/118] make conditional CHINESE preprocessor def into global constant --- Strategic/Map Screen Interface Bottom.cpp | 1 + Strategic/Map Screen Interface Bottom.h | 6 ------ Strategic/mapscreen.cpp | 1 + Utils/message.cpp | 1 + i18n/include/language.hpp | 2 ++ i18n/language.cpp | 8 ++++++++ 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 1cb96593..e045f060 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -55,6 +55,7 @@ #include "connect.h" +#include struct UILayout_BottomButtons { diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index 0c7dd8c6..aee14fc0 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -4,12 +4,6 @@ #include "types.h" #include "Soldier Control.h" - -#ifdef CHINESE //zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows -#define MAX_MESSAGES_ON_MAP_BOTTOM 6 -#else -#define MAX_MESSAGES_ON_MAP_BOTTOM 9 -#endif #ifdef JA2UB extern INT8 gbExitingMapScreenToWhere; #endif diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index bdf89983..9e180ddd 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -115,6 +115,7 @@ #include "connect.h" //hayden #include "InterfaceItemImages.h" #include "vobject.h" +#include #ifdef JA2UB #include "laptop.h" diff --git a/Utils/message.cpp b/Utils/message.cpp index 2befaa26..4b09a0b9 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -22,6 +22,7 @@ #include "GameSettings.h" #include "sgp_logger.h" +#include typedef struct { UINT32 uiFont; diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index 469d104e..c1b3e468 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -15,3 +15,5 @@ enum class Lang } extern const i18n::Lang g_lang; + +extern const int MAX_MESSAGES_ON_MAP_BOTTOM; diff --git a/i18n/language.cpp b/i18n/language.cpp index 4850fbca..1368db18 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -22,3 +22,11 @@ const i18n::Lang g_lang{ i18n::Lang::ru #endif }; + +const int MAX_MESSAGES_ON_MAP_BOTTOM{ +#if defined(CHINESE) // zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows + 6 +#else + 9 +#endif +}; From bf6de9f3422f7bfdababa5b4f292bf0dea83c1c8 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:45:38 -0300 Subject: [PATCH 041/118] Move GetLanguagePrefix function into i18n --- Ja2/Init.cpp | 30 ++---------------------------- Tactical/XML.h | 8 -------- i18n/include/language.hpp | 4 ++++ i18n/language.cpp | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 44a90d76..1d803358 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -78,6 +78,8 @@ #include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes() #include "Animation Data.h" // added by Flugente +#include + extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0}; extern INT16 gubMaxActionPoints[TOTALBODYTYPES];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08 extern BOOLEAN GetCDromDriveLetter( STR8 pString ); @@ -134,34 +136,6 @@ static void AddLanguagePrefix(STR fileName, const STR language) memmove( fileComponent, language, strlen( language) ); } -static const STR GetLanguagePrefix() -{ -#ifdef ENGLISH - return ""; -#endif -#ifdef GERMAN - return GERMAN_PREFIX; -#endif -#ifdef RUSSIAN - return RUSSIAN_PREFIX; -#endif -#ifdef DUTCH - return DUTCH_PREFIX; -#endif -#ifdef POLISH - return POLISH_PREFIX; -#endif -#ifdef FRENCH - return FRENCH_PREFIX; -#endif -#ifdef ITALIAN - return ITALIAN_PREFIX; -#endif -#ifdef CHINESE - return CHINESE_PREFIX; -#endif -} - static void AddLanguagePrefix(STR fileName) { AddLanguagePrefix( fileName, GetLanguagePrefix()); diff --git a/Tactical/XML.h b/Tactical/XML.h index 963417ef..d1ab96b9 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -58,14 +58,6 @@ typedef PARSE_STAGE; #define TABLEDATA_DIRECTORY "TableData\\" #define TABLEDATA_LAPTOP_DIRECTORY "Laptop\\" -#define GERMAN_PREFIX "German." -#define RUSSIAN_PREFIX "Russian." -#define DUTCH_PREFIX "Dutch." -#define POLISH_PREFIX "Polish." -#define FRENCH_PREFIX "French." -#define ITALIAN_PREFIX "Italian." -#define CHINESE_PREFIX "Chinese." - #define ATTACHMENTSFILENAME "Items\\Attachments.xml" #define ATTACHMENTINFOFILENAME "Items\\AttachmentInfo.xml" #define ITEMSFILENAME "Items\\Items.xml" diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index c1b3e468..bd895bcc 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace i18n { enum class Lang { @@ -17,3 +19,5 @@ enum class Lang extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; + +auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 1368db18..555b33c2 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -30,3 +30,25 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ 9 #endif }; + +auto GetLanguagePrefix() -> const STR { + return +#if defined(ENGLISH) + "" +#elif defined(CHINESE) + "Chinese." +#elif defined(DUTCH) + "Dutch." +#elif defined(FRENCH) + "French." +#elif defined(GERMAN) + "German." +#elif defined(ITALIAN) + "Italian." +#elif defined(POLISH) + "Polish." +#elif defined(RUSSIAN) + "Russian." +#endif + ; +} From cd69f5f3aeabd64816fd02d7308407451bf6ecad Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:36:59 -0300 Subject: [PATCH 042/118] Make Chinese specific strings compile-time instead of conditional eventually we'll switch between CHINESE and other languages during runtime, so even if language is not chinese, these symbols must still be there these symbol names aren't used so this is fine --- Utils/Text.h | 24 ++++++++++++------------ Utils/_ChineseText.cpp | 14 -------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Utils/Text.h b/Utils/Text.h index a71e194d..8d32695a 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -extern STR16 ChineseSpecString1; -extern STR16 ChineseSpecString2; -extern STR16 ChineseSpecString3; -extern STR16 ChineseSpecString4; -extern STR16 ChineseSpecString5; -extern STR16 ChineseSpecString6; -extern STR16 ChineseSpecString7; -extern STR16 ChineseSpecString8; -extern STR16 ChineseSpecString9; -extern STR16 ChineseSpecString10; -extern STR16 ChineseSpecString11; -extern STR16 ChineseSpecString12; +inline constexpr STR16 ChineseSpecString1 = L"%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString2 = L"*%3d%%%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString3 = L"%d%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString5 = L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString6 = L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString7 = L"%s [%d%%]\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +inline constexpr STR16 ChineseSpecString9 = L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString10 = L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente enum { diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 622b69f5..3b7f881c 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -12159,18 +12159,4 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; -// WANNE: Some Chinese specific strings that needs to be in unicode! -STR16 ChineseSpecString1 = L"%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString2 = L"*%3d%%%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString3 = L"%d%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString4 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -STR16 ChineseSpecString5 = L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s"; -STR16 ChineseSpecString6 = L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; -STR16 ChineseSpecString7 = L"%s [%d%%]\n%s %1.1f %s"; -STR16 ChineseSpecString8 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -STR16 ChineseSpecString9 = L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString10 = L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString11 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString12 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente - #endif //CHINESE From d008d10b31bd311f742334a2268e8b4be375c0c4 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 08:07:47 -0300 Subject: [PATCH 043/118] Replace a ton of trivial #ifdefs with runtime checks This one is big, but unless I missed something, should be all be trivial. scripted-diff with the following, then manually tweaked whatever needed: ``` if [ $# -ne 3 ]; then echo "Usage: $0 '' '' ''" exit 1 fi pattern="$1" replacement="$2" filename="$3" if [ ! -f "$filename" ]; then echo "Error: File $filename does not exist." exit 1 fi sed -i '/'"$pattern"'/ { :loop $ !{ N /'"$pattern"'.*\n.*#endif/ { s/'"$pattern"'/'"$replacement"'/ s/#else/} else {/ s/#endif/}/ P D } /'"$pattern"'/ b loop } }' "$filename" echo "Replacement complete in $filename" ``` h/t to Grok2 for the sed command --- Ja2/Init.cpp | 148 ++++---- Ja2/Intro.cpp | 7 +- Ja2/JA2 Splash.cpp | 7 +- Ja2/SaveLoadGame.cpp | 9 +- Ja2/jascreens.cpp | 7 +- Laptop/AimMembers.cpp | 7 +- Laptop/BobbyRGuns.cpp | 7 +- Laptop/BobbyRMailOrder.cpp | 13 +- Laptop/IMP Text System.cpp | 7 +- Strategic/Map Screen Interface Map.cpp | 13 +- Strategic/Strategic Town Loyalty.cpp | 7 +- Strategic/mapscreen.cpp | 18 +- Tactical/Handle Doors.cpp | 7 +- Tactical/Interface Enhanced.cpp | 499 +++++++++++++------------ Tactical/Interface Items.cpp | 13 +- Tactical/Interface Panels.cpp | 20 +- sgp/WinFont.cpp | 15 +- sgp/sgp.cpp | 5 +- 18 files changed, 413 insertions(+), 396 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 1d803358..bf74dbf3 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -228,7 +228,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, AMMOFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) @@ -242,9 +242,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, AMMOFILENAME); SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); } -#else +} else { SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); -#endif +} // Lesh: added this, begin strcpy(fileName, directoryName); @@ -268,14 +268,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) // the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInItemStats(fileName,TRUE), fileName); } -#endif +} //if(!WriteItemStats()) // return FALSE; @@ -340,14 +340,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat( fileName, DISEASEFILENAME ); SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME ); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME); } -#endif +} strcpy(fileName, directoryName); strcat(fileName, STRUCTUREDECONSTRUCTFILENAME); @@ -385,14 +385,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LOADSCREENHINTSFILENAME); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName); } - #endif + } strcpy(fileName, directoryName); strcat(fileName, ARMOURSFILENAME); @@ -422,14 +422,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) } } -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInLBEPocketStats(fileName,TRUE), fileName); } -#endif +} // THE_BOB : added for pocket popup definitions LBEPocketPopup.clear(); @@ -437,7 +437,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if (FileExists(fileName)) @@ -452,10 +452,10 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); } -#else +} else { // WANNE: Load english file SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); -#endif +} #ifdef JA2UB @@ -471,14 +471,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, MERCSTARTINGGEARFILENAME); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName, FALSE), MERCSTARTINGGEARFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName,TRUE), fileName); } - #endif + } #endif @@ -495,14 +495,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, ATTACHMENTSLOTSFILENAME); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName, FALSE),ATTACHMENTSLOTSFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName,TRUE), fileName); } - #endif + } // Flugente: created separate gun and item choices for different soldier classes - read in different xmls strcpy(fileName, directoryName); @@ -676,14 +676,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, CITYTABLEFILENAME); SGP_THROW_IFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInStrategicMapSectorTownNames(fileName,TRUE), fileName); } -#endif +} // Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp, // function BOOLEAN InitStrategicMovementCosts(); @@ -734,14 +734,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, TRUE),fileName); } -#endif +} strcpy(fileName, directoryName); strcat(fileName, DELIVERYMETHODSFILENAME); @@ -754,14 +754,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,FALSE), FACILITYTYPESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,TRUE), fileName); } -#endif +} // HEADROCK HAM 3.4: Read in facility locations strcpy(fileName, directoryName); @@ -775,14 +775,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,FALSE,0), SECTORNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,TRUE, 0), fileName); } -#endif +} // HEADROCK HAM 5: Read in Coolness by Sector strcpy(fileName, directoryName); @@ -804,7 +804,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { @@ -812,7 +812,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) if(!ReadInMercProfiles(fileName,TRUE)) return FALSE; } - #endif + } } strcpy(fileName, directoryName); @@ -830,14 +830,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName,TRUE), fileName); } - #endif + } // HEADROCK PROFEX: Read in Merc Opinion data to replace PROF.DAT data strcpy(fileName, directoryName); @@ -900,14 +900,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,FALSE), ENEMYNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,TRUE), fileName); } -#endif +} } @@ -919,14 +919,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,FALSE), CIVGROUPNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,TRUE), fileName); } -#endif +} } @@ -936,14 +936,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,TRUE), fileName); } -#endif +} if (gGameExternalOptions.fEnemyRank == TRUE) { @@ -953,14 +953,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,FALSE), ENEMYRANKFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,TRUE), fileName); } -#endif +} } // Flugente: backgrounds @@ -969,14 +969,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,FALSE), BACKGROUNDSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,TRUE), BACKGROUNDSFILENAME); } -#endif +} // Flugente: individual militia strcpy( fileName, directoryName ); @@ -990,14 +990,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,FALSE), CAMPAIGNSTATSEVENTSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,TRUE), CAMPAIGNSTATSEVENTSFILENAME); } -#endif +} // WANNE: Only in a singleplayer game... // Externalised taunts @@ -1018,14 +1018,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, FileInfo.zFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); } - #endif + } while( GetFileNext(&FileInfo) ) { strcpy(fileName, directoryName); @@ -1033,14 +1033,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, FileInfo.zFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); } - #endif + } } GetFileClose(&FileInfo); } @@ -1052,14 +1052,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName); } -#endif +} // IMP Portraits List by Jazz strcpy(fileName, directoryName); @@ -1067,14 +1067,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,FALSE), IMPPORTRAITS); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,TRUE), fileName); } -#endif +} LoadIMPPortraitsTEMP( ); @@ -1159,14 +1159,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) SGP_THROW_IFFALSE(ReadInFaceGear(zNewFaceGear, fileName), FACEGEARFILENAME); //WriteFaceGear(); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercAvailability(fileName,TRUE), fileName); } -#endif +} UINT32 i; for(i=0; i BOOLEAN Style_JA = TRUE; extern INT8 Test = 0; @@ -726,11 +727,11 @@ void DisplaySirtechSplashScreen() * (2006-10-10, Sergeant_Kolja) */ #ifdef _DEBUG - # if defined(ENGLISH) + if( g_lang == i18n::Lang::en ) { AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) ); - # elif defined(GERMAN) + } else if( g_lang == i18n::Lang::de ) { AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) ); - # endif + } #endif AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) ); return; diff --git a/Ja2/JA2 Splash.cpp b/Ja2/JA2 Splash.cpp index 4ef6714a..c7d9634d 100644 --- a/Ja2/JA2 Splash.cpp +++ b/Ja2/JA2 Splash.cpp @@ -5,6 +5,7 @@ #include "Timer Control.h" #include "Multi Language Graphic Utils.h" #include +#include UINT32 guiSplashFrameFade = 10; UINT32 guiSplashStartTime = 0; @@ -13,10 +14,10 @@ extern HVSURFACE ghFrameBuffer; //Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { -#ifdef ENGLISH +if( g_lang == i18n::Lang::en ) { ClearMainMenu(); -#else +} else { UINT32 uiLogoID = 0; HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions @@ -69,7 +70,7 @@ void InitJA2SplashScreen() GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); -#endif // ENGLISH +} // ENGLISH InvalidateScreen(); RefreshScreen( NULL ); diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index dc30a1e7..a0dd2cb5 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -152,6 +152,7 @@ #endif #include "LuaInitNPCs.h" +#include #ifdef JA2UB @@ -7205,7 +7206,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) } } -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { // Fix neutral flags if ( guiCurrentSaveGameVersion < 94 ) { @@ -7215,7 +7216,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) Menptr[ cnt].aiData.bNeutral = FALSE; } } -#endif +} //#ifdef JA2UB //if the soldier has the NON weapon version of the merc knofe or merc umbrella //ConvertWeapons( &Menptr[ cnt ] ); @@ -9896,9 +9897,9 @@ UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ) } } - #ifdef GERMAN + if( g_lang == i18n::Lang::de ) { uiEncryptionSet *= 11; - #endif + } uiEncryptionSet = uiEncryptionSet % 10; diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 4e1d8897..87d04505 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -48,6 +48,7 @@ #include "IniReader.h" #include "sgp_logger.h" +#include #define _UNICODE // Networking Stuff @@ -331,7 +332,7 @@ UINT32 InitScreenHandle(void) if ( ubCurrentScreen == 255 ) { - #ifdef ENGLISH + if( g_lang == i18n::Lang::en ) { if( gfDoneWithSplashScreen ) { ubCurrentScreen = 0; @@ -341,9 +342,9 @@ UINT32 InitScreenHandle(void) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); return( INTRO_SCREEN ); } - #else + } else { ubCurrentScreen = 0; - #endif + } } if ( ubCurrentScreen == 0 ) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 05d63151..0c1e2f37 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -49,6 +49,7 @@ #include "Encrypted File.h" #include "InterfaceItemImages.h" #include +#include // //****** Defines ****** @@ -5461,20 +5462,20 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ) //create the string to display to the user, looks like.... // L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { //Germans version has a different argument order swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], gMercProfiles[ pSoldier->ubProfile ].zNickname, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString, zSectorIDString ); -#else +} else { swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], gMercProfiles[ pSoldier->ubProfile ].zNickname, zSectorIDString, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString ); -#endif +} diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index d336e436..ac9855fc 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -20,6 +20,7 @@ // HEADROCK HAM 4 #include "input.h" #include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item + #include #define BOBBYR_DEFAULT_MENU_COLOR 255 @@ -2516,11 +2517,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, //if it's a used item, display how damaged the item is if( fUsed ) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( sTemp, ChineseSpecString2, LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality );//zww - #else + } else { swprintf( sTemp, L"*%3d%%%%", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ); - #endif + } DrawTextToScreen(sTemp, (UINT16)(BOBBYR_ITEM_NAME_X-2), (UINT16)(usPosY - BOBBYR_ORDER_NUM_Y_OFFSET), BOBBYR_ORDER_NUM_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } diff --git a/Laptop/BobbyRMailOrder.cpp b/Laptop/BobbyRMailOrder.cpp index a7610e23..a145c7a7 100644 --- a/Laptop/BobbyRMailOrder.cpp +++ b/Laptop/BobbyRMailOrder.cpp @@ -30,6 +30,7 @@ #include "GameSettings.h" #include #include +#include /* typedef struct @@ -488,11 +489,11 @@ BOOLEAN EnterBobbyRMailOrder() SetButtonCursor(guiBobbyRClearOrder, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiBobbyRClearOrder, DISABLED_STYLE_NONE ); //inshy: fix position of text for buttons -#ifdef FRENCH +if(g_lang == i18n::Lang::fr) { SpecifyButtonTextOffsets( guiBobbyRClearOrder, 13, 10, TRUE ); -#else +} else { SpecifyButtonTextOffsets( guiBobbyRClearOrder, 39, 10, TRUE ); -#endif +} // Accept Order button guiBobbyRAcceptOrderImage = LoadButtonImage("LAPTOP\\AcceptOrderButton.sti", 2,0,-1,1,-1 ); @@ -504,11 +505,11 @@ BOOLEAN EnterBobbyRMailOrder() DEFAULT_MOVE_CALLBACK, BtnBobbyRAcceptOrderCallback); SetButtonCursor( guiBobbyRAcceptOrder, CURSOR_LAPTOP_SCREEN); //inshy: fix position of text for buttons -#ifdef FRENCH +if(g_lang == i18n::Lang::fr) { SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 15, 24, TRUE ); -#else +} else { SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 43, 24, TRUE ); -#endif +} SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); if( gbSelectedCity == -1 ) diff --git a/Laptop/IMP Text System.cpp b/Laptop/IMP Text System.cpp index 4fd013b8..9555ef80 100644 --- a/Laptop/IMP Text System.cpp +++ b/Laptop/IMP Text System.cpp @@ -38,6 +38,7 @@ #include "GameSettings.h" #endif +#include #define IMP_SEEK_AMOUNT 5 * 80 * 2 @@ -204,18 +205,18 @@ void PrintImpText( void ) LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0); //inshy (18.01.2009): fix position for russian text - #ifdef RUSSIAN + if( g_lang == i18n::Lang::ru ) { // male LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 225, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); // female LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 335, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - #else + } else { // male LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); // female LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - #endif + } break; case ( IMP_PERSONALITY ): diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 0ec76fd7..73af166a 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -56,6 +56,7 @@ #include "MilitiaSquads.h" #include "LaptopSave.h" +#include // added by Flugente extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH]; @@ -1199,11 +1200,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1"); // don't show loyalty string until loyalty tracking for that town has been started if( gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ]) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( sStringA, L"%d%%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); - #else + } else { swprintf( sStringA, L"%d%%%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); - #endif + } // if loyalty is too low to train militia, and militia training is allowed here if ( ( gTownLoyalty[ bTown ].ubRating < iMinLoyaltyToTrain ) && MilitiaTrainingAllowedInTown( bTown ) ) @@ -4873,11 +4874,11 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) // if potential is not nil, show percentage of the two if (GetMaxPeriodicRemovalFromMine(ubMineIndex) > 0) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( wSubString, L" (%d%%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); - #else + } else { swprintf( wSubString, L" (%d%%%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); - #endif + } wcscat( wString, wSubString ); } diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index d4542de0..9de36dc0 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -40,6 +40,7 @@ #include "Luaglobal.h" #include "LuaInitNPCs.h" #include "Interface.h" +#include #include "GameInitOptionsScreen.h" extern WorldItems gAllWorldItems; @@ -1631,12 +1632,12 @@ void AdjustLoyaltyForCivsEatenByMonsters( INT16 sSectorX, INT16 sSectorY, UINT8 swprintf( str, gpStrategicString[STR_PB_BANDIT_KILLCIVS_IN_SECTOR], ubHowMany, pSectorString ); else { -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { //diffrent order of words in Chinese swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], pSectorString, ubHowMany ); -#else +} else { swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], ubHowMany, pSectorString ); -#endif +} } DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 9e180ddd..bdd2a631 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9665,27 +9665,27 @@ void BltCharInvPanel() // print armor/weight/camo labels mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" ); - #endif + } mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" ); - #endif + } mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" ); - #endif + } const auto width = UI_CHARINV.Text.PercentWidth; const auto height = UI_CHARINV.Text.PercentHeight; diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index 4d63103b..ba62ff48 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -33,6 +33,7 @@ #include "GameSettings.h" #include "fresh_header.h" #include "connect.h" +#include #ifdef JA2UB #include "Explosion Control.h" @@ -1492,7 +1493,7 @@ void SetDoorString( INT32 sGridNo ) // ATE: If here, we try to say, opened or closed... if ( gfUIIntTileLocation2 == FALSE ) { -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_DOOR_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; @@ -1535,7 +1536,7 @@ void SetDoorString( INT32 sGridNo ) gfUIIntTileLocation = TRUE; } } -#else +} else { // Try to get doors status here... pDoorStatus = GetDoorStatus( sGridNo ); @@ -1576,7 +1577,7 @@ void SetDoorString( INT32 sGridNo ) } } -#endif +} } } diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index f992338c..37fc0757 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -54,6 +54,7 @@ #include "Food.h" // added by Flugente #include "Multi Language Graphic Utils.h" +#include //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -6586,11 +6587,11 @@ void DrawPropertyValueInColour( INT16 iValue, UINT8 ubNumLine, UINT8 ubNumRegion if( fPercentSign && wcscmp( pStr, L"--" ) != 0 && wcscmp( pStr, L"=" ) != 0 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } mprintf( usX, usY, pStr ); @@ -6681,11 +6682,11 @@ void DrawPropertyValueInColour_X( INT16 iValue, UINT8 numBullets, UINT8 ubNumLin if ( fPercentSign && wcscmp( pStr, L"--" ) != 0 && wcscmp( pStr, L"=" ) != 0 ) { -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); -#else +} else { wcscat( pStr, L"%" ); -#endif +} } mprintf( usX, usY, pStr ); @@ -10356,11 +10357,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10368,11 +10369,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10484,11 +10485,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10496,11 +10497,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10612,11 +10613,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10624,11 +10625,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10745,11 +10746,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10757,11 +10758,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10816,11 +10817,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10828,11 +10829,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode && cnt2 != 1 ) { @@ -10888,11 +10889,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10900,11 +10901,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10958,11 +10959,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10970,11 +10971,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11027,11 +11028,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11039,11 +11040,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11096,11 +11097,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11108,11 +11109,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11520,11 +11521,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11532,11 +11533,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11764,11 +11765,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11776,11 +11777,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11833,11 +11834,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11845,11 +11846,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11961,11 +11962,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11973,11 +11974,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12031,11 +12032,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12043,11 +12044,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12101,11 +12102,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12113,11 +12114,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12171,11 +12172,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12183,11 +12184,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12241,11 +12242,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12253,11 +12254,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12490,11 +12491,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] > 0) { @@ -12502,11 +12503,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12679,11 +12680,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12691,11 +12692,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12749,11 +12750,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12761,11 +12762,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12819,11 +12820,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12831,11 +12832,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12889,11 +12890,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12901,11 +12902,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12959,11 +12960,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12971,11 +12972,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13029,11 +13030,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13041,11 +13042,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13099,11 +13100,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13111,11 +13112,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13169,11 +13170,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13181,11 +13182,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13239,11 +13240,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13251,11 +13252,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13309,11 +13310,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13321,11 +13322,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13379,11 +13380,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13391,11 +13392,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13449,11 +13450,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13461,11 +13462,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13538,11 +13539,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13551,11 +13552,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13615,11 +13616,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13628,11 +13629,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13692,11 +13693,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13705,11 +13706,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13769,11 +13770,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13782,11 +13783,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13843,11 +13844,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13856,11 +13857,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13917,11 +13918,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13930,11 +13931,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13988,11 +13989,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14001,11 +14002,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14059,11 +14060,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14072,11 +14073,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14130,11 +14131,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14143,11 +14144,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14211,11 +14212,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14224,11 +14225,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14594,11 +14595,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) if( !( fComparisonMode && iModifier[0] == 0 ) ) { wcscat( pStr, L"%" ); -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); -#else +} else { wcscat( pStr, L"%" ); -#endif +} } mprintf( usX, usY, pStr ); } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 78f7933d..87cc1279 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -82,6 +82,7 @@ #include "Sound Control.h" #include "Multi Language Graphic Utils.h" +#include #ifdef JA2UB #include "Ja25_Tactical.h" @@ -7409,11 +7410,11 @@ void RenderItemDescriptionBox( ) FindFontRightCoordinates( gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sTop, gODBItemDescRegions[0][0].sRight - gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sBottom - gODBItemDescRegions[0][0].sTop ,pStr, BLOCKFONT2, &usX, &usY); } - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%%" ); - #endif + } mprintf( usX, usY, pStr ); } @@ -11178,11 +11179,11 @@ void SetupPickupPage( INT8 bPage ) } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString3, sValue ); - #else + } else { swprintf( pStr, L"%d%%", sValue ); - #endif + } } SetRegionFastHelpText( &(gItemPickupMenu.Regions[ cnt - iStart ]), pStr ); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 13d9d2cb..5eb07868 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -73,6 +73,8 @@ //legion by Jazz #include "Interface Utils.h" +#include + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -2747,27 +2749,27 @@ void RenderSMPanel( BOOLEAN *pfDirty ) mprintf( SM_ARMOR_LABEL_X - StringPixLength( pInvPanelTitleStrings[0], BLOCKFONT2 ) / 2, SM_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, L"%%" ); - #endif + } mprintf( SM_WEIGHT_LABEL_X - StringPixLength( pInvPanelTitleStrings[1], BLOCKFONT2 ), SM_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, L"%%" ); - #endif + } mprintf( SM_CAMMO_LABEL_X - StringPixLength( pInvPanelTitleStrings[2], BLOCKFONT2 ), SM_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, L"%%" ); - #endif + } UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeAgilityTime, (BOOLEAN)(gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE ? TRUE : FALSE), (BOOLEAN)((gGameOptions.fNewTraitSystem && (gpSMCurrentMerc->ubCriticalStatDamage[DAMAGED_STAT_AGILITY] > 0)) ? TRUE : FALSE), gpSMCurrentMerc->bExtraAgility != 0 ); // SANDRO diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index 574235cf..0760c928 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -22,6 +22,7 @@ #include "font.h" #include "Font Control.h" #include "GameSettings.h" +#include #include @@ -353,7 +354,7 @@ INT32 CreateWinFont( LOGFONT &logfont ) HDC hdc = GetDC(NULL); SelectObject(hdc, hFont); -#ifdef CHINESE +if(g_lang == i18n::Lang::zh) { SIZE RectSize; wchar_t str[2]=L"\1"; for (int i = 1; i<0x80; i++) @@ -365,7 +366,7 @@ INT32 CreateWinFont( LOGFONT &logfont ) str[0] = L'啊'; GetTextExtentPoint32W( hdc, str, 1, &RectSize ); WinFonts[iFont].Width[0] = (UINT8)RectSize.cx; -#endif +} TEXTMETRIC tm; GetTextMetrics(hdc, &tm); @@ -467,7 +468,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) if (pWinFont == NULL) return(0); -#ifdef CHINESE +if(g_lang == i18n::Lang::zh) { wchar_t *p=string2; UINT32 size = 0; while (*p!=0) @@ -482,7 +483,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) p++; } return size; -#else +} else { SIZE RectSize; HDC hdc = GetDC(NULL); @@ -491,7 +492,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) ReleaseDC(NULL, hdc); return( (INT16)RectSize.cx ); -#endif +} } @@ -502,11 +503,11 @@ INT16 GetWinFontHeight(INT32 iFont) pWinFont = GetWinFont(iFont); if (pWinFont == NULL) return(0); -#ifdef CHINESE //zwwooooo: Correct tactical interface font height to fixed Chinese characters smearing bug +if(g_lang == i18n::Lang::zh) { //zwwooooo: Correct tactical interface font height to fixed Chinese characters smearing bug if (iFont == WinFontMap[TINYFONT1] || iFont == WinFontMap[SMALLFONT1] || iFont == WinFontMap[FONT14ARIAL]) { return pWinFont->Height + 2; } -#endif +} return pWinFont->Height; } diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index de26331d..be1fcf5a 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -58,6 +58,7 @@ #endif #include +#include static void MAGIC(std::string const& aarrrrgggh = "") {} @@ -858,13 +859,13 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC } #endif -# ifdef ENGLISH + if( g_lang == i18n::Lang::en ) { try { SetIntroType( INTRO_SPLASH ); } HANDLE_FATAL_ERROR; -# endif + } gfApplicationActive = TRUE; gfProgramIsRunning = TRUE; From 73f7812165bb8731f9c8745096de8b2aee0baac5 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 08:11:49 -0300 Subject: [PATCH 044/118] Slightly less straightforward CHINESE conversion in Interface Items.cpp A bit clunkier, had to repeat function calls because of how preprocessor tricks don't map 1:1 with actual C++. --- Tactical/Interface Items.cpp | 226 +++++++++++++++++++++++++++-------- 1 file changed, 174 insertions(+), 52 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 87cc1279..62dc9fa9 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -12281,12 +12281,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString11, - #else + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, + sThreshold, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } else { swprintf( pStr, L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -12305,16 +12321,12 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString4, - #else - swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -12332,6 +12344,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + + swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } + } } break; @@ -12380,12 +12414,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, L"%s [%d%(%d%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], sValue, sThreshold, @@ -12403,15 +12433,31 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + sThreshold, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, L"%s [%d%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 9 ], //Accuracy String @@ -12428,6 +12474,25 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12438,13 +12503,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier { if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString9, - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, sThreshold, gWeaponStatsDesc[ 11 ], //Damage String @@ -12455,16 +12516,26 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + sThreshold, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), //Melee damage + gWeaponStatsDesc[ 6 ], //AP String + BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString5, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 11 ], //Damage String GetDamage(pObject), //Melee damage @@ -12474,6 +12545,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), //Melee damage + gWeaponStatsDesc[ 6 ], //AP String + BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12513,13 +12597,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage, 0 ); UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage, 1 ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString5, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 11 ], //Damage String explDamage, @@ -12529,6 +12609,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 11 ], //Damage String + explDamage, + gWeaponStatsDesc[ 13 ], //Stun Damage String + explStunDamage, //Stun Damage + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } break; @@ -12558,12 +12651,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString10, - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", - #endif - ItemNames[ usItem ], //Item long name sValue, //Item condition sThreshold, //repair threshold @@ -12577,15 +12666,27 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + sThreshold, //repair threshold + pInvPanelTitleStrings[ 4 ], //Protection string + iProtection, //Protection rating in % based on best armor + Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) + pInvPanelTitleStrings[ 3 ], //Camo string + GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus + gWeaponStatsDesc[ 12 ], //Weight string + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString6, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", - #endif - ItemNames[ usItem ], //Item long name sValue, //Item condition pInvPanelTitleStrings[ 4 ], //Protection string @@ -12598,6 +12699,21 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + pInvPanelTitleStrings[ 4 ], //Protection string + iProtection, //Protection rating in % based on best armor + Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) + pInvPanelTitleStrings[ 3 ], //Camo string + GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus + gWeaponStatsDesc[ 12 ], //Weight string + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12610,17 +12726,23 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier default: { // The final, and typical case, is that of an item with a percent status - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString7, - #else - swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", - #endif ItemNames[ usItem ], //Item long name sValue, //Item condition gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } break; } From 33e8c1dc3999ef7ab5430bad9b8fbfeb76701b74 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:20:31 -0300 Subject: [PATCH 045/118] Move all the translated strings over to i18n It's where all conditional language preprocessor goes --- Utils/CMakeLists.txt | 17 ----------------- i18n/CMakeLists.txt | 17 +++++++++++++++++ {Utils => i18n}/ExportStrings.cpp | 0 {Utils => i18n}/_ChineseText.cpp | 0 {Utils => i18n}/_DutchText.cpp | 0 {Utils => i18n}/_EnglishText.cpp | 0 {Utils => i18n}/_FrenchText.cpp | 0 {Utils => i18n}/_GermanText.cpp | 0 {Utils => i18n}/_ItalianText.cpp | 0 {Utils => i18n}/_Ja25ChineseText.cpp | 0 {Utils => i18n}/_Ja25DutchText.cpp | 0 {Utils => i18n}/_Ja25EnglishText.cpp | 0 {Utils => i18n}/_Ja25FrenchText.cpp | 0 {Utils => i18n}/_Ja25GermanText.cpp | 0 {Utils => i18n}/_Ja25ItalianText.cpp | 0 {Utils => i18n}/_Ja25PolishText.cpp | 0 {Utils => i18n}/_Ja25RussianText.cpp | 0 {Utils => i18n}/_PolishText.cpp | 0 {Utils => i18n}/_RussianText.cpp | 0 {Utils => i18n/include}/ExportStrings.h | 0 {Utils => i18n/include}/_Ja25DutchText.h | 0 {Utils => i18n/include}/_Ja25EnglishText.h | 0 {Utils => i18n/include}/_Ja25FrenchText.h | 0 {Utils => i18n/include}/_Ja25GermanText.h | 0 {Utils => i18n/include}/_Ja25ItalianText.h | 0 {Utils => i18n/include}/_Ja25PolishText.h | 0 {Utils => i18n/include}/_Ja25RussianText.h | 0 27 files changed, 17 insertions(+), 17 deletions(-) rename {Utils => i18n}/ExportStrings.cpp (100%) rename {Utils => i18n}/_ChineseText.cpp (100%) rename {Utils => i18n}/_DutchText.cpp (100%) rename {Utils => i18n}/_EnglishText.cpp (100%) rename {Utils => i18n}/_FrenchText.cpp (100%) rename {Utils => i18n}/_GermanText.cpp (100%) rename {Utils => i18n}/_ItalianText.cpp (100%) rename {Utils => i18n}/_Ja25ChineseText.cpp (100%) rename {Utils => i18n}/_Ja25DutchText.cpp (100%) rename {Utils => i18n}/_Ja25EnglishText.cpp (100%) rename {Utils => i18n}/_Ja25FrenchText.cpp (100%) rename {Utils => i18n}/_Ja25GermanText.cpp (100%) rename {Utils => i18n}/_Ja25ItalianText.cpp (100%) rename {Utils => i18n}/_Ja25PolishText.cpp (100%) rename {Utils => i18n}/_Ja25RussianText.cpp (100%) rename {Utils => i18n}/_PolishText.cpp (100%) rename {Utils => i18n}/_RussianText.cpp (100%) rename {Utils => i18n/include}/ExportStrings.h (100%) rename {Utils => i18n/include}/_Ja25DutchText.h (100%) rename {Utils => i18n/include}/_Ja25EnglishText.h (100%) rename {Utils => i18n/include}/_Ja25FrenchText.h (100%) rename {Utils => i18n/include}/_Ja25GermanText.h (100%) rename {Utils => i18n/include}/_Ja25ItalianText.h (100%) rename {Utils => i18n/include}/_Ja25PolishText.h (100%) rename {Utils => i18n/include}/_Ja25RussianText.h (100%) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 688f9555..ebf13645 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -7,7 +7,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/dsutil.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Encrypted File.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Event Pump.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Font Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ImportStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/INIReader.cpp" @@ -37,20 +36,4 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/XML_Items.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Language.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_SenderNameList.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_ChineseText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_DutchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_EnglishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_FrenchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_GermanText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_ItalianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ChineseText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25DutchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25EnglishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25FrenchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25GermanText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ItalianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25PolishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" PARENT_SCOPE) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 6c40cf61..8f36adea 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,5 +1,22 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_ChineseText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_DutchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_EnglishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_FrenchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_GermanText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_ItalianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ChineseText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25DutchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25EnglishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25FrenchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25GermanText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ItalianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25PolishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" PARENT_SCOPE ) diff --git a/Utils/ExportStrings.cpp b/i18n/ExportStrings.cpp similarity index 100% rename from Utils/ExportStrings.cpp rename to i18n/ExportStrings.cpp diff --git a/Utils/_ChineseText.cpp b/i18n/_ChineseText.cpp similarity index 100% rename from Utils/_ChineseText.cpp rename to i18n/_ChineseText.cpp diff --git a/Utils/_DutchText.cpp b/i18n/_DutchText.cpp similarity index 100% rename from Utils/_DutchText.cpp rename to i18n/_DutchText.cpp diff --git a/Utils/_EnglishText.cpp b/i18n/_EnglishText.cpp similarity index 100% rename from Utils/_EnglishText.cpp rename to i18n/_EnglishText.cpp diff --git a/Utils/_FrenchText.cpp b/i18n/_FrenchText.cpp similarity index 100% rename from Utils/_FrenchText.cpp rename to i18n/_FrenchText.cpp diff --git a/Utils/_GermanText.cpp b/i18n/_GermanText.cpp similarity index 100% rename from Utils/_GermanText.cpp rename to i18n/_GermanText.cpp diff --git a/Utils/_ItalianText.cpp b/i18n/_ItalianText.cpp similarity index 100% rename from Utils/_ItalianText.cpp rename to i18n/_ItalianText.cpp diff --git a/Utils/_Ja25ChineseText.cpp b/i18n/_Ja25ChineseText.cpp similarity index 100% rename from Utils/_Ja25ChineseText.cpp rename to i18n/_Ja25ChineseText.cpp diff --git a/Utils/_Ja25DutchText.cpp b/i18n/_Ja25DutchText.cpp similarity index 100% rename from Utils/_Ja25DutchText.cpp rename to i18n/_Ja25DutchText.cpp diff --git a/Utils/_Ja25EnglishText.cpp b/i18n/_Ja25EnglishText.cpp similarity index 100% rename from Utils/_Ja25EnglishText.cpp rename to i18n/_Ja25EnglishText.cpp diff --git a/Utils/_Ja25FrenchText.cpp b/i18n/_Ja25FrenchText.cpp similarity index 100% rename from Utils/_Ja25FrenchText.cpp rename to i18n/_Ja25FrenchText.cpp diff --git a/Utils/_Ja25GermanText.cpp b/i18n/_Ja25GermanText.cpp similarity index 100% rename from Utils/_Ja25GermanText.cpp rename to i18n/_Ja25GermanText.cpp diff --git a/Utils/_Ja25ItalianText.cpp b/i18n/_Ja25ItalianText.cpp similarity index 100% rename from Utils/_Ja25ItalianText.cpp rename to i18n/_Ja25ItalianText.cpp diff --git a/Utils/_Ja25PolishText.cpp b/i18n/_Ja25PolishText.cpp similarity index 100% rename from Utils/_Ja25PolishText.cpp rename to i18n/_Ja25PolishText.cpp diff --git a/Utils/_Ja25RussianText.cpp b/i18n/_Ja25RussianText.cpp similarity index 100% rename from Utils/_Ja25RussianText.cpp rename to i18n/_Ja25RussianText.cpp diff --git a/Utils/_PolishText.cpp b/i18n/_PolishText.cpp similarity index 100% rename from Utils/_PolishText.cpp rename to i18n/_PolishText.cpp diff --git a/Utils/_RussianText.cpp b/i18n/_RussianText.cpp similarity index 100% rename from Utils/_RussianText.cpp rename to i18n/_RussianText.cpp diff --git a/Utils/ExportStrings.h b/i18n/include/ExportStrings.h similarity index 100% rename from Utils/ExportStrings.h rename to i18n/include/ExportStrings.h diff --git a/Utils/_Ja25DutchText.h b/i18n/include/_Ja25DutchText.h similarity index 100% rename from Utils/_Ja25DutchText.h rename to i18n/include/_Ja25DutchText.h diff --git a/Utils/_Ja25EnglishText.h b/i18n/include/_Ja25EnglishText.h similarity index 100% rename from Utils/_Ja25EnglishText.h rename to i18n/include/_Ja25EnglishText.h diff --git a/Utils/_Ja25FrenchText.h b/i18n/include/_Ja25FrenchText.h similarity index 100% rename from Utils/_Ja25FrenchText.h rename to i18n/include/_Ja25FrenchText.h diff --git a/Utils/_Ja25GermanText.h b/i18n/include/_Ja25GermanText.h similarity index 100% rename from Utils/_Ja25GermanText.h rename to i18n/include/_Ja25GermanText.h diff --git a/Utils/_Ja25ItalianText.h b/i18n/include/_Ja25ItalianText.h similarity index 100% rename from Utils/_Ja25ItalianText.h rename to i18n/include/_Ja25ItalianText.h diff --git a/Utils/_Ja25PolishText.h b/i18n/include/_Ja25PolishText.h similarity index 100% rename from Utils/_Ja25PolishText.h rename to i18n/include/_Ja25PolishText.h diff --git a/Utils/_Ja25RussianText.h b/i18n/include/_Ja25RussianText.h similarity index 100% rename from Utils/_Ja25RussianText.h rename to i18n/include/_Ja25RussianText.h From 5fb989a1fc429de8512abe958c1d7a23ccc6bd94 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:29:55 -0300 Subject: [PATCH 046/118] Move Text.h over to i18n too Never use relative paths for #includes. Didn't touch the rest because out of scope. --- ModularizedTacticalAI/src/LegacyAIPlan.cpp | 2 +- {Utils => i18n/include}/Text.h | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {Utils => i18n/include}/Text.h (100%) diff --git a/ModularizedTacticalAI/src/LegacyAIPlan.cpp b/ModularizedTacticalAI/src/LegacyAIPlan.cpp index f08340ee..d672870e 100644 --- a/ModularizedTacticalAI/src/LegacyAIPlan.cpp +++ b/ModularizedTacticalAI/src/LegacyAIPlan.cpp @@ -15,7 +15,7 @@ #include "../../TileEngine/Isometric Utils.h" // defines NOWHERE #include "../../Utils/Debug Control.h" // LiveMessage #include "../../Utils/Font Control.h" // ScreenMsg about deadlock -#include "../../Utils/Text.h" // Sniper warning +#include // Sniper warning #include "../../Utils/message.h" // ditto diff --git a/Utils/Text.h b/i18n/include/Text.h similarity index 100% rename from Utils/Text.h rename to i18n/include/Text.h From cf0b4dfc4039a486f034089dd7930744ba4b4cef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:25:43 -0300 Subject: [PATCH 047/118] Manual unrolling preprocessor stuff and added function This function is just for GERMAN but it has a unique name so it's no problem. Had to slightly change how MercID gets populated --- Ja2/jascreens.cpp | 2 -- Laptop/AimMembers.cpp | 16 +++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 87d04505..9e7df483 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -959,7 +959,6 @@ void DoneFadeOutForDemoExitScreen( void ) // unused //extern INT8 gbFadeSpeed; -#ifdef GERMAN void DisplayTopwareGermanyAddress() { VOBJECT_DESC vo_desc; @@ -994,7 +993,6 @@ void DisplayTopwareGermanyAddress() ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); } -#endif UINT32 DemoExitScreenHandle(void) { diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 0c1e2f37..490d0a63 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -5367,11 +5367,17 @@ BOOLEAN DisplayShadedStretchedMercFace( UINT8 ubMercID, UINT16 usPosX, UINT16 us void DemoHiringOfMercs( ) { INT16 i; - #ifdef GERMAN - UINT8 MercID[]={ 7, 10, 4, 14, 50 }; - #else - UINT8 MercID[]={ 7, 10, 4, 42, 33 }; - #endif + UINT8 MercID[5]; + MercID[0] = 7; + MercID[1] = 10; + MercID[2] = 4; + if( g_lang == i18n::Lang::de ) { + MercID[3] = 14; + MercID[4] = 50; + } else { + MercID[3] = 42; + MercID[4] = 33; + } MERC_HIRE_STRUCT HireMercStruct; static BOOLEAN fHaveCalledBefore=FALSE; From 4b563fefc897b9ac6106c3cb0573880eaf0ba6f1 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 09:41:32 -0300 Subject: [PATCH 048/118] Slightly clunkier fix for RUSSIAN conditional --- Tactical/Dialogue Control.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index cb646341..00b32f72 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -67,6 +67,7 @@ #include "ub_config.h" #include "history.h" +#include //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -2407,8 +2408,8 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN { if ( fWavFile ) { -#ifdef RUSSIAN - if ( ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || + if ( g_lang == i18n::Lang::ru && + ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { @@ -2426,7 +2427,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN #endif } else -#endif + { // build name of wav file (characternum + quotenum) sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); From ecdc8916f2b6b3b1fd3da359423f1393d12b2525 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 09:59:23 -0300 Subject: [PATCH 049/118] Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n Just awful --- Laptop/BobbyR.h | 1 + Laptop/BobbyRGuns.cpp | 7 ------- i18n/include/language.hpp | 2 ++ i18n/language.cpp | 9 +++++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h index 486a9a80..6d011960 100644 --- a/Laptop/BobbyR.h +++ b/Laptop/BobbyR.h @@ -25,6 +25,7 @@ void RenderBobbyR(); #define BOBBYR_GRIDLOC_X LAPTOP_SCREEN_UL_X + 4 #define BOBBYR_GRIDLOC_Y LAPTOP_SCREEN_WEB_UL_Y + 5 //LAPTOP_SCREEN_WEB_UL_Y + 45 +#define BOBBYR_ORDER_NUM_WIDTH 15 /* extern UINT16 gusFirstGunIndex; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index ac9855fc..15613004 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -87,7 +87,6 @@ #define BOBBYR_ITEM_NAME_X BOBBYR_GRIDLOC_X + 6 #define BOBBYR_ITEM_NAME_Y_OFFSET 54 -#define BOBBYR_ORDER_NUM_WIDTH 15 #define BOBBYR_ORDER_NUM_X BOBBYR_GRIDLOC_X + 120 - BOBBYR_ORDER_NUM_WIDTH //BOBBYR_ITEM_STOCK_TEXT_X #define BOBBYR_ORDER_NUM_Y_OFFSET 1 @@ -116,12 +115,6 @@ #define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 #define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 -#ifdef CHINESE - #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH - 10 //BOBBYR_ITEM_QTY_NUM_X -#else - #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X -#endif - #define BOBBY_RAY_NOT_PURCHASED 255 #define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index bd895bcc..e88fbe5a 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -20,4 +20,6 @@ extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; +extern const int BOBBYR_ITEMS_BOUGHT_X; + auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 555b33c2..25b0c816 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -1,5 +1,8 @@ #include +#include +#include + /* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language * (ideally text and voice separately) be set in the options menu would be * ideal. */ @@ -31,6 +34,12 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ #endif }; +const int BOBBYR_ITEMS_BOUGHT_X{BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH +#ifdef CHINESE + - 10 +#endif +}; + auto GetLanguagePrefix() -> const STR { return #if defined(ENGLISH) From b15c4ef96c2d3e4a599201388ef5ab7c522c6988 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 31 Dec 2024 08:44:03 -0300 Subject: [PATCH 050/118] the really gnarly CHINESE #ifdef conversions these seem to be right, chinese text appears to be flowing correctly --- Utils/WordWrap.cpp | 88 +++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index 3368c2f9..900193c7 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -5,6 +5,7 @@ #include "Stdio.h" #include "WinFont.h" +#include #define SINGLE_CHARACTER_WORD_FOR_WORDWRAP @@ -224,8 +225,9 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW } - if((usCurrentWidthPixels > usLineWidthPixels) -#ifdef CHINESE + if( (g_lang != i18n::Lang::zh && usCurrentWidthPixels > usLineWidthPixels) + || + (g_lang == i18n::Lang::zh && usCurrentWidthPixels > usLineWidthPixels && TempString[usCurIndex] != L',' && TempString[usCurIndex] != L'。' && TempString[usCurIndex] != L';' @@ -237,8 +239,8 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW && TempString[usCurIndex] != L'?' && TempString[usCurIndex] != L')' && TempString[usCurIndex] != L')' -#endif )//||(DestString[ usDestIndex ]==NEWLINE_CHAR )||(fNewLine)) +) { //if an error has occured, and the string is too long @@ -250,11 +252,10 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW usLastMaxWidthIndex = usDestIndex; //Go back to begining of word - while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0) && (usDestIndex > 0) -#ifdef CHINESE - && DestString[usDestIndex] < 255 -#endif - ) + while( + (g_lang != i18n::Lang::zh && DestString[ usDestIndex ] != L' ' && usCurIndex > 0 && usDestIndex > 0) + || + (g_lang == i18n::Lang::zh && DestString[ usDestIndex ] != L' ' && usCurIndex > 0 && usDestIndex > 0 && DestString[usDestIndex] < 255)) { OneChar[0] = DestString[ usDestIndex ]; @@ -263,8 +264,7 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW usCurIndex--; usDestIndex--; } -#ifdef CHINESE - if (DestString[usDestIndex] > 255) + if (g_lang == i18n::Lang::zh && DestString[usDestIndex] > 255) { if (DestString[usDestIndex] == L',' || DestString[usDestIndex] == L',' @@ -282,7 +282,7 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW else {usCurIndex--;} } -#endif + usEndIndex = usDestIndex; // OJW - 20090427 @@ -576,21 +576,19 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN { // each character goes towards building a new word -#ifdef CHINESE //zwwooooo: Chinese Text is not need SPACE to segmentation words, so need another process - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] < 255) { +//zwwooooo: Chinese Text is not need SPACE to segmentation words, so need another process + if ( + (g_lang == i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] < 255) + || + (g_lang != i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + ) { zWordString[usDestCounter++] = pString[usSourceCounter]; } else { + if(g_lang == i18n::Lang::zh) { zWordString[usDestCounter++] = pString[usSourceCounter]; -#else - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) - { - zWordString[usDestCounter++] = pString[usSourceCounter]; - } - else - { -#endif + } // we hit a space (or end of record), so this is the END of a word! // is this a special CODE? @@ -924,12 +922,11 @@ DEF: commented out for Beta. Nov 30 // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE //zwwooooo: Chinese Text don't need add space -#else +if(g_lang != i18n::Lang::zh) { // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; -#endif +} // RE-terminate the string zWordString[usDestCounter] = 0; @@ -1381,33 +1378,33 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt } else // not a special character { -#ifdef CHINESE wchar_t currentChar=pString[usSourceCounter]; - if (currentChar> 255 ) + if (g_lang == i18n::Lang::zh && currentChar> 255 ) { if (usDestCounter == 0) {zWordString[usDestCounter++] = currentChar;} else {usSourceCounter--;} } -#endif // terminate the string TEMPORARILY zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE - if (currentChar <= 255) -#endif + if (g_lang != i18n::Lang::zh || + g_lang == i18n::Lang::zh && currentChar <= 255) { // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; + } // RE-terminate the string zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? - if ((usLineLengthPixels + usWordLengthPixels) < usWidth -#ifdef CHINESE + if ( + (g_lang != i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) < usWidth) + || + (g_lang == i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) < usWidth || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L'。' @@ -1420,7 +1417,7 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt || pString[usSourceCounter] == L'?' || pString[usSourceCounter] == L')' || pString[usSourceCounter] == L')' -#endif +) ) { // yes we can fit this word. @@ -1506,10 +1503,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT do { // each character goes towards building a new word - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 -#ifdef CHINESE - && pString[usSourceCounter] <= 255 -#endif + if ( + (g_lang != i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + || + (g_lang == i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] <= 255) ) { zWordString[usDestCounter++] = pString[usSourceCounter]; @@ -1723,24 +1720,20 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT } else // not a special character { -#ifdef CHINESE wchar_t currentChar = pString[usSourceCounter]; - if (currentChar > 255 ) + if (g_lang == i18n::Lang::zh && currentChar > 255 ) { if (usDestCounter == 0) {zWordString[usDestCounter++] = currentChar;} else {usSourceCounter--;} } -#endif // terminate the string TEMPORARILY zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE - if (currentChar <= 255) -#endif + if (g_lang == i18n::Lang::zh && currentChar <= 255) // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; @@ -1748,8 +1741,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? - if ((usLineLengthPixels + usWordLengthPixels) <= usWidth -#ifdef CHINESE + if ( + (g_lang != i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) <= usWidth) + || + (g_lang == i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) <= usWidth || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L'。' @@ -1759,8 +1754,7 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT || pString[usSourceCounter] == L':' || pString[usSourceCounter] == L')' || pString[usSourceCounter] == L')' -#endif - ) + )) { // yes we can fit this word. From 70f09471c21c9f7ceea931a1b143d9d8d5db0ee0 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:22:06 -0300 Subject: [PATCH 051/118] just cast g_lang into lua's language code because magically I got the enum order right first try --- Strategic/LuaInitNPCs.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 519dc005..721a5a44 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -96,6 +96,7 @@ extern "C" { #include "Merc Contract.h" #include "message.h" #include "Town Militia.h" +#include extern UINT8 gubWaitingForAllMercsToExitCode; @@ -13208,26 +13209,7 @@ static int l_GetUsedLanguage( lua_State *L ) { if ( lua_gettop( L ) ) { - INT32 val = 0; - -#if defined(ENGLISH) - val = 0; -#elif defined(GERMAN) - val = 1; -#elif defined(RUSSIAN) - val = 2; -#elif defined(DUTCH) - val = 3; -#elif defined(POLISH) - val = 4; -#elif defined(FRENCH) - val = 5; -#elif defined(ITALIAN) - val = 6; -#elif defined(CHINESE) - val = 7; -#endif - + INT32 val = static_cast(g_lang); lua_pushinteger( L, val ); } From 4a7625cef0b41205b90d7059e9a1bd06cfa9da2d Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:27:00 -0300 Subject: [PATCH 052/118] Slightly clunky RUSSIAN conversion --- Laptop/IMP Begin Screen.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 846666ec..41141ab5 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -24,6 +24,7 @@ #include "text.h" #include "LaptopSave.h" +#include #define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138 #define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195 @@ -552,7 +553,7 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) //Heinz (18.01.2009): Russian layout // ViSoR (07.01.2012) : Russian and Belarussian layouts // -#if defined(RUSSIAN) || defined(BELARUSSIAN) +if(g_lang == i18n::Lang::ru) { // ViSoR (02.02.2013): Fix for Cyrillic layouts DWORD threadId = GetWindowThreadProcessId( ghWindow, 0 ); DWORD layout = (DWORD)GetKeyboardLayout( threadId ) & 0xFFFF; @@ -574,17 +575,16 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) } else if( !CheckIsKeyValid( uiKey ) ) uiKey = '#'; - - if( uiKey != '#') -#else - if( uiKey >= 'A' && uiKey <= 'Z' || +} + if( (g_lang != i18n::Lang::ru && + uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey == ' ' || uiKey == '"' || uiKey == 39 // This is ' which cannot be written explicitly here of course - ) -#endif + ) || + uiKey != '#') { // if the current string position is at max or great, do nothing switch( ubTextEnterMode ) From cccec0ef111fd7e7c83d3c39d145c53dfa351ace Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:29:24 -0300 Subject: [PATCH 053/118] straggler in Utils/Font Control.cpp --- Utils/Font Control.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Utils/Font Control.cpp b/Utils/Font Control.cpp index 87c140f5..efb10ba5 100644 --- a/Utils/Font Control.cpp +++ b/Utils/Font Control.cpp @@ -5,6 +5,7 @@ #include "vsurface.h" #include "wcheck.h" #include "Font Control.h" +#include INT32 giCurWinFont = 0; //BOOLEAN gfUseWinFonts = FALSE; @@ -77,8 +78,8 @@ HVOBJECT gvoBlockFontNarrow; INT32 gp14PointHumanist; HVOBJECT gvo14PointHumanist; -#if defined( JA2EDITOR ) && defined( ENGLISH ) - INT32 gpHugeFont; +#if defined( JA2EDITOR ) + INT32 gpHugeFont; HVOBJECT gvoHugeFont; #endif @@ -94,8 +95,8 @@ UINT16 CreateFontPaletteTables(HVOBJECT pObj ); extern UINT16 gzFontName[32]; auto GetHugeFont() -> INT32 { -#if defined(JA2EDITOR) && defined(ENGLISH) - return gpHugeFont; +#if defined(JA2EDITOR) + return g_lang == i18n::Lang::en ? gpHugeFont : gp16PointArial; #else return gp16PointArial; #endif @@ -216,10 +217,12 @@ BOOLEAN InitializeFonts( ) gvo14PointHumanist = GetFontObject( gp14PointHumanist ); CHECKF( CreateFontPaletteTables( gvo14PointHumanist ) ); - #if defined( JA2EDITOR ) && defined( ENGLISH ) + #if defined( JA2EDITOR ) + if(g_lang == i18n::Lang::en) { gpHugeFont = LoadFontFile( "FONTS\\HUGEFONT.sti" ); gvoHugeFont = GetFontObject( gpHugeFont ); CHECKF( CreateFontPaletteTables( gvoHugeFont ) ); + } #endif // Set default for font system @@ -254,8 +257,10 @@ void ShutdownFonts( ) UnloadFont( gp14PointArial); UnloadFont( gpBlockyFont); UnloadFont( gp12PointArialFixedFont ); - #if defined( JA2EDITOR ) && defined( ENGLISH ) + #if defined( JA2EDITOR ) + if(g_lang == i18n::Lang::en) { UnloadFont( gpHugeFont ); + } #endif // ATE: Shutdown any win fonts From 9ed713f9522418250773c20f0b77f54379b426f6 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:41:35 -0300 Subject: [PATCH 054/118] move Utils/Multi Language Graphic Utils.* to i18n has language preprocessor silliness, straight to jail --- Utils/CMakeLists.txt | 1 - i18n/CMakeLists.txt | 1 + {Utils => i18n}/Multi Language Graphic Utils.cpp | 0 {Utils => i18n/include}/Multi Language Graphic Utils.h | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename {Utils => i18n}/Multi Language Graphic Utils.cpp (100%) rename {Utils => i18n/include}/Multi Language Graphic Utils.h (100%) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index ebf13645..537e2335 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -15,7 +15,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/MapUtility.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MercTextBox.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/message.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Multilingual Text Code Generator.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Music Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/PopUpBox.cpp" diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 8f36adea..6d200975 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -18,5 +18,6 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp" PARENT_SCOPE ) diff --git a/Utils/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp similarity index 100% rename from Utils/Multi Language Graphic Utils.cpp rename to i18n/Multi Language Graphic Utils.cpp diff --git a/Utils/Multi Language Graphic Utils.h b/i18n/include/Multi Language Graphic Utils.h similarity index 100% rename from Utils/Multi Language Graphic Utils.h rename to i18n/include/Multi Language Graphic Utils.h From 10037291f38ded8a7316d2f091b7689969aa7cef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 03:54:28 -0300 Subject: [PATCH 055/118] remove preprocessor from i18n Multi Language Graphic Utils.cpp --- i18n/Multi Language Graphic Utils.cpp | 33 ++++++++++----------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/i18n/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp index 4d444fb9..af383bd7 100644 --- a/i18n/Multi Language Graphic Utils.cpp +++ b/i18n/Multi Language Graphic Utils.cpp @@ -6,10 +6,11 @@ //SB #include "FileMan.h" +#include BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) { - #if defined( ENGLISH ) + if( g_lang == i18n::Lang::en ) { switch( usMLGGraphicID ) { case MLG_AIMSYMBOL: @@ -141,7 +142,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #elif defined( GERMAN ) + } else if( g_lang == i18n::Lang::de ) { switch( usMLGGraphicID ) { case MLG_AIMSYMBOL: @@ -279,7 +280,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #else + } else { UINT8 zLanguage[64]; @@ -292,29 +293,19 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) // // "GERMAN\\IMPSymbol_German.sti" - #if defined( DUTCH ) + if(g_lang == i18n::Lang::nl) { sprintf( (char *)zLanguage, "DUTCH" ); - #elif defined( FRENCH ) + } else if(g_lang == i18n::Lang::fr) { sprintf( (char *)zLanguage, "FRENCH" ); - #elif defined( GERMAN ) - sprintf( (char *)zLanguage, "GERMAN" ); - #elif defined( ITALIAN ) + } else if(g_lang == i18n::Lang::it) { sprintf( (char *)zLanguage, "ITALIAN" ); - #elif defined( JAPANESE ) - sprintf( (char *)zLanguage, "JAPANESE" ); - #elif defined( KOREAN ) - sprintf( (char *)zLanguage, "KOREAN" ); - #elif defined( POLISH ) + } else if(g_lang == i18n::Lang::pl) { sprintf( (char *)zLanguage, "POLISH" ); - #elif defined( RUSSIAN ) + } else if(g_lang == i18n::Lang::ru) { sprintf( (char *)zLanguage, "RUSSIAN" ); - #elif defined( SPANISH ) - sprintf( (char *)zLanguage, "SPANISH" ); - #elif defined( CHINESE ) + } else if(g_lang == i18n::Lang::zh) { sprintf( (char *)zLanguage, "CHINESE" ); - #else - # error "At least You have to specify a Language somewhere. See comments above." - #endif + } //SB: Also check for russian Gold version, like English switch( usMLGGraphicID ) @@ -584,7 +575,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #endif + } return FALSE; } From e9686c0dcad7a2e396d2fa3c1175e1bafb6f395f Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 14:38:08 -0300 Subject: [PATCH 056/118] reformat CMakeLists.txt --- CMakeLists.txt | 128 ++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1842724..71e351a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,12 @@ endif() option(ADDRESS_SANITIZER OFF) if(ADDRESS_SANITIZER) - message(STATUS "AddressSanitizer ENABLED for non-Release builds") - add_compile_options($,$>,-fsanitize=address,>) + message(STATUS "AddressSanitizer ENABLED for non-Release builds") + add_compile_options($,$>,-fsanitize=address,>) endif() if(MSVC) - add_compile_options("/wd4838") + add_compile_options("/wd4838") endif() # whether we are using MSBuild as a generator @@ -39,22 +39,22 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE) include_directories( - "${CMAKE_SOURCE_DIR}/Ja2" - "${CMAKE_SOURCE_DIR}/ext/VFS/include" - "${CMAKE_SOURCE_DIR}/Utils" - "${CMAKE_SOURCE_DIR}/TileEngine" - "${CMAKE_SOURCE_DIR}/TacticalAI" - "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" - "${CMAKE_SOURCE_DIR}/Tactical" - "${CMAKE_SOURCE_DIR}/Strategic" - "${CMAKE_SOURCE_DIR}/sgp" - "${CMAKE_SOURCE_DIR}/Ja2/Res" - "${CMAKE_SOURCE_DIR}/Lua" - "${CMAKE_SOURCE_DIR}/Laptop" - "${CMAKE_SOURCE_DIR}/Multiplayer" - "${CMAKE_SOURCE_DIR}/Editor" - "${CMAKE_SOURCE_DIR}/Console" - "${CMAKE_SOURCE_DIR}/i18n/include" + "${CMAKE_SOURCE_DIR}/Ja2" + "${CMAKE_SOURCE_DIR}/ext/VFS/include" + "${CMAKE_SOURCE_DIR}/Utils" + "${CMAKE_SOURCE_DIR}/TileEngine" + "${CMAKE_SOURCE_DIR}/TacticalAI" + "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" + "${CMAKE_SOURCE_DIR}/Tactical" + "${CMAKE_SOURCE_DIR}/Strategic" + "${CMAKE_SOURCE_DIR}/sgp" + "${CMAKE_SOURCE_DIR}/Ja2/Res" + "${CMAKE_SOURCE_DIR}/Lua" + "${CMAKE_SOURCE_DIR}/Laptop" + "${CMAKE_SOURCE_DIR}/Multiplayer" + "${CMAKE_SOURCE_DIR}/Editor" + "${CMAKE_SOURCE_DIR}/Console" + "${CMAKE_SOURCE_DIR}/i18n/include" ) # external libraries @@ -76,20 +76,20 @@ add_subdirectory(Multiplayer) # by header files rely on Application and Language preprocessor definitions, and # therefore need to be compiled multiple times. Very Bad. set(Ja2_Libs -TileEngine -TacticalAI -Utils -Strategic -sgp -Laptop -Editor -Console -Tactical -ModularizedTacticalAI -i18n + TileEngine + TacticalAI + Utils + Strategic + sgp + Laptop + Editor + Console + Tactical + ModularizedTacticalAI + i18n ) foreach(lib IN LISTS Ja2_Libs) - add_subdirectory(${lib}) + add_subdirectory(${lib}) endforeach() add_subdirectory(Ja2) @@ -111,43 +111,43 @@ set(debugFlags $,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBU # every library-language-executable combination is its own compilation target # TODO: refactor preprocessor usage onto, ideally, a single translation unit foreach(lang IN LISTS LangTargets) - foreach(exe IN LISTS ApplicationTargets) - set(Executable ${exe}_${lang}) + foreach(exe IN LISTS ApplicationTargets) + set(Executable ${exe}_${lang}) - # executable for an application/language combination, e.g. JA2_ENGLISH.exe - add_executable(${Executable} WIN32) - target_sources(${Executable} PRIVATE ${Ja2Src}) + # executable for an application/language combination, e.g. JA2_ENGLISH.exe + add_executable(${Executable} WIN32) + target_sources(${Executable} PRIVATE ${Ja2Src}) - # Good libraries have already been built, can be simply linked here - target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) - target_link_options(${Executable} PRIVATE $) + # Good libraries have already been built, can be simply linked here + target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) + target_link_options(${Executable} PRIVATE $) - # for each app/lang combination, the Very Bad libraries need to be built, - # with the appropriate preprocessor definitions - foreach(lib IN LISTS Ja2_Libs) - # syntactic sugar to hopefully make this more readable - set(VeryBadLib ${Executable}_${lib}) - set(isEditor $) - set(isUb $) - set(isUbEditor $) + # for each app/lang combination, the Very Bad libraries need to be built, + # with the appropriate preprocessor definitions + foreach(lib IN LISTS Ja2_Libs) + # syntactic sugar to hopefully make this more readable + set(VeryBadLib ${Executable}_${lib}) + set(isEditor $) + set(isUb $) + set(isUbEditor $) - # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib - add_library(${VeryBadLib}) - target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) + # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib + add_library(${VeryBadLib}) + target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) - target_compile_definitions(${VeryBadLib} PUBLIC - $ - $ - $ - ${debugFlags} - ${lang} - ) - target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) - endforeach() + target_compile_definitions(${VeryBadLib} PUBLIC + $ + $ + $ + ${debugFlags} + ${lang} + ) + target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) + endforeach() - # for sgp only - target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") - target_link_libraries(${Executable}_sgp PUBLIC libpng) - target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) - endforeach() + # for sgp only + target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") + target_link_libraries(${Executable}_sgp PUBLIC libpng) + target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) + endforeach() endforeach() From 959c29434eddce5a1537e2af72d5e6858a092502 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 16:33:29 -0300 Subject: [PATCH 057/118] Adjust the build system Language is now just built once per app (still some JA2UB conditionals going on in there) but building everything should now take eight times less work --- .gitignore | 2 + CMakeLists.txt | 125 ++++++++++++++++++++++++--------------------- Ja2/CMakeLists.txt | 14 ----- TODO | 1 + 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/.gitignore b/.gitignore index 6466f05c..5ef609a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +dummy.cpp + # CLion /.idea/ /cmake-build-*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 71e351a8..9f642790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,33 +66,44 @@ target_link_libraries(bfVFS PRIVATE 7z) # ja2export utility add_subdirectory("ext/export/src") -# static libraries whose source files, header files or header files included -# by header files do not rely on Applications or Languages preprocessor definitions, -# and therefore only need to be compiled once. Good. +# static libraries whose translation units don't rely on Application preprocessor definitions. add_subdirectory(Lua) add_subdirectory(Multiplayer) -# static libraries whose source files, header files or header files included -# by header files rely on Application and Language preprocessor definitions, and -# therefore need to be compiled multiple times. Very Bad. +set(Ja2_Libraries +"${CMAKE_SOURCE_DIR}/binkw32.lib" +"${CMAKE_SOURCE_DIR}/libexpatMT.lib" +"${CMAKE_SOURCE_DIR}/lua51.lib" +"${CMAKE_SOURCE_DIR}/lua51.vc9.lib" +"${CMAKE_SOURCE_DIR}/SMACKW32.LIB" +"Dbghelp.lib" +"Winmm.lib" +"ws2_32.lib" +bfVFS +Lua +Multiplayer +) + +# static libraries whose translation units rely on Application preprocessor definitions. set(Ja2_Libs - TileEngine - TacticalAI - Utils - Strategic - sgp - Laptop - Editor Console - Tactical + Editor + Ja2 + Laptop ModularizedTacticalAI - i18n + sgp + Strategic + Tactical + TacticalAI + TileEngine + Utils ) foreach(lib IN LISTS Ja2_Libs) add_subdirectory(${lib}) endforeach() -add_subdirectory(Ja2) +# language library relies on Application _and_ Language preprocessor definition. very bad. +add_subdirectory(i18n) # simple function to validate Languages and Application choices include(cmake/ValidateOptions.cmake) @@ -107,47 +118,47 @@ ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "Applica # preprocessor definitions for Debug build, per the legacy MSBuild set(debugFlags $,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>) -# Due to widespread preprocessor definition abuse in the codebase, practically -# every library-language-executable combination is its own compilation target -# TODO: refactor preprocessor usage onto, ideally, a single translation unit -foreach(lang IN LISTS LangTargets) - foreach(exe IN LISTS ApplicationTargets) - set(Executable ${exe}_${lang}) +foreach(app IN LISTS ApplicationTargets) + set(isEditor $) + set(isUb $) + set(isUbEditor $) + set(compilationFlags + $ + $ + $ + ) - # executable for an application/language combination, e.g. JA2_ENGLISH.exe - add_executable(${Executable} WIN32) - target_sources(${Executable} PRIVATE ${Ja2Src}) - - # Good libraries have already been built, can be simply linked here - target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) - target_link_options(${Executable} PRIVATE $) - - # for each app/lang combination, the Very Bad libraries need to be built, - # with the appropriate preprocessor definitions - foreach(lib IN LISTS Ja2_Libs) - # syntactic sugar to hopefully make this more readable - set(VeryBadLib ${Executable}_${lib}) - set(isEditor $) - set(isUb $) - set(isUbEditor $) - - # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib - add_library(${VeryBadLib}) - target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) - - target_compile_definitions(${VeryBadLib} PUBLIC - $ - $ - $ - ${debugFlags} - ${lang} - ) - target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) - endforeach() - - # for sgp only - target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") - target_link_libraries(${Executable}_sgp PUBLIC libpng) - target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) + foreach(lib IN LISTS Ja2_Libs) + # library for an application, e.g. JA2UB_sgp + set(game_library ${app}_${lib}) + add_library(${game_library}) + target_sources(${game_library} PRIVATE ${${lib}Src}) + target_compile_definitions(${game_library} PRIVATE ${compilationFlags} ${debugFlags}) endforeach() + + foreach(lang IN LISTS LangTargets) + # executable for an application/language combination, e.g. JA2_ENGLISH.exe + set(exe ${app}_${lang}) + file(WRITE dummy.cpp "") + add_executable(${exe} WIN32 dummy.cpp) + target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) + target_link_options(${exe} PRIVATE $) + + # language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n + set(language_library ${exe}_i18n) + add_library(${language_library}) + target_sources(${language_library} PRIVATE ${i18nSrc}) + target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags} ${lang}) + target_link_libraries(${exe} PRIVATE ${language_library}) + + # go through all game libraries again and link them to the app/language executable + foreach(lib IN LISTS Ja2_Libs) + target_link_libraries(${exe} PRIVATE ${app}_${lib}) + endforeach() + endforeach() + + # for SGP only + target_link_libraries(${app}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") + target_link_libraries(${app}_sgp PRIVATE libpng) + target_compile_definitions(${app}_sgp PRIVATE NO_ZLIB_COMPRESSION) endforeach() diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index 7f8806f9..c990339d 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -36,17 +36,3 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp" ${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc PARENT_SCOPE) - -set(Ja2_Libraries -"${CMAKE_SOURCE_DIR}/libexpatMT.lib" -"Dbghelp.lib" -Lua -"${CMAKE_SOURCE_DIR}/lua51.lib" -"${CMAKE_SOURCE_DIR}/lua51.vc9.lib" -"Winmm.lib" -"${CMAKE_SOURCE_DIR}/SMACKW32.LIB" -"${CMAKE_SOURCE_DIR}/binkw32.lib" -bfVFS -"ws2_32.lib" -Multiplayer -PARENT_SCOPE) diff --git a/TODO b/TODO index e4bb3a3c..e2e87827 100644 --- a/TODO +++ b/TODO @@ -2,3 +2,4 @@ # priority (LOW,HIGH) and description LOW readd the C4838 (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4838) warning to CMakeLists.txt once they're all fixed in the code +HIGH get rid of ENGLISH, GERMAN, etc preprocessor definitions completely. that way i18n can be built just once and language can be changed in the options screen pending game restart (hotloading will likely require more work) From 7aafa7aada5940777f2c35da098077b4e6d091fc Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 1 Jan 2025 17:17:45 -0300 Subject: [PATCH 058/118] fix the GitHub actions for VS2022's quirk too missed this change in 98cdffe5, fix it now --- .github/workflows/build_language.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 1b7d6ee4..d233ef0f 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -59,7 +59,7 @@ jobs: run: | set -eux - touch CMakeUserPresets.json + touch CMakePresets.json JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]') JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]') From a7b0091a27a1942a5ed5521b86df9393dbf5bdcd Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 1 Jan 2025 17:08:38 -0300 Subject: [PATCH 059/118] use link-time optimization when creating a release it's a lot slower, but we don't release often --- .github/workflows/build_language.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index d233ef0f..0f97c733 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -54,6 +54,16 @@ jobs: sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp cat Ja2/GameVersion.cpp + - name: Turn on link-time optimization? + if: fromJSON(inputs.assemble) + shell: bash + run: | + set -eux + + echo " + LTO=ON + " >> $GITHUB_ENV + - name: Prepare build properties shell: bash run: | @@ -77,7 +87,7 @@ jobs: arch: x86 - name: Prepare build run: | - cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" + cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" -DLTO_OPTION="$Env:LTO" - name: Build run: | cmake --build build/ -- -v From b908bcecb92bd286bbbdd95a757f7aae8c068f8c Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 2 Jan 2025 07:33:39 -0300 Subject: [PATCH 060/118] fix missing icon in executable the Ja2.rc file needs to be in the add_executable target for the icon to appear, and that one requires WinMain. so get rid of dummy.cpp and put sgp/sgp.cpp in there --- .gitignore | 2 -- CMakeLists.txt | 6 ++++-- Ja2/CMakeLists.txt | 1 - sgp/CMakeLists.txt | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5ef609a7..6466f05c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -dummy.cpp - # CLion /.idea/ /cmake-build-*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f642790..532067ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,8 +139,10 @@ foreach(app IN LISTS ApplicationTargets) foreach(lang IN LISTS LangTargets) # executable for an application/language combination, e.g. JA2_ENGLISH.exe set(exe ${app}_${lang}) - file(WRITE dummy.cpp "") - add_executable(${exe} WIN32 dummy.cpp) + add_executable(${exe} WIN32 + sgp/sgp.cpp + Ja2/Res/Ja2.rc + ) target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) target_link_options(${exe} PRIVATE $) diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index c990339d..9b798987 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -34,5 +34,4 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp" -${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc PARENT_SCOPE) diff --git a/sgp/CMakeLists.txt b/sgp/CMakeLists.txt index c1df77f3..2a493d63 100644 --- a/sgp/CMakeLists.txt +++ b/sgp/CMakeLists.txt @@ -21,7 +21,6 @@ set(sgpSrc "${CMAKE_CURRENT_SOURCE_DIR}/PCX.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/PngLoader.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Random.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/sgp.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/sgp_logger.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/shading.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/soundman.cpp" From ed73bd07ae27ab584394e67593d1fb0a3b84dc46 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 2 Jan 2025 08:05:05 -0300 Subject: [PATCH 061/118] Revert "Make Chinese specific strings compile-time instead of conditional" When these lines were edited, I likely opened _ChineseText.cpp in the wrong encoding, and therefore saved it in the wrong encoding, mangling the characters This reverts commit cd69f5f3aeabd64816fd02d7308407451bf6ecad. --- i18n/_ChineseText.cpp | 14 ++++++++++++++ i18n/include/Text.h | 24 ++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 3b7f881c..622b69f5 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -12159,4 +12159,18 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; +// WANNE: Some Chinese specific strings that needs to be in unicode! +STR16 ChineseSpecString1 = L"%%"; //defined in _ChineseText.cpp as this file is already unicode +STR16 ChineseSpecString2 = L"*%3d%%%%"; //defined in _ChineseText.cpp as this file is already unicode +STR16 ChineseSpecString3 = L"%d%%"; //defined in _ChineseText.cpp as this file is already unicode +STR16 ChineseSpecString4 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +STR16 ChineseSpecString5 = L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s"; +STR16 ChineseSpecString6 = L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; +STR16 ChineseSpecString7 = L"%s [%d%%]\n%s %1.1f %s"; +STR16 ChineseSpecString8 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +STR16 ChineseSpecString9 = L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +STR16 ChineseSpecString10 = L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; // added by Flugente +STR16 ChineseSpecString11 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +STR16 ChineseSpecString12 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente + #endif //CHINESE diff --git a/i18n/include/Text.h b/i18n/include/Text.h index 8d32695a..a71e194d 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -inline constexpr STR16 ChineseSpecString1 = L"%%"; //defined in _ChineseText.cpp as this file is already unicode -inline constexpr STR16 ChineseSpecString2 = L"*%3d%%%%"; //defined in _ChineseText.cpp as this file is already unicode -inline constexpr STR16 ChineseSpecString3 = L"%d%%"; //defined in _ChineseText.cpp as this file is already unicode -inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString5 = L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString6 = L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString7 = L"%s [%d%%]\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -inline constexpr STR16 ChineseSpecString9 = L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -inline constexpr STR16 ChineseSpecString10 = L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; // added by Flugente -inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +extern STR16 ChineseSpecString1; +extern STR16 ChineseSpecString2; +extern STR16 ChineseSpecString3; +extern STR16 ChineseSpecString4; +extern STR16 ChineseSpecString5; +extern STR16 ChineseSpecString6; +extern STR16 ChineseSpecString7; +extern STR16 ChineseSpecString8; +extern STR16 ChineseSpecString9; +extern STR16 ChineseSpecString10; +extern STR16 ChineseSpecString11; +extern STR16 ChineseSpecString12; enum { From 846abf5f1ce449eb5e49d08f5ca3023b1b790ccd Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 2 Jan 2025 09:02:36 -0300 Subject: [PATCH 062/118] Convert Text.h to utf-8-sig and move ChineseSpecString* there This time without mangling the characters --- i18n/_ChineseText.cpp | 14 -------------- i18n/include/Text.h | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 622b69f5..3b7f881c 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -12159,18 +12159,4 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; -// WANNE: Some Chinese specific strings that needs to be in unicode! -STR16 ChineseSpecString1 = L"%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString2 = L"*%3d%%%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString3 = L"%d%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString4 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -STR16 ChineseSpecString5 = L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s"; -STR16 ChineseSpecString6 = L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; -STR16 ChineseSpecString7 = L"%s [%d%%]\n%s %1.1f %s"; -STR16 ChineseSpecString8 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -STR16 ChineseSpecString9 = L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString10 = L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString11 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString12 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente - #endif //CHINESE diff --git a/i18n/include/Text.h b/i18n/include/Text.h index a71e194d..6d97672a 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -1,4 +1,4 @@ -#ifndef __TEXT_H +#ifndef __TEXT_H #define __TEXT_H #include "items.h" @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -extern STR16 ChineseSpecString1; -extern STR16 ChineseSpecString2; -extern STR16 ChineseSpecString3; -extern STR16 ChineseSpecString4; -extern STR16 ChineseSpecString5; -extern STR16 ChineseSpecString6; -extern STR16 ChineseSpecString7; -extern STR16 ChineseSpecString8; -extern STR16 ChineseSpecString9; -extern STR16 ChineseSpecString10; -extern STR16 ChineseSpecString11; -extern STR16 ChineseSpecString12; +inline constexpr STR16 ChineseSpecString1 = L"%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString2 = L"*%3d%%%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString3 = L"%d%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString5 = L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString6 = L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString7 = L"%s [%d%%]\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +inline constexpr STR16 ChineseSpecString9 = L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString10 = L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente enum { From 4a16698cdb055d5c130dd872c76939845e447726 Mon Sep 17 00:00:00 2001 From: majcosta <34732933+majcosta@users.noreply.github.com> Date: Fri, 3 Jan 2025 21:03:09 -0300 Subject: [PATCH 063/118] CHINESE: actually display BobbyR amount purchased correctly at runtime (#398) * Revert "Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n" This reverts commit ecdc8916f2b6b3b1fd3da359423f1393d12b2525. * actually display the amount purchased correctly at runtime --- Laptop/BobbyR.h | 1 - Laptop/BobbyRGuns.cpp | 9 ++++++++- i18n/include/language.hpp | 2 -- i18n/language.cpp | 9 --------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h index 6d011960..486a9a80 100644 --- a/Laptop/BobbyR.h +++ b/Laptop/BobbyR.h @@ -25,7 +25,6 @@ void RenderBobbyR(); #define BOBBYR_GRIDLOC_X LAPTOP_SCREEN_UL_X + 4 #define BOBBYR_GRIDLOC_Y LAPTOP_SCREEN_WEB_UL_Y + 5 //LAPTOP_SCREEN_WEB_UL_Y + 45 -#define BOBBYR_ORDER_NUM_WIDTH 15 /* extern UINT16 gusFirstGunIndex; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 15613004..c8ae1e61 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -87,6 +87,7 @@ #define BOBBYR_ITEM_NAME_X BOBBYR_GRIDLOC_X + 6 #define BOBBYR_ITEM_NAME_Y_OFFSET 54 +#define BOBBYR_ORDER_NUM_WIDTH 15 #define BOBBYR_ORDER_NUM_X BOBBYR_GRIDLOC_X + 120 - BOBBYR_ORDER_NUM_WIDTH //BOBBYR_ITEM_STOCK_TEXT_X #define BOBBYR_ORDER_NUM_Y_OFFSET 1 @@ -115,6 +116,8 @@ #define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 #define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 +#define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X + #define BOBBY_RAY_NOT_PURCHASED 255 #define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 @@ -2500,7 +2503,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED) { swprintf(sTemp, L"% 4d", BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased); - DrawTextToScreen(sTemp, BOBBYR_ITEMS_BOUGHT_X, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + auto bobbyRItemsBoughtX{ BOBBYR_ITEMS_BOUGHT_X }; + if (g_lang == i18n::Lang::zh) { + bobbyRItemsBoughtX -= 10; + } + DrawTextToScreen(sTemp, bobbyRItemsBoughtX, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } } diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index e88fbe5a..bd895bcc 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -20,6 +20,4 @@ extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; -extern const int BOBBYR_ITEMS_BOUGHT_X; - auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 25b0c816..555b33c2 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -1,8 +1,5 @@ #include -#include -#include - /* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language * (ideally text and voice separately) be set in the options menu would be * ideal. */ @@ -34,12 +31,6 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ #endif }; -const int BOBBYR_ITEMS_BOUGHT_X{BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH -#ifdef CHINESE - - 10 -#endif -}; - auto GetLanguagePrefix() -> const STR { return #if defined(ENGLISH) From f471b74f5b98bf968996859ab355af725b413417 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 3 Jan 2025 21:34:38 -0300 Subject: [PATCH 064/118] fix inconsistent case for a few files you can now build in a case-sensitive filesystem --- CMakeLists.txt | 4 ++-- Ja2/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 532067ab..05825100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ target_link_libraries(bfVFS PRIVATE 7z) add_subdirectory("ext/export/src") # static libraries whose translation units don't rely on Application preprocessor definitions. -add_subdirectory(Lua) +add_subdirectory(lua) add_subdirectory(Multiplayer) set(Ja2_Libraries @@ -141,7 +141,7 @@ foreach(app IN LISTS ApplicationTargets) set(exe ${app}_${lang}) add_executable(${exe} WIN32 sgp/sgp.cpp - Ja2/Res/Ja2.rc + Ja2/Res/ja2.rc ) target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) target_link_options(${exe} PRIVATE $) diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index 9b798987..db892953 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -27,7 +27,7 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Screens.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/TimeLogging.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp" From fd6ffd8d69c1b6729070758965cf7753e9c768d0 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sun, 5 Jan 2025 05:42:16 +0100 Subject: [PATCH 065/118] automatically add needed dll override for Linux/macOS/Android (WINE) --- Utils/CMakeLists.txt | 1 + Utils/wine.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++ Utils/wine.h | 15 ++++++++++ sgp/sgp.cpp | 10 +++++++ 4 files changed, 91 insertions(+) create mode 100644 Utils/wine.cpp create mode 100644 Utils/wine.h diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 537e2335..05262392 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -29,6 +29,7 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/Text Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Timer Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Utilities.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/wine.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/WordWrap.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLProperties.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLWriter.cpp" diff --git a/Utils/wine.cpp b/Utils/wine.cpp new file mode 100644 index 00000000..17c5c4af --- /dev/null +++ b/Utils/wine.cpp @@ -0,0 +1,65 @@ +#include +#include +#include "wine.h" + + +BOOL wine_add_dll_overrides() +{ + BOOL dd = wine_add_dll_override(L"ddraw"); + //BOOL ws = wine_add_dll_override(L"wsock32"); + + return dd; // || ws; +} + +BOOL wine_add_dll_override(const WCHAR* dll_name) +{ + if (!IS_WINE) + return FALSE; + + WCHAR exe_path[MAX_PATH] = { 0 }; + if (!GetModuleFileNameW(NULL, exe_path, _countof(exe_path) - 1)) + return FALSE; + + WCHAR exe_file_name[MAX_PATH] = { 0 }; + WCHAR exe_file_ext[MAX_PATH] = { 0 }; + _wsplitpath(exe_path, NULL, NULL, exe_file_name, exe_file_ext); + + WCHAR reg_path[512] = { 0 }; + _snwprintf( + reg_path, + _countof(reg_path) - 1, + L"SOFTWARE\\Wine\\AppDefaults\\%s%s\\DllOverrides", + exe_file_name, + exe_file_ext); + + BOOL result = FALSE; + HKEY hkey; + LONG status = + RegCreateKeyExW( + HKEY_CURRENT_USER, + reg_path, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_READ, + NULL, + &hkey, + NULL); + + if (status == ERROR_SUCCESS) + { + if (RegQueryValueExW(hkey, dll_name, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + { + WCHAR v[] = L"native, builtin"; + if (RegSetValueExW(hkey, dll_name, 0, REG_SZ, (LPCBYTE)v, sizeof(v)) == ERROR_SUCCESS && + RegQueryValueExW(hkey, dll_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + result = TRUE; + } + } + + RegCloseKey(hkey); + } + + return result; +} diff --git a/Utils/wine.h b/Utils/wine.h new file mode 100644 index 00000000..2929c543 --- /dev/null +++ b/Utils/wine.h @@ -0,0 +1,15 @@ +#ifndef WINE_H +#define WINE_H + +#define IS_WINE (GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0) + +// ### types ### + +// ### Variables ### + +// ### Functions ### + +BOOL wine_add_dll_overrides(); +BOOL wine_add_dll_override(const WCHAR* dll_name); + +#endif diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index be1fcf5a..8f3f77ba 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -49,6 +49,7 @@ #include "Lua Interpreter.h" #include "connect.h" #include "english.h" +#include "wine.h" #include "BuildDefines.h" #include "Intro.h" @@ -766,7 +767,16 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC HWND hPrevInstanceWindow; UINT32 uiTimer = 0; + // Make sure the game works out of the box on Linux/macOS/Android (WINE) + if (wine_add_dll_overrides()) + { + /* newly added dll overrides only work after a restart */ + char exe_path[MAX_PATH] = { 0 }; + GetModuleFileNameA(NULL, exe_path, _countof(exe_path)); + ShellExecuteA(NULL, "open", exe_path, pCommandLine, NULL, sCommandShow); + return 0; + } vfs::Log::setSharedString( getGameID() ); //if(!vfs::Aspects::getMutexFactory()) From 22e67f66fae5ca2d476f77d42b4cb1ea0ef1321e Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 5 Jan 2025 07:42:07 -0300 Subject: [PATCH 066/118] Move wine.cpp into its own library avoid extra compilations that way --- CMakeLists.txt | 2 ++ Utils/CMakeLists.txt | 1 - wine/CMakeLists.txt | 4 ++++ {Utils => wine/include}/wine.h | 0 {Utils => wine}/wine.cpp | 0 5 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 wine/CMakeLists.txt rename {Utils => wine/include}/wine.h (100%) rename {Utils => wine}/wine.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05825100..5cbfd1fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ add_subdirectory("ext/export/src") # static libraries whose translation units don't rely on Application preprocessor definitions. add_subdirectory(lua) add_subdirectory(Multiplayer) +add_subdirectory(wine) set(Ja2_Libraries "${CMAKE_SOURCE_DIR}/binkw32.lib" @@ -82,6 +83,7 @@ set(Ja2_Libraries bfVFS Lua Multiplayer +wine ) # static libraries whose translation units rely on Application preprocessor definitions. diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 05262392..537e2335 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -29,7 +29,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/Text Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Timer Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Utilities.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/wine.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/WordWrap.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLProperties.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLWriter.cpp" diff --git a/wine/CMakeLists.txt b/wine/CMakeLists.txt new file mode 100644 index 00000000..6206a988 --- /dev/null +++ b/wine/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(wine + wine.cpp +) +target_include_directories(wine PUBLIC include) diff --git a/Utils/wine.h b/wine/include/wine.h similarity index 100% rename from Utils/wine.h rename to wine/include/wine.h diff --git a/Utils/wine.cpp b/wine/wine.cpp similarity index 100% rename from Utils/wine.cpp rename to wine/wine.cpp From ac6a1504df49f38127a29af29bfb9f4d477574bd Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 5 Jan 2025 09:10:31 -0300 Subject: [PATCH 067/118] add a space to string to prevent compilation errors in GB2312 --- Laptop/IMP Begin Screen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 41141ab5..3037f6b6 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -560,7 +560,7 @@ if(g_lang == i18n::Lang::ru) { if( layout == 0x419 ) // Russian { unsigned char TranslationTable[] = - " #########-.0123456789#,###_#ڨ"; + " #########-.0123456789#,###_#ڨ "; uiKey = TranslateKey( uiKey, TranslationTable ); uiKey = GetCyrillicUnicodeChar( uiKey ); @@ -568,7 +568,7 @@ if(g_lang == i18n::Lang::ru) { else if( layout == 0x423 ) // Belarussian { unsigned char TranslationTable[] = - " #########-.0123456789#,#Բҡ#'#_#'"; + " #########-.0123456789#,#Բҡ#'#_#' "; uiKey = TranslateKey( uiKey, TranslationTable ); uiKey = GetCyrillicUnicodeChar( uiKey ); From db40cd433e17ccf4670512284b9d75cbe852d692 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:04:15 +0200 Subject: [PATCH 068/118] Move mapscreen bottom coordinates' initialization Fixes radar map's initial position in strategic screen being in the top right corner. --- Ja2/Init.cpp | 5 +++++ Strategic/mapscreen.cpp | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index bf74dbf3..2a4f7527 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -51,6 +51,7 @@ #include "Multilingual Text Code Generator.h" #include "editscreen.h" #include "Arms Dealer Init.h" +#include "Map Screen Interface Bottom.h" #include "MPXmlTeams.hpp" #include "Strategic Mines LUA.h" #include "UndergroundInit.h" @@ -1474,6 +1475,10 @@ UINT32 InitializeJA2(void) return( ERROR_SCREEN ); } + // InitRadarScreenCoords() depend on Mapscreen Interface Bottom coordinates -> need to initiate them first + // before calling InitTacticalEngine() + InitMapScreenInterfaceBottomCoords(); + // Init tactical engine if ( !InitTacticalEngine( ) ) { diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index bdd2a631..4e1f329c 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -4793,9 +4793,6 @@ UINT32 MapScreenHandle(void) InitPreviousPaths(); - // HEADROCK HAM 3.6: Init coordinates for new variable-sized message window - InitMapScreenInterfaceBottomCoords(); - // if arrival sector is invalid, reset to A9 if ( ( gsMercArriveSectorX < 1 ) || ( gsMercArriveSectorY < 1 ) || ( gsMercArriveSectorX > 16 ) || ( gsMercArriveSectorY > 16 ) ) From dcf202990f3ef8fa1e82e3e6ca2740bd4cfb1ed8 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:06:49 +0200 Subject: [PATCH 069/118] Remove duplicate header includes --- Ja2/Init.cpp | 2 -- Strategic/Map Screen Interface Bottom.cpp | 1 - Strategic/mapscreen.cpp | 6 ------ 3 files changed, 9 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 2a4f7527..a80bf217 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -35,7 +35,6 @@ #include "tile cache.h" #include "strategicmap.h" #include "Map Information.h" - #include "laptop.h" #include "Shade Table Util.h" #include "Exit Grids.h" #include "Summary Info.h" @@ -77,7 +76,6 @@ #include "AimArchives.h" #include "connect.h" #include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes() -#include "Animation Data.h" // added by Flugente #include diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index e045f060..49ee8f29 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -50,7 +50,6 @@ #include "Ja25 Strategic Ai.h" #include "MapScreen Quotes.h" #include "SaveLoadGame.h" -#include "strategicmap.h" #endif #include "connect.h" diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 4e1f329c..f22cde56 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -11,10 +11,8 @@ #include "font.h" #include "screenids.h" #include "screens.h" - #include "gameloop.h" #include "overhead.h" #include "sysutil.h" - #include "input.h" #include "Event Pump.h" #include "Font Control.h" #include "Timer Control.h" @@ -44,18 +42,15 @@ #include "PopUpBox.h" #include "Game Clock.h" #include "items.h" - #include "vobject.h" #include "Cursor Control.h" #include "text.h" #include "strategic.h" #include "strategicmap.h" - #include "interface.h" #include "strategic pathing.h" #include "Map Screen Interface Bottom.h" #include "Map Screen Interface Border.h" #include "Map Screen Interface Map.h" #include "Map Screen Interface.h" - #include "Strategic Pathing.h" #include "Assignments.h" #include "points.h" #include "Squads.h" @@ -114,7 +109,6 @@ #include "connect.h" //hayden #include "InterfaceItemImages.h" -#include "vobject.h" #include #ifdef JA2UB From 8897769f0de672149107494bad6f62382c3fd7d9 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 5 Jan 2025 10:43:11 -0300 Subject: [PATCH 070/118] make sure CI to assemble release on 'v*' tag push or manually also put bash script through shellcheck to be more posix compliant --- .github/workflows/build.yml | 33 ++++++++++++++++------------ .github/workflows/build_language.yml | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c25feead..3f0fc20f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,25 +34,30 @@ jobs: name: Set global variables run: | set -eux - - full_release='${{ ( github.repository == '1dot13/source' && github.ref_name == 'master' ) || startsWith(github.ref, 'refs/tags/v') }}' - - if [[ '${{ inputs.build_all_languages }}' == 'true' || ( '${{ inputs.build_all_languages }}' == '' && "$full_release" == 'true' ) ]] + + all_languages="${{ inputs.build_all_languages }}" + assemble_release="${{ inputs.assemble_release }}" + repo="${{ github.repository }}" + refname="${{ github.ref_name }}" + is_tag="${{ startsWith(github.ref, 'refs/tags/v') }}" + + if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$refname" = "master" ] && [ "$is_tag" = "true" ]; } then - languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]'; + full_release="true" + else + full_release="false" + fi + + if [ "$all_languages" = "true" ] || [ "$full_release" = "true" ] + then + languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]' else # English + some other language for compilation testing languages_json_array='["German", "English"]' fi - echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT - - if [[ '${{ inputs.assemble_release }}' == 'true' || ( '${{ inputs.assemble_release }}' == '' && "$full_release" == 'true' ) ]] - then - assemble_release='true' - else - assemble_release='false' - fi - echo "assemble_release=$assemble_release" >> $GITHUB_OUTPUT + + echo "languages_json_array=$languages_json_array" >> "$GITHUB_OUTPUT" + echo "assemble_release=$full_release" >> "$GITHUB_OUTPUT" - name: Clone repos metadata run: | diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 0f97c733..931a6522 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -11,7 +11,7 @@ on: assemble: description: 'assemble full package' required: true - default: true + default: false type: boolean continue-on-error: description: 'allows a language to fail, used when building all languages' From 552951795cf12687457cfa29ec644986cdf7a96b Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 7 Jan 2025 13:16:32 -0300 Subject: [PATCH 071/118] yet another fix for the github actions github.ref_name isn't 'master' when a tag is pushed, but the tag name, so it won't trigger a release build when a 'v*' tag is pushed --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f0fc20f..c35d330d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,10 +38,9 @@ jobs: all_languages="${{ inputs.build_all_languages }}" assemble_release="${{ inputs.assemble_release }}" repo="${{ github.repository }}" - refname="${{ github.ref_name }}" is_tag="${{ startsWith(github.ref, 'refs/tags/v') }}" - if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$refname" = "master" ] && [ "$is_tag" = "true" ]; } + if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$is_tag" = "true" ]; } then full_release="true" else From 1976dee738bcbcaf707cfb4c2e356a75862b71ec Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 7 Jan 2025 14:12:35 -0300 Subject: [PATCH 072/118] make sure these steps run otherwise there is no 'source' working directory for the final step --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c35d330d..eae31e92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,14 +190,12 @@ jobs: merge-multiple: true - name: Checkout Repo - if: github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: path: source fetch-depth: 1 sparse-checkout: 'README.md' - name: Create latest pre-release - if: github.ref == 'refs/heads/master' working-directory: source run: | gh release delete latest --cleanup-tag || true From 7aa0e183523c2882910bebd3d4df46be574d67d9 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 7 Jan 2025 16:45:59 -0300 Subject: [PATCH 073/118] Revert "make sure these steps run" This reverts commit 1976dee738bcbcaf707cfb4c2e356a75862b71ec. Revert "yet another fix for the github actions" This reverts commit 552951795cf12687457cfa29ec644986cdf7a96b. Revert "make sure CI to assemble release on 'v*' tag push or manually" This reverts commit 8897769f0de672149107494bad6f62382c3fd7d9. --- .github/workflows/build.yml | 34 +++++++++++++--------------- .github/workflows/build_language.yml | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eae31e92..c25feead 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,29 +34,25 @@ jobs: name: Set global variables run: | set -eux - - all_languages="${{ inputs.build_all_languages }}" - assemble_release="${{ inputs.assemble_release }}" - repo="${{ github.repository }}" - is_tag="${{ startsWith(github.ref, 'refs/tags/v') }}" - - if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$is_tag" = "true" ]; } + + full_release='${{ ( github.repository == '1dot13/source' && github.ref_name == 'master' ) || startsWith(github.ref, 'refs/tags/v') }}' + + if [[ '${{ inputs.build_all_languages }}' == 'true' || ( '${{ inputs.build_all_languages }}' == '' && "$full_release" == 'true' ) ]] then - full_release="true" - else - full_release="false" - fi - - if [ "$all_languages" = "true" ] || [ "$full_release" = "true" ] - then - languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]' + languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]'; else # English + some other language for compilation testing languages_json_array='["German", "English"]' fi - - echo "languages_json_array=$languages_json_array" >> "$GITHUB_OUTPUT" - echo "assemble_release=$full_release" >> "$GITHUB_OUTPUT" + echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT + + if [[ '${{ inputs.assemble_release }}' == 'true' || ( '${{ inputs.assemble_release }}' == '' && "$full_release" == 'true' ) ]] + then + assemble_release='true' + else + assemble_release='false' + fi + echo "assemble_release=$assemble_release" >> $GITHUB_OUTPUT - name: Clone repos metadata run: | @@ -190,12 +186,14 @@ jobs: merge-multiple: true - name: Checkout Repo + if: github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: path: source fetch-depth: 1 sparse-checkout: 'README.md' - name: Create latest pre-release + if: github.ref == 'refs/heads/master' working-directory: source run: | gh release delete latest --cleanup-tag || true diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 931a6522..0f97c733 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -11,7 +11,7 @@ on: assemble: description: 'assemble full package' required: true - default: false + default: true type: boolean continue-on-error: description: 'allows a language to fail, used when building all languages' From ff8376d625fa7d6e9f72f6aa49c76e0b18accc90 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 9 Jan 2025 20:15:37 -0300 Subject: [PATCH 074/118] Keep UB specific enum value for all builds but at the end, not beginning as to not make a mess along with an intro.lua change in gamedir/Data-UB/Scripts this gets rid of a nasty preprocessor conditional in a header file --- Ja2/Intro.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Ja2/Intro.h b/Ja2/Intro.h index 77048105..da50d8bf 100644 --- a/Ja2/Intro.h +++ b/Ja2/Intro.h @@ -12,13 +12,11 @@ void StopIntroVideo(); //enums used for when the intro screen can come up, used with 'gbIntroScreenMode' enum EIntroType { -#ifdef JA2UB - INTRO_HELI_CRASH, -#endif INTRO_BEGINNING, //set when viewing the intro at the begining of the game INTRO_ENDING, //set when viewing the end game video. - INTRO_SPLASH, + // Unfinished Business + INTRO_HELI_CRASH }; From ebd2e25e0fab1147f251682a2050803a6233bc2b Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 9 Jan 2025 21:26:45 -0300 Subject: [PATCH 075/118] Fix a wrong #ifdef to runtime check conversion I didn't get this right the first time, non-Chinese text was looking funny in dialog boxes --- Utils/WordWrap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index 900193c7..b0e8e432 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -1733,7 +1733,8 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); - if (g_lang == i18n::Lang::zh && currentChar <= 255) + if (g_lang != i18n::Lang::zh || + g_lang == i18n::Lang::zh && currentChar <= 255) // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; From 222daead0e7ec1547cda22f99849bfa034de3048 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:29:35 +0200 Subject: [PATCH 076/118] Remove unused ItemFlags Detonator and Remote Detonator are specified by AttachmentClass No items in items.xml actually even contained these flags. --- Tactical/Arms Dealer Init.cpp | 2 +- Tactical/Interface Enhanced.cpp | 12 ++++++------ Tactical/Item Types.h | 4 ++-- Tactical/Items.cpp | 6 ++---- Tactical/Items.h | 2 -- Utils/XML_Items.cpp | 14 -------------- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 59b64a9a..18744069 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -1015,7 +1015,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) return( ARMS_DEALER_MEDICAL ); else if (ItemIsAttachment(usItem)) return( ARMS_DEALER_ATTACHMENTS ); - else if (ItemIsDetonator(usItem) || ItemIsRemoteDetonator(usItem) || ItemIsRemoteTrigger(usItem)) + else if ( IsAttachmentClass( usItem, (AC_DETONATOR | AC_REMOTEDET) ) || ItemIsRemoteTrigger(usItem)) return( ARMS_DEALER_DETONATORS ); else return( ARMS_DEALER_MISC ); diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 37fc0757..85b1d188 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -2527,7 +2527,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// REMOTE DETONATOR - if (ItemIsRemoteDetonator(gpItemDescObject->usItem)) + if ( IsAttachmentClass( gpItemDescObject->usItem, AC_REMOTEDET ) ) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 15 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 15 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2536,7 +2536,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TIMER DETONATOR - if (ItemIsDetonator(gpItemDescObject->usItem)) + if ( IsAttachmentClass( gpItemDescObject->usItem, AC_DETONATOR )) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 16 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 16 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -6246,16 +6246,16 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// REMOTE DETONATOR - if ( (ItemIsRemoteDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || - ( fComparisonMode && ItemIsRemoteDetonator(gpComparedItemDescObject->usItem) ) ) + if ( (IsAttachmentClass( gpItemDescObject->usItem, AC_REMOTEDET ) && !fComparisonMode ) || + ( fComparisonMode && IsAttachmentClass( gpComparedItemDescObject->usItem, AC_REMOTEDET )) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 15, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TIMER DETONATOR - if ( (ItemIsDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || - ( fComparisonMode && ItemIsDetonator(gpComparedItemDescObject->usItem)) ) + if ( (IsAttachmentClass( gpItemDescObject->usItem, AC_DETONATOR ) && !fComparisonMode ) || + ( fComparisonMode && IsAttachmentClass( gpComparedItemDescObject->usItem, AC_DETONATOR )) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 16, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 44a8b23d..b71a3cad 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -812,8 +812,8 @@ extern OBJECTTYPE gTempObject; #define ITEM_mortar 0x0400000000000000 #define ITEM_duckbill 0x0800000000000000 -#define ITEM_detonator 0x1000000000000000 -#define ITEM_remotedetonator 0x2000000000000000 +//UNUSED #define ITEM_detonator 0x1000000000000000 +//UNUSED #define ITEM_remotedetonator 0x2000000000000000 #define ITEM_hidemuzzleflash 0x4000000000000000 #define ITEM_rocketlauncher 0x8000000000000000 diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 1dd9c4c6..c1fe83a0 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -12076,7 +12076,7 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (ItemIsDetonator(iter->usItem) && iter->exists() ) + if ( IsAttachmentClass( iter->usItem, AC_DETONATOR ) && iter->exists() ) { return( TRUE ); } @@ -12092,7 +12092,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (ItemIsRemoteDetonator(iter->usItem) && iter->exists() ) + if ( IsAttachmentClass( iter->usItem, AC_REMOTEDET ) && iter->exists() ) { return( TRUE ); } @@ -16081,8 +16081,6 @@ BOOLEAN ItemIsFlare(UINT16 usItem) { return HasItemFlag(usItem, ITEM_flare); } BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_grenadelauncher); } BOOLEAN ItemIsMortar(UINT16 usItem) { return HasItemFlag(usItem, ITEM_mortar); } BOOLEAN ItemIsDuckbill(UINT16 usItem) { return HasItemFlag(usItem, ITEM_duckbill); } -BOOLEAN ItemIsDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_detonator); } -BOOLEAN ItemIsRemoteDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_remotedetonator); } BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hidemuzzleflash); } BOOLEAN ItemIsRocketLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_rocketlauncher); } // usItemFlag2 diff --git a/Tactical/Items.h b/Tactical/Items.h index 6aa26659..9db8c798 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -204,8 +204,6 @@ BOOLEAN ItemIsFlare(UINT16 usItem); BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem); BOOLEAN ItemIsMortar(UINT16 usItem); BOOLEAN ItemIsDuckbill(UINT16 usItem); -BOOLEAN ItemIsDetonator(UINT16 usItem); -BOOLEAN ItemIsRemoteDetonator(UINT16 usItem); BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem); BOOLEAN ItemIsRocketLauncher(UINT16 usItem); BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem); diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 0b2c3c91..52f14ece 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -863,18 +863,6 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ((BOOLEAN)atol(pData->szCharData)) pData->curItem.usItemFlag |= ITEM_duckbill; } - else if(strcmp(name, "Detonator") == 0) - { - pData->curElement = ELEMENT; - if ((BOOLEAN)atol(pData->szCharData)) - pData->curItem.usItemFlag |= ITEM_detonator; - } - else if(strcmp(name, "RemoteDetonator") == 0) - { - pData->curElement = ELEMENT; - if ((BOOLEAN)atol(pData->szCharData)) - pData->curItem.usItemFlag |= ITEM_remotedetonator; - } else if(strcmp(name, "ThermalOptics") == 0) { pData->curElement = ELEMENT; @@ -2427,8 +2415,6 @@ BOOLEAN WriteItemStats() if ( ItemIsGrenadeLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemIsMortar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemIsDuckbill( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( ItemIsDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( ItemIsRemoteDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemHasHiddenMuzzleFlash( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemIsRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); From e3a542bf5d60a718cf76e38ea49e833f9b4f6e21 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 14 Feb 2025 16:42:58 +0200 Subject: [PATCH 077/118] Exclude robots from trying to activate panic triggers --- TacticalAI/DecideAction.cpp | 41 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index af862c89..c30aaa68 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2548,32 +2548,35 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) } // if we're an alerted enemy, and there are panic bombs or a trigger around - if ( (!PTR_CIVILIAN || pSoldier->ubProfile == WARDEN) && ( ( gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || (pSoldier->ubID == gTacticalStatus.ubTheChosenOne) || (pSoldier->ubProfile == WARDEN) ) && - (gTacticalStatus.fPanicFlags & (PANIC_BOMBS_HERE | PANIC_TRIGGERS_HERE ) ) ) ) + if ( !ENEMYROBOT(pSoldier) ) { - if ( pSoldier->ubProfile == WARDEN && gTacticalStatus.ubTheChosenOne == NOBODY ) + if ( (!PTR_CIVILIAN || pSoldier->ubProfile == WARDEN) && ( ( gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || (pSoldier->ubID == gTacticalStatus.ubTheChosenOne) || (pSoldier->ubProfile == WARDEN) ) && + (gTacticalStatus.fPanicFlags & (PANIC_BOMBS_HERE | PANIC_TRIGGERS_HERE ) ) ) ) { - PossiblyMakeThisEnemyChosenOne( pSoldier ); + if ( pSoldier->ubProfile == WARDEN && gTacticalStatus.ubTheChosenOne == NOBODY ) + { + PossiblyMakeThisEnemyChosenOne( pSoldier ); + } + + // do some special panic AI decision making + bActionReturned = PanicAI(pSoldier,ubCanMove); + + // if we decided on an action while in there, we're done + if (bActionReturned != -1) + return(bActionReturned); } - // do some special panic AI decision making - bActionReturned = PanicAI(pSoldier,ubCanMove); - - // if we decided on an action while in there, we're done - if (bActionReturned != -1) - return(bActionReturned); - } - - if ( pSoldier->ubProfile != NO_PROFILE ) - { - if ( (pSoldier->ubProfile == QUEEN || pSoldier->ubProfile == JOE) && ubCanMove ) + if ( pSoldier->ubProfile != NO_PROFILE ) { - if ( gWorldSectorX == 3 && gWorldSectorY == MAP_ROW_P && gbWorldSectorZ == 0 && !gfUseAlternateQueenPosition ) + if ( (pSoldier->ubProfile == QUEEN || pSoldier->ubProfile == JOE) && ubCanMove ) { - bActionReturned = HeadForTheStairCase( pSoldier ); - if ( bActionReturned != AI_ACTION_NONE ) + if ( gWorldSectorX == 3 && gWorldSectorY == MAP_ROW_P && gbWorldSectorZ == 0 && !gfUseAlternateQueenPosition ) { - return( bActionReturned ); + bActionReturned = HeadForTheStairCase( pSoldier ); + if ( bActionReturned != AI_ACTION_NONE ) + { + return( bActionReturned ); + } } } } From 9c951adfea0d149d65f0886c6af5a9d3ecdd3c43 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:07:54 +0200 Subject: [PATCH 078/118] Read correct variable from CTHconstants.ini --- Ja2/GameSettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index 35f99674..c437d542 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -3793,7 +3793,7 @@ void LoadCTHConstants() gGameCTHConstants.RECOIL_COUNTER_ACCURACY_WIS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_WIS",1.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AGI = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AGI",1.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_EXP_LEVEL = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_EXP_LEVEL",2.0, 0.0, 100.0); - gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0); + gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_TRACER_BONUS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_TRACER_BONUS",10.0, -1000.0, 1000.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_ANTICIPATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_ANTICIPATION",25.0, -1000.0, 1000.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_COMPENSATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_COMPENSATION",2.0, 0.0, 5.0); From fffb3a45fb5dea75cc6c389d6a22c5f5eda2059b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 24 Feb 2025 21:12:06 +0200 Subject: [PATCH 079/118] Remove 8bit mode Obsolete and doesn't work * Remove gbPixelDepth * Remove 8-bit to 8-bit blitters * FileNameForBPP now only calls strcopy --- Ja2/Fade Screen.cpp | 10 +- Strategic/mapscreen.cpp | 8 +- Tactical/Interface.cpp | 19 +- TileEngine/Radar Screen.cpp | 165 +- TileEngine/Render Dirty.cpp | 97 +- TileEngine/overhead map.cpp | 3 +- TileEngine/renderworld.cpp | 1049 ++-- Utils/Utilities.cpp | 23 +- Utils/Utilities.h | 2 - ext/export/src/export/sti/stci_image_utils.h | 5 - sgp/Button System.cpp | 155 +- sgp/Font.cpp | 70 +- sgp/line.cpp | 260 - sgp/line.h | 2 - sgp/sgp.cpp | 5 - sgp/sgp.h | 1 - sgp/video.cpp | 9 +- sgp/vobject.cpp | 52 +- sgp/vobject_blitters.cpp | 5255 ------------------ sgp/vobject_blitters.h | 57 +- 20 files changed, 644 insertions(+), 6603 deletions(-) diff --git a/Ja2/Fade Screen.cpp b/Ja2/Fade Screen.cpp index f201e7bd..2f44de73 100644 --- a/Ja2/Fade Screen.cpp +++ b/Ja2/Fade Screen.cpp @@ -681,13 +681,9 @@ BOOLEAN UpdateSaveBufferWithBackbuffer(void) pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); UnLockVideoSurface(FRAME_BUFFER); UnLockVideoSurface(guiSAVEBUFFER); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index f22cde56..ebff1280 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9048,12 +9048,8 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); - if(gbPixelDepth==16) - { - // DB Need to add a radar color for 8-bit - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); - InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); - } + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); + InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); UnLockVideoSurface( FRAME_BUFFER ); diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index cfa3098e..9d0c27db 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -461,14 +461,7 @@ BOOLEAN InitializeTacticalInterface( ) // failing the CHECKF after this will cause you to lose your mouse - if ( GETPIXELDEPTH() == 8 ) - { - strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT_8.pcx" ); - } - else if ( GETPIXELDEPTH() == 16 ) - { - strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); - } + strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); if( !AddVideoSurface( &vs_desc, &guiINTEXT ) ) AssertMsg( 0, "Missing INTERFACE\\In_text.sti"); @@ -3562,10 +3555,7 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW } if ( pSoldier->ubID == gusSelectedSoldier ) { - if(gbPixelDepth==16) - RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); - else - RectangleDraw8( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color8, pDestBuf); + RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); } } @@ -5812,10 +5802,7 @@ void DrawBar( INT32 x, INT32 y, INT32 width, INT32 height, UINT16 color8, UINT16 { for( INT32 i=0; i < height; i++ ) { - if(gbPixelDepth==16) - LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); - else if(gbPixelDepth==8) - LineDraw8( TRUE, x, y+i, x+width-1, y+i, color8, pDestBuf ); + LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); } } } diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index c485d8ca..12877324 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -493,30 +493,21 @@ void RenderRadarScreen( ) if( !( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - if(gbPixelDepth==16) + // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] + if (fAllowRadarMovementHor == FALSE) { - // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] - if (fAllowRadarMovementHor == FALSE) - { - sRadarTLX = RADAR_WINDOW_TM_X; - sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; - } - - if (fAllowRadarMovementVer == FALSE) - { - sRadarTLY = RADAR_WINDOW_TM_Y; - sRadarBRY = RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT; - } - - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); - RectangleDraw( TRUE, sRadarTLX, sRadarTLY, sRadarBRX, sRadarBRY - 1, usLineColor, pDestBuf ); + sRadarTLX = RADAR_WINDOW_TM_X; + sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; } - else if(gbPixelDepth==8) + + if (fAllowRadarMovementVer == FALSE) { - // DB Need to change this to a color from the 8-but standard palette - usLineColor = COLOR_GREEN; - RectangleDraw8( TRUE, sRadarTLX + 1, sRadarTLY + 1, sRadarBRX + 1, sRadarBRY + 1, usLineColor, pDestBuf ); + sRadarTLY = RADAR_WINDOW_TM_Y; + sRadarBRY = RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT; } + + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + RectangleDraw( TRUE, sRadarTLX, sRadarTLY, sRadarBRX, sRadarBRY - 1, usLineColor, pDestBuf ); } // Cycle fFlash variable @@ -556,24 +547,20 @@ void RenderRadarScreen( ) sXSoldRadar += RADAR_WINDOW_TM_X; sYSoldRadar += gsRadarY; - // if we are in 16 bit mode....kind of redundant - if(gbPixelDepth==16) + if( ( fFlashHighLightInventoryItemOnradarMap ) ) { - if( ( fFlashHighLightInventoryItemOnradarMap ) ) - { - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); - } - else - { - // DB Need to add a radar color for 8-bit - usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); - } + } + else + { + // DB Need to add a radar color for 8-bit + usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); + } - if( iCurrentlyHighLightedItem == iCounter ) - { - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar + 1, sYSoldRadar + 1, usLineColor, pDestBuf ); - } + if( iCurrentlyHighLightedItem == iCounter ) + { + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar + 1, sYSoldRadar + 1, usLineColor, pDestBuf ); } } } @@ -632,77 +619,67 @@ void RenderRadarScreen( ) sXSoldRadar += gsRadarX; sYSoldRadar += gsRadarY; - if(gbPixelDepth==16) - { - // DB Need to add a radar color for 8-bit - // Are we a selected guy? - if ( pSoldier->ubID == gusSelectedSoldier ) + // Are we a selected guy? + if ( pSoldier->ubID == gusSelectedSoldier ) + { + if ( gfRadarCurrentGuyFlash ) { - if ( gfRadarCurrentGuyFlash ) - { - usLineColor = 0; - } - else - { - // If on roof, make darker.... - if ( pSoldier->pathing.bLevel > 0 ) - { - usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); - } - else - { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - } - } + usLineColor = 0; } else { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - - if ( pSoldier->bTeam == CIV_TEAM ) - { - // Override civ team with red if hostile... - if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) - usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); - // if uncovered, different colour (so the player doesn't have to search for us) - else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) - usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); - } - - // Flugente 18-04-15: observed an odd bug: if we play with a release build and see a creature for the first time, their overhead/radar map pins do not have the correct colour. - // Bizarrely enough, the issue seems dependent on the colour value (pink, RGB: 255/0/255) itself. - // Saving and reloading solves the issue, but I am not sure why. As a fix we now use a slightly dampened pink. - if ( pSoldier->bTeam == CREATURE_TEAM ) - { - usLineColor = Get16BPPColor( FROMRGB( 247, 0, 247 ) ); - } - - // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us - if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) - usLineColor = Get16BPPColor( gTacticalStatus.Team[ MILITIA_TEAM ].RadarColor ); - - // Render different color if an enemy and he's unconscious - if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) - { - usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); - } - // If on roof, make darker.... - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + } + } + } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + + if ( pSoldier->bTeam == CIV_TEAM ) + { + // Override civ team with red if hostile... + if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) + usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); + // if uncovered, different colour (so the player doesn't have to search for us) + else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) + usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); } - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); - } - else if(gbPixelDepth==8) - { - // DB Need to change this to a color from the 8-but standard palette - usLineColor = COLOR_BLUE; - RectangleDraw8( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); + // Flugente 18-04-15: observed an odd bug: if we play with a release build and see a creature for the first time, their overhead/radar map pins do not have the correct colour. + // Bizarrely enough, the issue seems dependent on the colour value (pink, RGB: 255/0/255) itself. + // Saving and reloading solves the issue, but I am not sure why. As a fix we now use a slightly dampened pink. + if ( pSoldier->bTeam == CREATURE_TEAM ) + { + usLineColor = Get16BPPColor( FROMRGB( 247, 0, 247 ) ); + } + + // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us + if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) + usLineColor = Get16BPPColor( gTacticalStatus.Team[ MILITIA_TEAM ].RadarColor ); + + // Render different color if an enemy and he's unconscious + if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) + { + usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); + } + + // If on roof, make darker.... + if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + { + usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); + } } + + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); } } } diff --git a/TileEngine/Render Dirty.cpp b/TileEngine/Render Dirty.cpp index 1e22feb6..8fb82dad 100644 --- a/TileEngine/Render Dirty.cpp +++ b/TileEngine/Render Dirty.cpp @@ -604,20 +604,9 @@ BOOLEAN UpdateSaveBuffer(void) pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); - } - else if(gbPixelDepth==8) - { - // BLIT HERE - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, gsVIEWPORT_WINDOW_END_Y ); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -643,22 +632,11 @@ BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT1 pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -695,22 +673,11 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack ) pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -730,22 +697,11 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiSAVEBUFFER); UnLockVideoSurface(guiRENDERBUFFER); @@ -1342,18 +1298,11 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) usHeight = sBottom - sTop; usWidth = sRight - sLeft; - if(gbPixelDepth==16) - { - - Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, - sLeft, sTop, - uiLeftSkip, uiTopSkip, - usWidth, usHeight ); - } - else if(gbPixelDepth==8) - { - } + Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, + sLeft, sTop, + uiLeftSkip, uiTopSkip, + usWidth, usHeight ); // Once done, check for pending deletion if ( gVideoOverlays[uiCount].fDeletionPending ) diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 313161c1..b2f7e8e7 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1367,8 +1367,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart GetCurrentVideoSettings(&usWidth, &usHeight, &ubBitDepth); pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth == 16)// BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight); + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); } diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 85eb7bd9..ce88dc76 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -2398,617 +2398,528 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } else { - if (gbPixelDepth == 16) + /*if(fConvertTo16) { - /*if(fConvertTo16) + ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); + if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) { - ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); - if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) - { - Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); - } - }*/ - - if (fMultiTransShadowZBlitter) - { - if (fZBlitter) - { - if (fObscuredBlitter) - { - if (hVObjectAlpha == NULL) { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha == NULL) { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - } - } - else - { - //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); - } + Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); } - else if (fMultiZBlitter) + }*/ + + if (fMultiTransShadowZBlitter) + { + if (fZBlitter) { - if (fZBlitter) + if (fObscuredBlitter) { - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + if (hVObjectAlpha == NULL) { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); } - else - { - if (fWallTile) - { - if (sZStripIndex == -1) - { - Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex); - } - } - else - { - Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } + else { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); } } else { - Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + if (hVObjectAlpha == NULL) { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); + } + else { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); + } } } else { - bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - if (bBlitClipVal == TRUE) - { - if (fPixelate) - { - if (fTranslucencyType) - { - //if(fZWrite) - // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - //else - Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - //if(fZWrite) - // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - //else - Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fMerc) - { - if (fZBlitter) - { - if (fZWrite) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (fObscuredBlitter) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - - UnLockVideoSurface(guiSAVEBUFFER); - - // Turn it off! - pNode->uiFlags &= (~LEVELNODE_UPDATESAVEBUFFERONCE); - } - - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - } - else if (fShadowBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fIntensityBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fZBlitter) - { - if (fZWrite) - { - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else - { - Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - UnLockVideoSurface(guiSAVEBUFFER); - } - - } - else - Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - } - else if (bBlitClipVal == FALSE) - { - if (fPixelate) - { - if (fTranslucencyType) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fMerc) - { - // Flugente: draw riot shield UNDER the soldier - if ( pSoldier && - pSoldier->bVisible != -1 && - ( pSoldier->ubDirection == NORTH || - pSoldier->ubDirection == NORTHWEST || - pSoldier->ubDirection == WEST ) - && pSoldier->IsRiotShieldEquipped() ) - { - ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); - } - - if (fZBlitter) - { - if (fZWrite) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (fObscuredBlitter) - { - if (hVObjectAlpha != NULL) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - - UnLockVideoSurface(guiSAVEBUFFER); - - } - - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - - } - - // Flugente: draw riot shield OVER the soldier - if ( pSoldier && - pSoldier->bVisible != -1 && - ( pSoldier->ubDirection == EAST || - pSoldier->ubDirection == SOUTHEAST || - pSoldier->ubDirection == SOUTH || - pSoldier->ubDirection == SOUTHWEST || - pSoldier->ubDirection == NORTHEAST ) - && pSoldier->IsRiotShieldEquipped() ) - { - ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); - } - } - else if (fShadowBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fIntensityBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fZBlitter) - { - if (fZWrite) - { - // TEST - //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - } - else - Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - UnLockVideoSurface(guiSAVEBUFFER); - } - - } - else - Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } + //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } - else // 8bpp section + else if (fMultiZBlitter) { - if (fPixelate) + if (fZBlitter) { - if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else if (BltIsClipped(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect)) - { - if (fMerc) + if (fObscuredBlitter) { - Blt8BPPDataTo8BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable); - } - else if (fShadowBlitter) - if (fZWrite) - Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - else if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + { + if (fWallTile) + { + if (sZStripIndex == -1) + { + Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex); + } + } + else + { + Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } } else { - if (fMerc) - { + Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } + else + { + bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - // why to 16BPP here?? - if (hVObjectAlpha != NULL) + if (bBlitClipVal == TRUE) + { + if (fPixelate) + { + if (fTranslucencyType) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); + //if(fZWrite) + // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + //else + Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); + //if(fZWrite) + // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + //else + Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } + } + else if (fMerc) + { + if (fZBlitter) + { + if (fZWrite) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (fObscuredBlitter) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + } - // Blt8BPPDataTo8BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - // hVObject, - // sXPos, sYPos, - // usImageIndex, - // pShadeTable); + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + + UnLockVideoSurface(guiSAVEBUFFER); + + // Turn it off! + pNode->uiFlags &= (~LEVELNODE_UPDATESAVEBUFFERONCE); + } + + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } } else if (fShadowBlitter) { - if (fZWrite) - Blt8BPPDataTo8BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + else + Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } else - Blt8BPPDataTo8BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } + else if (fIntensityBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + else + Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + else + { + Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } } else if (fZBlitter) { if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + if (fObscuredBlitter) + { + Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + else + { + Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } else - Blt8BPPDataTo8BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + + UnLockVideoSurface(guiSAVEBUFFER); + } + } else - Blt8BPPDataTo8BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + + } + else if (bBlitClipVal == FALSE) + { + if (fPixelate) + { + if (fTranslucencyType) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fMerc) + { + // Flugente: draw riot shield UNDER the soldier + if ( pSoldier && + pSoldier->bVisible != -1 && + ( pSoldier->ubDirection == NORTH || + pSoldier->ubDirection == NORTHWEST || + pSoldier->ubDirection == WEST ) + && pSoldier->IsRiotShieldEquipped() ) + { + ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); + } + + if (fZBlitter) + { + if (fZWrite) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (fObscuredBlitter) + { + if (hVObjectAlpha != NULL) { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + } + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + + UnLockVideoSurface(guiSAVEBUFFER); + + } + + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + + } + + // Flugente: draw riot shield OVER the soldier + if ( pSoldier && + pSoldier->bVisible != -1 && + ( pSoldier->ubDirection == EAST || + pSoldier->ubDirection == SOUTHEAST || + pSoldier->ubDirection == SOUTH || + pSoldier->ubDirection == SOUTHWEST || + pSoldier->ubDirection == NORTHEAST ) + && pSoldier->IsRiotShieldEquipped() ) + { + ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); + } + } + else if (fShadowBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fIntensityBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fZBlitter) + { + if (fZWrite) + { + // TEST + //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + if (fObscuredBlitter) + { + Blt8BPPDataTo16BPPBufferTransZPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + } + else + Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + UnLockVideoSurface(guiSAVEBUFFER); + } + + } + else + Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } diff --git a/Utils/Utilities.cpp b/Utils/Utilities.cpp index a2634b5f..f8ed4476 100644 --- a/Utils/Utilities.cpp +++ b/Utils/Utilities.cpp @@ -15,8 +15,6 @@ extern BOOLEAN GetCDromDriveLetter( STR8 pString ); -#define DATA_8_BIT_DIR "8-Bit\\" - BOOLEAN PerformTimeLimitedCheck(); // WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece" @@ -97,26 +95,7 @@ BOOLEAN PerformTimeLimitedCheck(); //#define TIME_LIMITED_VERSION void FilenameForBPP(STR pFilename, STR pDestination) { -CHAR8 Drive[128], Dir[128], Name[128], Ext[128]; - - if(GETPIXELDEPTH()==16) - { - // no processing for 16 bit names - strcpy(pDestination, pFilename); - } - else - { - _splitpath(pFilename, Drive, Dir, Name, Ext); - - strcat(Name, "_8"); - - strcpy(pDestination, Drive); - //strcat(pDestination, Dir); - strcat(pDestination, DATA_8_BIT_DIR); - strcat(pDestination, Name); - strcat(pDestination, Ext); - } - + strcpy(pDestination, pFilename); } BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColFile ) diff --git a/Utils/Utilities.h b/Utils/Utilities.h index 3ffc30e0..d0d5dda0 100644 --- a/Utils/Utilities.h +++ b/Utils/Utilities.h @@ -5,8 +5,6 @@ #include "sgp.h" -#define GETPIXELDEPTH( ) ( gbPixelDepth ) - // WANNE: Maximum number of characters in german description (German xml files) #define MAXLINE 200 diff --git a/ext/export/src/export/sti/stci_image_utils.h b/ext/export/src/export/sti/stci_image_utils.h index 38c6e7a1..258baec7 100644 --- a/ext/export/src/export/sti/stci_image_utils.h +++ b/ext/export/src/export/sti/stci_image_utils.h @@ -42,10 +42,5 @@ namespace ja2xp UINT32 UnpackETRLEImageToBuffer(UINT8 *pBuffer, image_type *pImage, UINT16 ueETRLEIndex); UINT32 UnpackETRLEImageToRGBABuffer(UINT8 *pBuffer, image_type *pImage, UINT16 ueETRLEIndex); - /** - * NOTE: implemented in msvc inline assembler - * does not work with gcc -> use 'UnpackETRLEImageToBuffer' - */ - BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, image_type *hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); }; #endif // _STCI_IMAGE_UTILS_H_ diff --git a/sgp/Button System.cpp b/sgp/Button System.cpp index dd3d5b04..9ccc6bc3 100644 --- a/sgp/Button System.cpp +++ b/sgp/Button System.cpp @@ -794,10 +794,7 @@ BOOLEAN InitializeButtonImageManager(INT32 DefaultBuffer, INT32 DefaultPitch, IN return(FALSE); } - if(GETPIXELDEPTH()==16) - GenericButtonFillColors[0]=GenericButtonOffNormal[0]->p16BPPPalette[Pix]; - else if(GETPIXELDEPTH()==8) - GenericButtonFillColors[0]=COLOR_DKGREY; + GenericButtonFillColors[0]=GenericButtonOffNormal[0]->p16BPPPalette[Pix]; return(TRUE); } @@ -3689,145 +3686,63 @@ void DrawGenericButton(GUI_BUTTON *b) else ImgNum=1; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - (INT32)b->YLoc, - (UINT16)ImgNum, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - (INT32)b->YLoc, - (UINT16)ImgNum, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + (INT32)b->YLoc, + (UINT16)ImgNum, &ClipRect ); if(q==0) ImgNum=5; else ImgNum=6; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - cy, (UINT16)ImgNum, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - cy, (UINT16)ImgNum, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + cy, (UINT16)ImgNum, &ClipRect ); } // Blit the right side corners - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)b->YLoc, - 2, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)b->YLoc, - 2, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)b->YLoc, + 2, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, cy, 7, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, cy, 7, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, cy, 7, &ClipRect ); // Draw the vertical members of the button's borders NumChunksHigh--; if(hremain!=0) { q=NumChunksHigh; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 3, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 3, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 3, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 4, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 4, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 4, &ClipRect ); } for(q=1;qXLoc, - (INT32)(b->YLoc + (q*iBorderHeight)), - 3, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight)), - 3, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight)), + 3, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight)), - 4, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight)), - 4, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight)), + 4, &ClipRect ); } // Unlock buffer diff --git a/sgp/Font.cpp b/sgp/Font.cpp index 5caa433b..d853c542 100644 --- a/sgp/Font.cpp +++ b/sgp/Font.cpp @@ -1042,15 +1042,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1156,15 +1148,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1214,15 +1198,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1271,15 +1247,7 @@ CHAR16 string[512]; desty+=GetHeight(FontObjs[FontType], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontType], transletter); } @@ -1323,15 +1291,7 @@ CHAR16 string[512]; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1390,15 +1350,7 @@ UINT16 usOldForeColor; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1469,15 +1421,7 @@ UINT8 *pDestBuf; return 0; } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } diff --git a/sgp/line.cpp b/sgp/line.cpp index 76c344f7..b96a7cc1 100644 --- a/sgp/line.cpp +++ b/sgp/line.cpp @@ -30,11 +30,6 @@ void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, int Color, int ScreenWidth); -void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); -void DrawVerticalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); - void SetClippingRegionAndImageWidth( int iImageWidth, @@ -426,258 +421,3 @@ void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, shor LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); } - -/*********************************************************************************** -* 8-Bit Versions -* -* -* -* Added by Derek Beland -***********************************************************************************/ - -/* Draws a rectangle between the specified endpoints in color Color. */ -void RectangleDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) -{ - LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); - LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); -} - -/* Draws a line between the specified endpoints in color Color. */ -void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) -{ - int Temp, AdjUp, AdjDown, ErrorTerm, XAdvance, XDelta, YDelta; - int WholeStep, InitialPixelCount, FinalPixelCount, i, RunLength; - int ScreenWidth = giImageWidth; - UINT8 col1 = Color & 0x00FF; - - if ( fClip ) - { - if ( !Clip2D( &XStart, &YStart, &XEnd, &YEnd ) ) - return; - } - - /* We'll always draw top to bottom, to reduce the number of cases we have to - handle, and to make lines between the same endpoints draw the same pixels */ - if (YStart > YEnd) { - Temp = YStart; - YStart = YEnd; - YEnd = Temp; - Temp = XStart; - XStart = XEnd; - XEnd = Temp; - } - - // point to the bitmap address first pixel to draw - ScreenPtr = ScreenPtr + YStart*giImageWidth + XStart; - - /* Figure out whether we're going left or right, and how far we're - going horizontally */ - if ((XDelta = XEnd - XStart) < 0) - { - XAdvance = -1; - XDelta = -XDelta; - } - else - { - XAdvance = 1; - } - /* Figure out how far we're going vertically */ - YDelta = YEnd - YStart; - - /* Special-case horizontal, vertical, and diagonal lines, for speed - and to avoid nasty boundary conditions and division by 0 */ - if (XDelta == 0) - { - /* Vertical line */ - for (i=0; i<=YDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += giImageWidth; - } - return; - } - if (YDelta == 0) - { - /* Horizontal line */ - for (i=0; i<=XDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += XAdvance; - } - return; - } - if (XDelta == YDelta) - { - /* Diagonal line */ - for (i=0; i<=XDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += (XAdvance + giImageWidth); - } - return; - } - - /* Determine whether the line is X or Y major, and handle accordingly */ - if (XDelta >= YDelta) - { - /* X major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = XDelta / YDelta; - - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - AdjUp = (XDelta % YDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - AdjDown = YDelta * 2; - - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - ErrorTerm = (XDelta % YDelta) - (YDelta * 2); - - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; - - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += YDelta; - } - /* Draw the first, partial run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(YDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } - else - { - /* Y major line */ - - /* Minimum # of pixels in a run in this line */ - WholeStep = YDelta / XDelta; - - /* Error term adjust each time X steps by 1; used to tell when 1 extra - pixel should be drawn as part of a run, to account for - fractional steps along the Y axis per 1-pixel steps along X */ - AdjUp = (YDelta % XDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the Y step made at that time */ - AdjDown = XDelta * 2; - - /* Initial error term; reflects initial step of 0.5 along the X axis */ - ErrorTerm = (YDelta % XDelta) - (XDelta * 2); - - /* The initial and last runs are partial, because X advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; - - /* If the basic run length is even and there's no fractional advance, we - have 1 pixel that could go to either the initial or last partial run, - which we'll arbitrarily allocate to the last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there are an odd number of pixels per run, we have one pixel - that can't be allocated to either the initial or last partial - run, so we'll add 0.5 to the error term so this pixel will be - handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += XDelta; - } - /* Draw the first, partial run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - - /* Draw all full runs */ - for (i=0; i<(XDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } -} - - -/* Draws a horizontal run of pixels, then advances the bitmap pointer to - the first pixel of the next run. */ -void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth) -{ - int i; - UINT8 *WorkingScreenPtr = *ScreenPtr; - UINT8 col1 = Color & 0x00FF; - - for (i=0; ipETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - usZLevel=usZValue; -// usZLinesToGo=WORLD_TILE_Y; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZLevel - ja BlitNTL2 - - mov ax, usZLevel - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - // check for incrementing of z level - dec usZLinesToGo - jnz RSLoop2 - -// mov ax, usZLevel -// add ax, Z_SUBLEVELS -// mov usZLevel, ax - -// mov ax, WORLD_TILE_Y -// mov usZLinesToGo, ax - -RSLoop2: - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - /********************************************************************************************** InitZBuffer @@ -1953,4911 +1676,6 @@ BZR1: - - -//***************************************************************************** -//** 8 Bit Blitters -//** -//***************************************************************************** - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBuffer - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - static UINT32 uiOffset; - static UINT32 usHeight, usWidth; - static UINT8 *SrcPtr, *DestPtr; - static UINT32 LineSkip; - static ETRLEObject *pTrav; - static INT32 iTempX, iTempY; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - LineSkip=(uiDestPitchBYTES-(usWidth)); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ebx, ebx - xor ecx, ecx - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - - movsb - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - movsw - -BlitNTL3: - - or cl, cl - jz BlitDispatch - - xor ebx, ebx - -//BlitNTL4: - - rep movsd - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - xor al, al - rep stosb - - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferMonoShadow - - Uses a bitmap an 8BPP template for blitting. Anywhere a 1 appears in the bitmap, a shadow - is blitted to the destination (a black pixel). Any other value above zero is considered a - forground color, and zero is background. If the parameter for the background color is zero, - transparency is used for the background. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubForeground, UINT8 ubBackground) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov al, [esi] - cmp al, 1 - jne BlitNTL6 - - xor al, al - mov [edi], al - jmp BlitNTL5 - -BlitNTL6: - or al, al - jz BlitNTL7 - - mov al, ubForeground - mov [edi], al - jmp BlitNTL5 - -BlitNTL7: - cmp ubBackground, 0 - je BlitNTL5 - - mov al, ubBackground - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - and ecx, 07fH - - mov al, ubBackground - or al, al - jz BlitTrans1 - - rep stosb - jmp BlitDispatch - - -BlitTrans1: - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferMonoShadowClip - - Uses a bitmap an 8BPP template for blitting. Anywhere a 1 appears in the bitmap, a shadow - is blitted to the destination (a black pixel). Any other value above zero is considered a - forground color, and zero is background. If the parameter for the background color is zero, - transparency is used for the background. - - **********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubForeground, UINT8 ubBackground) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - xor eax, eax - mov al, [esi] - cmp al, 1 - jne BlitNTL3 - - // write shadow pixel - xor al, al - mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - or al, al - jz BlitNTL4 - - // write foreground pixel - mov al, ubForeground - mov [edi], al - jmp BlitNTL2 - -BlitNTL4: - cmp ubBackground, 0 - je BlitNTL2 - - //write background pixel - mov al, ubBackground - mov [edi], al - -BlitNTL2: - inc esi - inc edi - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - sub LSCount, ecx - - mov al, ubBackground - or al, al - jz BTrans2 - - rep stosb - jmp BlitDispatch - -BTrans2: - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - uiLineFlag=(iTempY&1); - - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZClipPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL2 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL2 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClipPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP=hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL2 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL2 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - - - - - - - - - - - - - - - - -/****************************************************************************** - Blt8BPPDataTo8BPPBufferTransparentClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. Clips the brush. - -*******************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP -// mov edx, pointer to shade table here - xor eax, eax - mov ebx, TopSkip - xor ecx, ecx - - or ebx, ebx // check for nothing clipped on top - jz LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec ebx - jnz TopSkipLoop - - - - -LeftSkipSetup: - - mov Unblitted, 0 - mov ebx, LeftSkip // check for nothing clipped on the left - or ebx, ebx - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, ebx - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, ebx // skip partial run, jump into normal loop for rest - sub ecx, ebx - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub ebx, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, ebx - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, ebx // skip partial run, jump into normal loop for rest - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub ebx, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov ebx, BlitLength - mov Unblitted, 0 - -BlitDispatch: - - or ebx, ebx // Check to see if we're done blitting - jz RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, ebx - jbe BNTrans1 - - sub ecx, ebx - mov Unblitted, ecx - mov ecx, ebx - -BNTrans1: - sub ebx, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - inc esi - inc edi - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - add esi, 2 - add edi, 2 - -BlitNTL3: - - or cl, cl - jz BlitLineEnd - -BlitNTL4: - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - add esi, 4 - add edi, 4 - - dec cl - jnz BlitNTL4 - -BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, ebx - jbe BTrans1 - - mov ecx, ebx - -BTrans1: - - sub ebx, ecx - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransparent - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *pPal8BPP; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - LineSkip=(uiDestPitchBYTES-(usWidth)); - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ebx, ebx - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - -// movsb - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - inc esi - inc edi - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - -// movsw - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - add esi, 2 - add edi, 2 - -BlitNTL3: - - or cl, cl - jz BlitDispatch - -BlitNTL4: - -// rep movsd - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - add esi, 4 - add edi, 4 - - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZ - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ, uiZComp; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - uiZComp=(UINT32)usZValue; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - -// do a byte - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL4 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - -BlitNTL4: - inc esi - inc ebx - inc edi - inc ebx - -// do a word -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL6 - -// word - first pixel - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL3 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -// word - second -BlitNTL3: - mov ax, [ebx+2] - cmp eax, uiZComp - ja BlitNTL12 - - mov eax, uiZComp - mov [ebx+2], ax - - xor eax, eax - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - -BlitNTL12: - - inc esi - inc edi - inc esi - inc edi - add ebx, 4 - -// do a dword -BlitNTL6: - or cl, cl - jz BlitDispatch - -BlitNTL7: - -// dword - first pixel - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL8 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -// dword - second -BlitNTL8: - mov ax, [ebx+2] - cmp eax, uiZComp - ja BlitNTL9 - - mov eax, uiZComp - mov [ebx+2], ax - - xor eax, eax - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - -BlitNTL9: -// dword - third pixel - mov ax, [ebx+4] - cmp eax, uiZComp - ja BlitNTL10 - - mov eax, uiZComp - mov [ebx+4], ax - - xor eax, eax - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - -// dword - fourth -BlitNTL10: - mov ax, [ebx+6] - cmp eax, uiZComp - ja BlitNTL11 - - mov eax, uiZComp - mov [ebx+6], ax - - xor eax, eax - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - -BlitNTL11: - add esi, 4 - add edi, 4 - add ebx, 8 - dec cl - jnz BlitNTL7 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNB - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBColor - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Any pixels that fail the Z test - are written to with the specified color. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubColor) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - jmp BlitNTL6 - -BlitNTL5: - xor ah, ah - mov al, ubColor - mov al, [edx+eax] - mov [edi], al - -BlitNTL6: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClipColor - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubColor) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - xor eax, eax - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - jmp BlitNTL3 - -BlitNTL2: - - xor ah, ah - mov al, ubColor - mov al, [edx+eax] - mov [edi], al - -BlitNTL3: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZ - - Creates a shadow using a brush, but modifies the destination buffer only if the current - Z level is equal to higher than what's in the Z buffer at that pixel location. It - updates the Z buffer with the new Z level. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZNB - - Creates a shadow using a brush, but modifies the destination buffer only if the current - Z level is equal to higher than what's in the Z buffer at that pixel location. - The Z buffer is NOT updated with the new information. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZNBClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - NOT updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZ - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. If the source pixel is 254, - it is considered a shadow, and the destination buffer is darkened rather than blitted on. - The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL6 - - mov al, [edi] -// mov al, ColorTable[eax] ********************************************* - mov [edi], al - jmp BlitNTL5 - - -BlitNTL6: - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZNB - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - NOT updated, for any non-transparent pixels. If the source pixel is 254, - it is considered a shadow, and the destination buffer is darkened rather than blitted on. - The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL6 - -// mov al, [edi] -// mov al, ColorTable[eax] ********************************************* -// mov [edi], al - jmp BlitNTL5 - - -BlitNTL6: - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Pixels with a value of - 254 are shaded instead of blitted. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL3 - - mov al, [edi] -// mov ax, ColorTable[eax] ************************************************ - mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZNBClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - NOT updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Pixels with a value of - 254 are shaded instead of blitted. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL3 - -// mov al, [edi] -// mov ax, ColorTable[eax] ************************************************ -// mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadow - - Modifies the destination buffer. Darkens the destination pixels by 25%, using the source - image as a mask. Any Non-zero index pixels are used to darken destination pixels. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex) -{ - UINT8 *pPal8BPP; - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, usHeight - xor ecx, ecx - mov edx, OFFSET ShadeTable - -BlitDispatch: - - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - - add esi, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - add edi, 2 - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax*2] - mov [edi+2], ax - - add edi, 4 - -BlitNTL3: - - or cl, cl - jz BlitDispatch - -BlitNTL4: - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax*2] - mov [edi+2], ax - - mov ax, [edi+4] - mov ax, [edx+eax*2] - mov [edi+4], ax - - mov ax, [edi+6] - mov ax, [edx+eax*2] - mov [edi+6], ax - - add edi, 8 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH -// shl ecx, 1 - add ecx, ecx - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec ebx - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowClip - - Modifies the destination buffer. Darkens the destination pixels by 25%, using the source - image as a mask. Any Non-zero index pixels are used to darken destination pixels. Blitter - clips brush if it doesn't fit on the viewport. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT8 *pPal8BPP; - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, TopSkip - xor ecx, ecx - - or ebx, ebx // check for nothing clipped on top - jz LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec ebx - jnz TopSkipLoop - - - - -LeftSkipSetup: - - mov Unblitted, 0 - mov ebx, LeftSkip // check for nothing clipped on the left - or ebx, ebx - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, ebx - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, ebx // skip partial run, jump into normal loop for rest - sub ecx, ebx - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub ebx, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, ebx - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, ebx // skip partial run, jump into normal loop for rest - mov ebx, BlitLength - jmp BlitTransparent - - -LSTrans1: - sub ebx, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov ebx, BlitLength - mov Unblitted, 0 - -BlitDispatch: - - or ebx, ebx // Check to see if we're done blitting - jz RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: - - cmp ecx, ebx - jbe BNTrans1 - - sub ecx, ebx - mov Unblitted, ecx - mov ecx, ebx - -BNTrans1: - sub ebx, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - inc esi - add edi, 2 - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax] - mov [edi+2], ax - - add esi, 2 - add edi, 4 - -BlitNTL3: - - or cl, cl - jz BlitLineEnd - -BlitNTL4: - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax] - mov [edi+2], ax - - mov ax, [edi+4] - mov ax, [edx+eax] - mov [edi+4], ax - - mov ax, [edi+6] - mov ax, [edx+eax] - mov [edi+6], ax - - add esi, 4 - add edi, 8 - dec cl - jnz BlitNTL4 - -BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - cmp ecx, ebx - jbe BTrans1 - - mov ecx, ebx - -BTrans1: - - sub ebx, ecx -// shl ecx, 1 - add ecx, ecx - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - - - //***************************************************************************** //** 16 Bit Blitters //** @@ -16788,79 +11606,6 @@ BOOLEAN UpdateBackupSurface( HVOBJECT hVObject ) */ -BOOLEAN FillRect8BPP(UINT8 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT8 color) -{ -INT32 x1real, y1real, x2real, y2real; -UINT32 linelength, lines, lineskip; -UINT8 *startoffset; - - // check parameters - Assert(pBuffer!=NULL); - Assert(uiDestPitchBYTES > 0); - Assert(x2 > x1); - Assert(y2 > y1); - - // clip edges of rect if hanging off screen - - x1real=__max(0, x1); - x2real=__min(639, x2); - y1real=__max(0, y1); - y2real=__min(479, y2); - - startoffset=pBuffer+(y1real*uiDestPitchBYTES)+x1real; - lines=y2real-y1real+1; - linelength=x2real-x1real+1; - lineskip=uiDestPitchBYTES-linelength; - - __asm { - mov edi, startoffset - mov al, color - mov ah, al - shl eax, 16 - mov al, color - mov ah, al - mov edx, lines - mov ebx, linelength - -// edi = destination pointer -// eax = dword of color value -// ebx = line length -// ecx = column counter -// edx = row counter - -LineLoop: - - mov ecx, ebx - - clc - rcr ecx, 1 - jnc FL2 - - mov [edi], al - inc edi - -FL2: - clc - rcr ecx, 1 - jnc FL3 - mov [edi], ax - add edi, 2 - -FL3: - or ecx, ecx - jz FillLineEnd - - rep stosd - -FillLineEnd: - add edi, lineskip - dec edx - jnz LineLoop - - } - return(TRUE); -} - BOOLEAN FillRect16BPP(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color) { INT32 x1real, y1real, x2real, y2real; diff --git a/sgp/vobject_blitters.h b/sgp/vobject_blitters.h index 2f7c1e1c..6a1b81d6 100644 --- a/sgp/vobject_blitters.h +++ b/sgp/vobject_blitters.h @@ -53,50 +53,9 @@ CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 UINT16 *InitZBuffer(UINT32 uiPitch, UINT32 uiHeight); BOOLEAN ShutdownZBuffer(UINT16 *pBuffer); -// 8-Bit to 8-Bit Blitters - -//BOOLEAN Blt8BPPDataTo8BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubColor); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubColor); - -// pixelation blitters -BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - - -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubForeground, UINT8 ubBackground); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - // 8-Bit to 16-Bit Blitters +BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 usColor); BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 usColor); @@ -152,19 +111,13 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadow(UINT16 *pBuffer, UINT32 uiDestPitchB BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowAlpha(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, HVOBJECT hAlphaVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows); BOOLEAN Blt8BPPDataTo16BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN DDBlt8BPPDataTo16BPPBufferShadow( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT8 level, COLORVAL maskrgb, UINT16 usX, UINT16 usY, SGPRect *srcRect); BOOLEAN Blt8BPPTo8BPP(UINT8 *pDest, UINT32 uiDestPitch, UINT8 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); BOOLEAN Blt16BPPTo16BPP(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans); BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans); -BOOLEAN Blt16BPPTo16BPPFog(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT8 *pFog, UINT16 usFogPitch); BOOLEAN Blt16BPPTo16BPPMirror(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt16BPPBufferPixelateRectWithColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8], UINT16 usColor ); BOOLEAN Blt16BPPBufferPixelateRect(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8]); @@ -186,12 +139,6 @@ BOOLEAN Blt8BPPDataSubTo16BPPBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, H BOOLEAN Blt8BPPDataTo16BPPBufferHalf( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSURFACE hSrcVSurface, UINT8 *pSrcBuffer, UINT32 uiSrcPitch, INT32 iX, INT32 iY); BOOLEAN Blt8BPPDataTo16BPPBufferHalfRect( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSURFACE hSrcVSurface, UINT8 *pSrcBuffer, UINT32 uiSrcPitch, INT32 iX, INT32 iY, SGPRect *pRect); -BOOLEAN DDBlt8BPPDataTo16BPPBuffer( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT16 usX, UINT16 usY, SGPRect *srcRect ); -BOOLEAN DDBlt8BPPDataTo16BPPBufferFullTransparent( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT16 usX, UINT16 usY, SGPRect *srcRect ); -BOOLEAN DDFillSurface( HVOBJECT hDestVObject, blt_fx *pBltFx ); -BOOLEAN DDFillSurfaceRect( HVOBJECT hDestVObject, blt_fx *pBltFx ); -BOOLEAN BltVObjectUsingDD( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT32 fBltFlags, INT32 iDestX, INT32 iDestY, RECT *SrcRect ); - BOOLEAN BlitZRect(UINT16 *pZBuffer, UINT32 uiPitch, INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom, UINT16 usZValue); @@ -202,7 +149,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pS BOOLEAN Blt16BPPDataTo16BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt16BPPDataTo16BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt16BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); // ATE: New blitters for showing an outline at color 254 BOOLEAN Blt8BPPDataTo16BPPBufferOutline( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, INT16 s16BPPColor, BOOLEAN fDoOutline ); @@ -226,7 +172,6 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha(UINT16 *pBuffer, BOOLEAN Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt8BPPDataTo16BPPBufferTransZPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN FillRect8BPP(UINT8 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT8 color); BOOLEAN FillRect16BPP(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color); /* From 586a46bb78ef51b9246361866c0c358cdfb1da1d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 24 Feb 2025 23:08:22 +0200 Subject: [PATCH 080/118] Remove last reference to gbPixelDepth --- Editor/editscreen.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 64eba6c4..563561ed 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -1069,10 +1069,7 @@ void ShowCurrentDrawingMode( void ) // Set the color for the window's border. Blueish color = Normal, Red = Fake lighting is turned on usFillColor = GenericButtonFillColors[0]; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - if(gbPixelDepth==16) - RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); - else if(gbPixelDepth==8) - RectangleDraw8( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); + RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); UnLockVideoSurface( FRAME_BUFFER ); From 4823ef49297040257fb5a9bdcc6f2a05d2b22520 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 6 Mar 2025 17:38:52 +0200 Subject: [PATCH 081/118] Add check for vest position attachments --- Tactical/LogicalBodyTypes/Filter.cpp | 12 ++++++++++++ Tactical/LogicalBodyTypes/Filter.h | 4 ++++ Tactical/LogicalBodyTypes/FilterDB.cpp | 8 ++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Tactical/LogicalBodyTypes/Filter.cpp b/Tactical/LogicalBodyTypes/Filter.cpp index d0a60a9e..3d666cbf 100644 --- a/Tactical/LogicalBodyTypes/Filter.cpp +++ b/Tactical/LogicalBodyTypes/Filter.cpp @@ -258,6 +258,18 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) { case REQ_LEGPOSATTACHMENT3: cmp_val = CompareAttachment(pSoldier, LEGPOS, 3); break; + case REQ_VESTPOSATTACHMENT0: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 0 ); + break; + case REQ_VESTPOSATTACHMENT1: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 1 ); + break; + case REQ_VESTPOSATTACHMENT2: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 2 ); + break; + case REQ_VESTPOSATTACHMENT3: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 3 ); + break; default: if (q < NUM_REQTYPESINV) { cmp_val = pSoldier->inv[q].usItem; diff --git a/Tactical/LogicalBodyTypes/Filter.h b/Tactical/LogicalBodyTypes/Filter.h index b8a865d2..cbc896bb 100644 --- a/Tactical/LogicalBodyTypes/Filter.h +++ b/Tactical/LogicalBodyTypes/Filter.h @@ -75,6 +75,10 @@ public: REQ_LEGPOSATTACHMENT1, REQ_LEGPOSATTACHMENT2, REQ_LEGPOSATTACHMENT3, + REQ_VESTPOSATTACHMENT0, + REQ_VESTPOSATTACHMENT1, + REQ_VESTPOSATTACHMENT2, + REQ_VESTPOSATTACHMENT3, NUM_REQTYPES, // 3rd byte is for operator flags _REQ_BTWN = 0x20000, diff --git a/Tactical/LogicalBodyTypes/FilterDB.cpp b/Tactical/LogicalBodyTypes/FilterDB.cpp index 747d19f1..b5f23d73 100644 --- a/Tactical/LogicalBodyTypes/FilterDB.cpp +++ b/Tactical/LogicalBodyTypes/FilterDB.cpp @@ -270,7 +270,7 @@ namespace LogicalBodyTypes { /***************************************** Filter enum criterion types ******************************************/ - LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 43, + LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 47, Filter::REQ_HELMETPOS, Filter::REQ_VESTPOS, Filter::REQ_LEGPOS, @@ -313,7 +313,11 @@ namespace LogicalBodyTypes { Filter::REQ_LEGPOSATTACHMENT0, Filter::REQ_LEGPOSATTACHMENT1, Filter::REQ_LEGPOSATTACHMENT2, - Filter::REQ_LEGPOSATTACHMENT3 + Filter::REQ_LEGPOSATTACHMENT3, + Filter::REQ_VESTPOSATTACHMENT0, + Filter::REQ_VESTPOSATTACHMENT1, + Filter::REQ_VESTPOSATTACHMENT2, + Filter::REQ_VESTPOSATTACHMENT3 ); /***************************************** From f21cb3864769cd907779ef9775fc718dcb5eaa00 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 5 Apr 2025 16:16:02 +0300 Subject: [PATCH 082/118] Increase TileNo to UINT32 Bigmap grid number values go over uint16 max --- TileEngine/lighting.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index f873eaf1..b1bcdd67 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -1,3 +1,4 @@ +#pragma optimize("", off) #include "builddefines.h" /**************************************************************************************** @@ -460,36 +461,36 @@ UINT16 usNumNodes; ***************************************************************************************/ BOOLEAN LightTileBlocked(INT16 iSrcX, INT16 iSrcY, INT16 iX, INT16 iY) { -UINT16 usTileNo, usSrcTileNo; +UINT32 uiTileNo, uiSrcTileNo; Assert(gpWorldLevelData!=NULL); - usTileNo=MAPROWCOLTOPOS(iY, iX); - usSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); + uiTileNo=MAPROWCOLTOPOS(iY, iX); + uiSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); - if (TileIsOutOfBounds(usTileNo)) + if (TileIsOutOfBounds(uiTileNo)) { return( FALSE ); } - if (TileIsOutOfBounds(usSrcTileNo)) + if (TileIsOutOfBounds(uiSrcTileNo)) { return( FALSE ); } - if(gpWorldLevelData[ usTileNo ].sHeight > gpWorldLevelData[ usSrcTileNo ].sHeight) + if(gpWorldLevelData[ uiTileNo ].sHeight > gpWorldLevelData[ uiSrcTileNo ].sHeight) return(TRUE); { - UINT16 usTileNo; + UINT32 uiTileNo; LEVELNODE *pStruct; - usTileNo=MAPROWCOLTOPOS(iY, iX); + uiTileNo=MAPROWCOLTOPOS(iY, iX); - pStruct = gpWorldLevelData[ usTileNo ].pStructHead; + pStruct = gpWorldLevelData[ uiTileNo ].pStructHead; if ( pStruct != NULL ) { // IF WE ARE A WINDOW, DO NOT BLOCK! - if ( FindStructure( usTileNo, STRUCTURE_WALLNWINDOW ) != NULL ) + if ( FindStructure( uiTileNo, STRUCTURE_WALLNWINDOW ) != NULL ) { return( FALSE ); } @@ -509,8 +510,8 @@ BOOLEAN LightTileHasWall( INT16 iSrcX, INT16 iSrcY, INT16 iX, INT16 iY) { //LEVELNODE *pStruct; //UINT32 uiType; -UINT16 usTileNo; -UINT16 usSrcTileNo; +UINT32 uiTileNo; +UINT32 uiSrcTileNo; INT8 bDirection; UINT8 ubTravelCost; //INT8 bWallCount = 0; @@ -518,20 +519,20 @@ UINT8 ubTravelCost; Assert(gpWorldLevelData!=NULL); - usTileNo=MAPROWCOLTOPOS(iY, iX); - usSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); + uiTileNo=MAPROWCOLTOPOS(iY, iX); + uiSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); - if ( usTileNo == usSrcTileNo ) + if ( uiTileNo == uiSrcTileNo ) { return( FALSE ); } - if ( TileIsOutOfBounds(usTileNo)) + if ( TileIsOutOfBounds(uiTileNo)) { return( FALSE ); } - if ( TileIsOutOfBounds(usSrcTileNo)) + if ( TileIsOutOfBounds(uiSrcTileNo)) { return( FALSE ); } @@ -541,7 +542,7 @@ UINT8 ubTravelCost; bDirection = atan8( iSrcX, iSrcY, iX, iY ); - ubTravelCost = gubWorldMovementCosts[ usTileNo ][ bDirection ][ 0 ]; + ubTravelCost = gubWorldMovementCosts[ uiTileNo ][ bDirection ][ 0 ]; if ( ubTravelCost == TRAVELCOST_WALL ) { @@ -550,7 +551,7 @@ UINT8 ubTravelCost; if ( IS_TRAVELCOST_DOOR( ubTravelCost ) ) { - ubTravelCost = DoorTravelCost( NULL, usTileNo, ubTravelCost, TRUE, NULL ); + ubTravelCost = DoorTravelCost( NULL, uiTileNo, ubTravelCost, TRUE, NULL ); if ( ubTravelCost == TRAVELCOST_OBSTACLE || ubTravelCost == TRAVELCOST_DOOR ) { From 5ed70befb4d8b6180325d2f3abd40dd5cf608b28 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Wed, 9 Apr 2025 19:52:23 +0200 Subject: [PATCH 083/118] Fixed tagged releases (#429) Fixed tagged releases --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c25feead..53acfa5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -211,9 +211,7 @@ jobs: - name: Upload to tagged release if: startsWith(github.ref, 'refs/tags/v') - working-directory: source run: | - exit 0 - gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber + gh release upload "$GITHUB_REF_NAME" dist/* --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9df885a2647b296fe504fd2a9235a4c2bb795ba4 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:33:05 +0200 Subject: [PATCH 084/118] Fixed tagged releases #2 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53acfa5e..9eeb84e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,7 +186,6 @@ jobs: merge-multiple: true - name: Checkout Repo - if: github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: path: source @@ -211,7 +210,8 @@ jobs: - name: Upload to tagged release if: startsWith(github.ref, 'refs/tags/v') + working-directory: source run: | - gh release upload "$GITHUB_REF_NAME" dist/* --clobber + gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3e45217a9a663abbfa4676bb09fb9e626775b876 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 12 Apr 2025 23:48:12 +0300 Subject: [PATCH 085/118] Add compilationFlags to {exe} (#428) * Add compilationFlags to {exe} sgp.cpp is not recognizing JA2EDITOR preprocessor definition otherwise and therefore does not read EDITOR_SCREEN_RESOLUTION when starting map editor * Add debugFlags too --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cbfd1fa..9be4f1c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,6 +147,7 @@ foreach(app IN LISTS ApplicationTargets) ) target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) target_link_options(${exe} PRIVATE $) + target_compile_definitions(${exe} PRIVATE ${compilationFlags} ${debugFlags}) # language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n set(language_library ${exe}_i18n) From c2e78d04616fa2897b065dec20cb03fcc1e976c4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 01:10:33 +0300 Subject: [PATCH 086/118] Use correct macro to index StrategicMap --- Tactical/Merc Hiring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 24e98b63..a86aca68 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -1043,7 +1043,7 @@ void UpdateJerryMiloInInitialSector() //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; - StrategicMap[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; + StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; if ( gGameUBOptions.InGameHeli == TRUE ) return; //AA @@ -1071,7 +1071,7 @@ if ( gGameUBOptions.InGameHeliCrash == TRUE ) //Record the initial sector as ours //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; - StrategicMap[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; + StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; if ( gGameUBOptions.InJerry == TRUE ) { From 8f98a9b9850f1eb8e438de2e069f6590a6fd465f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 01:11:37 +0300 Subject: [PATCH 087/118] Move UpdateAirspaceControl() out of #ifdef Fixes UB not updating samsite airspace correctly after battle --- Strategic/Player Command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index efa91292..51fd7d7d 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -342,8 +342,8 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B // Ja25: no loyalty #else HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_SAM, sMapX, sMapY, bMapZ ); - UpdateAirspaceControl( ); #endif + UpdateAirspaceControl( ); // if Skyrider has been delivered to chopper, and already mentioned Drassen SAM site, but not used this quote yet if ( IsHelicopterPilotAvailable( ) && ( guiHelicopterSkyriderTalkState >= 1 ) && ( !gfSkyriderSaidCongratsOnTakingSAM ) ) { From 92103e36a6bb9b7b2313ab1f0ebe8e602b3c186a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 01:12:56 +0300 Subject: [PATCH 088/118] Fix formatting --- Tactical/Merc Hiring.cpp | 124 +++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index a86aca68..b193f2e6 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -1036,78 +1036,78 @@ if ( gGameUBOptions.InGameHeliCrash == TRUE ) void UpdateJerryMiloInInitialSector() { - SOLDIERTYPE *pSoldier = NULL; - SOLDIERTYPE *pJerrySoldier=NULL; + SOLDIERTYPE *pSoldier = NULL; + SOLDIERTYPE *pJerrySoldier = NULL; - - //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; - SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; - //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; - StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; - -if ( gGameUBOptions.InGameHeli == TRUE ) - return; //AA -if ( gGameUBOptions.InGameHeliCrash == TRUE ) - { - //if it is the first sector we are loading up, place Jerry in the map - if( !gfFirstTimeInGameHeliCrash ) - return; - - if ( gGameUBOptions.InJerry == TRUE ) - { - pSoldier = FindSoldierByProfileID( JERRY_MILO_UB, FALSE ); //JERRY - if( pSoldier == NULL ) - { - Assert( 0 ); - } - - } - - //the internet part of the laptop isnt working. It gets broken in the heli crash. - if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) - StartQuest( QUEST_FIX_LAPTOP, -1, -1 ); - - //Record the initial sector as ours //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; - SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; - StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; - - if ( gGameUBOptions.InJerry == TRUE ) + SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; + //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; + StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; + + if ( gGameUBOptions.InGameHeli == TRUE ) + return; //AA + + if ( gGameUBOptions.InGameHeliCrash == TRUE ) { - //Set some variable so Jerry will be on the ground - pSoldier->fWaitingToGetupFromJA25Start = TRUE; - pSoldier->fIgnoreGetupFromCollapseCheck = TRUE; + //if it is the first sector we are loading up, place Jerry in the map + if ( !gfFirstTimeInGameHeliCrash ) + return; - //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; //to byo wyczone - //pSoldier->usStrategicInsertionData = GetInitialHeliGridNo( ); //to byo wyczone + if ( gGameUBOptions.InJerry == TRUE ) + { + pSoldier = FindSoldierByProfileID( JERRY_MILO_UB, FALSE ); //JERRY + if ( pSoldier == NULL ) + { + Assert( 0 ); + } - RESETTIMECOUNTER( pSoldier->GetupFromJA25StartCounter, gsInitialHeliRandomTimes[ 6 ] + 800 + Random( 400 ) ); + } - //should we be on our back or tummy - if( Random( 100 ) < 50 ) - pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); - else - pSoldier->EVENT_InitNewSoldierAnim( FALLBACKHIT_STOP, 1, TRUE ); - } + //the internet part of the laptop isnt working. It gets broken in the heli crash. + if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) + StartQuest( QUEST_FIX_LAPTOP, -1, -1 ); -//Wont work cause it gets reset every frame - //make sure we can see Jerry - - if ( gGameUBOptions.InJerry == TRUE ) - { - pJerrySoldier = FindSoldierByProfileID(JERRY_MILO_UB, FALSE );//JERRY - if( pJerrySoldier != NULL ) - { - //Make sure we can see the pilot - gbPublicOpplist[OUR_TEAM][ pJerrySoldier->ubID ] = SEEN_CURRENTLY; - pJerrySoldier->bVisible = TRUE; - } + //Record the initial sector as ours + //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; + SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; + StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; - } + if ( gGameUBOptions.InJerry == TRUE ) + { + //Set some variable so Jerry will be on the ground + pSoldier->fWaitingToGetupFromJA25Start = TRUE; + pSoldier->fIgnoreGetupFromCollapseCheck = TRUE; - //Lock the interface - guiPendingOverrideEvent = LU_BEGINUILOCK; + //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; //to byo wyczone + //pSoldier->usStrategicInsertionData = GetInitialHeliGridNo( ); //to byo wyczone + + RESETTIMECOUNTER( pSoldier->GetupFromJA25StartCounter, gsInitialHeliRandomTimes[6] + 800 + Random( 400 ) ); + + //should we be on our back or tummy + if ( Random( 100 ) < 50 ) + pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); + else + pSoldier->EVENT_InitNewSoldierAnim( FALLBACKHIT_STOP, 1, TRUE ); + } + + //Wont work cause it gets reset every frame + //make sure we can see Jerry + + if ( gGameUBOptions.InJerry == TRUE ) + { + pJerrySoldier = FindSoldierByProfileID( JERRY_MILO_UB, FALSE );//JERRY + if ( pJerrySoldier != NULL ) + { + //Make sure we can see the pilot + gbPublicOpplist[OUR_TEAM][pJerrySoldier->ubID] = SEEN_CURRENTLY; + pJerrySoldier->bVisible = TRUE; + } + + } + + //Lock the interface + guiPendingOverrideEvent = LU_BEGINUILOCK; } } From 5f45d068526334e4b4f6e76da77db5df913e10da Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 20:07:42 +0300 Subject: [PATCH 089/118] Fix possible integer overflow --- Tactical/Merc Hiring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index b193f2e6..faa73287 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -1043,7 +1043,7 @@ void UpdateJerryMiloInInitialSector() //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; - StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; + StrategicMap[CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; if ( gGameUBOptions.InGameHeli == TRUE ) return; //AA @@ -1071,7 +1071,7 @@ void UpdateJerryMiloInInitialSector() //Record the initial sector as ours //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; - StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; + StrategicMap[CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; if ( gGameUBOptions.InJerry == TRUE ) { From 8dcb431ef2d9ff9c042eb23e6b258d05a68778de Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 17 Apr 2025 23:46:42 +0300 Subject: [PATCH 090/118] Use (0,0) sector coordinates as unused cache Makes the comment in Mod_Settings.ini valid advice --- Strategic/Strategic AI.cpp | 66 +++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index bf1d52b5..378a3584 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -1610,6 +1610,11 @@ void InitStrategicAI() case 1: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + // (0,0) coordinates signify a not used cache sector + if ( gModSettings.ubWeaponCache1X == 0 || gModSettings.ubWeaponCache1Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); @@ -1628,6 +1633,10 @@ void InitStrategicAI() case 2: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache2X == 0 || gModSettings.ubWeaponCache2Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); @@ -1646,6 +1655,10 @@ void InitStrategicAI() case 3: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache3X == 0 || gModSettings.ubWeaponCache3Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y ) ]; //SEC_H10 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); @@ -1664,6 +1677,10 @@ void InitStrategicAI() case 4: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache4X == 0 || gModSettings.ubWeaponCache4Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); @@ -1682,6 +1699,10 @@ void InitStrategicAI() case 5: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache5X == 0 || gModSettings.ubWeaponCache5Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); @@ -1706,25 +1727,40 @@ void InitStrategicAI() } else { - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); + if ( gModSettings.ubWeaponCache1X != 0 && gModSettings.ubWeaponCache1Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y )]; //SEC_E11 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); + if ( gModSettings.ubWeaponCache2X != 0 && gModSettings.ubWeaponCache2Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y )]; //SEC_H5 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y ) ]; //SEC_H10 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); + if ( gModSettings.ubWeaponCache3X != 0 && gModSettings.ubWeaponCache3Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y )]; //SEC_H10 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); + if ( gModSettings.ubWeaponCache4X != 0 && gModSettings.ubWeaponCache4Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y )]; //SEC_J12 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); + if ( gModSettings.ubWeaponCache5X != 0 && gModSettings.ubWeaponCache5Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y )]; //SEC_M9 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); + } /* pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 From dd58f904f4ac4cbfee0ae5f87e95c06c5aab37ff Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:51:02 +0300 Subject: [PATCH 091/118] Do not offer surrender for multiplayer --- TacticalAI/DecideAction.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index c30aaa68..624ccb40 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -5164,13 +5164,16 @@ INT16 ubMinAPCost; // offer surrender? #ifndef JA2UB - if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) + if ( !is_networked ) // No surrender in multiplayer { - if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && gTacticalStatus.Team[ CREATURE_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 ) + if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) { - if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) + if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && gTacticalStatus.Team[ CREATURE_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 ) { - return( AI_ACTION_OFFER_SURRENDER ); + if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) + { + return( AI_ACTION_OFFER_SURRENDER ); + } } } } @@ -9584,13 +9587,16 @@ INT8 ArmedVehicleDecideActionBlack( SOLDIERTYPE *pSoldier ) // offer surrender? #ifndef JA2UB - if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) + if ( !is_networked ) // No surrender in multiplayer { - if ( gTacticalStatus.Team[MILITIA_TEAM].bMenInSector == 0 && gTacticalStatus.Team[CREATURE_TEAM].bMenInSector == 0 && NumPCsInSector( ) < 4 && gTacticalStatus.Team[ENEMY_TEAM].bMenInSector >= NumPCsInSector( ) * 3 ) + if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) { - if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) + if ( gTacticalStatus.Team[MILITIA_TEAM].bMenInSector == 0 && gTacticalStatus.Team[CREATURE_TEAM].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ENEMY_TEAM].bMenInSector >= NumPCsInSector() * 3 ) { - return(AI_ACTION_OFFER_SURRENDER); + if ( gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED ) + { + return(AI_ACTION_OFFER_SURRENDER); + } } } } From 5062ae74f2088da1e6bbdef1cd17d8be00c22a76 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 25 Apr 2025 23:09:19 +0300 Subject: [PATCH 092/118] Display correct salary info for MERCs in UB campaign --- Laptop/mercs Files.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index e1372176..8bbda718 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1040,14 +1040,25 @@ void DisplayMercsStats( UINT8 ubMercID ) DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bMedical, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, ubColor); usPosY += MERC_SPACE_BN_LINES; - //Daily Salary - DrawTextToScreen( MercInfo[MERC_FILES_SALARY], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + //Merc Salary +#ifdef JA2UB + // One time "Fee" instead of "Salary" per day + DrawTextToScreen( CharacterInfo[AIM_MEMBER_FEE], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - usPosX = MERC_STATS_SECOND_COL_X + StringPixLength(MercInfo[MERC_FILES_SALARY], MERC_NAME_FONT); - swprintf(sString, L"%d", gMercProfiles[ ubMercID ].sSalary); + usPosX = MERC_STATS_SECOND_COL_X + StringPixLength( CharacterInfo[AIM_MEMBER_FEE], MERC_NAME_FONT ); + swprintf( sString, L"%d", gMercProfiles[ubMercID].uiWeeklySalary ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - swprintf(sTemp, L" %s", MercInfo[MERC_FILES_PER_DAY]); +#else + DrawTextToScreen( MercInfo[MERC_FILES_SALARY], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + usPosX = MERC_STATS_SECOND_COL_X + StringPixLength( MercInfo[MERC_FILES_SALARY], MERC_NAME_FONT ); + swprintf( sString, L"%d", gMercProfiles[ubMercID].sSalary ); + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + swprintf( sTemp, L" %s", MercInfo[MERC_FILES_PER_DAY] ); +#endif // JA2UB + wcscat( sString, sTemp ); DrawTextToScreen( sString, usPosX, usPosY, 95, MERC_NAME_FONT, MERC_DYNAMIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); From a3e7ce57945747474cb8c3e987fabf1624d2b5d5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:21:43 +0300 Subject: [PATCH 093/118] Display special offer for 1st M.E.R.C. inv kit in UB * Use weekly instead of daily salary for total cost calculation --- Laptop/mercs Files.cpp | 40 +++++++++++++++++++++++++++++++++------- i18n/_ChineseText.cpp | 1 + i18n/_DutchText.cpp | 1 + i18n/_EnglishText.cpp | 1 + i18n/_FrenchText.cpp | 1 + i18n/_GermanText.cpp | 1 + i18n/_ItalianText.cpp | 1 + i18n/_PolishText.cpp | 1 + i18n/_RussianText.cpp | 1 + i18n/include/Text.h | 1 + 10 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 8bbda718..3e41ad50 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1070,14 +1070,27 @@ void DisplayMercsStats( UINT8 ubMercID ) if (gubCurMercFilesTogglePage == MERC_FILES_INV_PAGE) { //Gear Cost - usPosY = usPosY + 145; + usPosY = usPosY + 148; DrawTextToScreen( MercInfo[MERC_FILES_GEAR], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); - if ( (gMercProfiles[ ubMercID ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS ) - && ( !(gMercProfiles[ ubMercID ].ubMiscFlags2 & PROFILE_MISC_FLAG2_MERC_GEARKIT_UNPAID) || gGameExternalOptions.fGearKitsAlwaysAvailable ) ) + if ( (gMercProfiles[ubMercID].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) + && (!(gMercProfiles[ubMercID].ubMiscFlags2 & PROFILE_MISC_FLAG2_MERC_GEARKIT_UNPAID) || gGameExternalOptions.fGearKitsAlwaysAvailable) ) + { gMercProfiles[ ubMercID ].usOptionalGearCost = 0; + } +#ifdef JA2UB + if ( gSelectedMercKit == 0 ) // First kit is free, due to M.E.R.C special offer + { + gMercProfiles[ubMercID].usOptionalGearCost = 0; - swprintf(NsString, L"+ "); + // Special offer text above the gear cost + const auto y = usPosY - MERC_SPACE_BN_LINES + 2; + swprintf( NsString, MercInfo[MERC_FILES_SPECIAL_OFFER] ); + DrawTextToScreen( NsString, usPosX, y, 95, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + } +#endif // JA2UB + + swprintf( NsString, L"+ " ); swprintf(sTemp, L"%d",gMercProfiles[ ubMercID ].usOptionalGearCost); InsertCommasForDollarFigure( sTemp ); InsertDollarSignInToString( sTemp ); @@ -1089,7 +1102,11 @@ void DisplayMercsStats( UINT8 ubMercID ) DrawTextToScreen( MercInfo[MERC_FILES_TOTAL], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_NAME_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); swprintf(N2sString, L"= "); +#ifdef JA2UB + swprintf( sTemp, L"%d", gMercProfiles[ubMercID].usOptionalGearCost + gMercProfiles[ubMercID].uiWeeklySalary ); +#else swprintf(sTemp, L"%d",gMercProfiles[ ubMercID ].usOptionalGearCost+gMercProfiles[ ubMercID ].sSalary); +#endif InsertCommasForDollarFigure( sTemp ); InsertDollarSignInToString( sTemp ); wcscat( N2sString, sTemp ); @@ -1207,16 +1224,25 @@ BOOLEAN MercFilesHireMerc(UINT8 ubMercID) AddTransactionToPlayersBook( HIRED_MERC, ubMercID, GetWorldTotalMin(), Namount ); } - #ifdef JA2UB +#ifdef JA2UB //add an entry in the finacial page for the hiring of the merc - AddTransactionToPlayersBook(PAY_SPECK_FOR_MERC, ubMercID, GetWorldTotalMin(), -(INT32)( gMercProfiles[ubMercID].uiWeeklySalary ) ); - #endif + INT32 totalCost = gMercProfiles[ubMercID].uiWeeklySalary; + if ( gSelectedMercKit > 0 ) // First kit is included in the initial fee + { + totalCost += gMercProfiles[ubMercID].usOptionalGearCost; + } + AddTransactionToPlayersBook(PAY_SPECK_FOR_MERC, ubMercID, GetWorldTotalMin(), -totalCost ); +#endif //JMich_MMG: Setting the flag that we bought the gear and still haven't paid for it if we succesfully hired the merc if ( fMercBuyEquipment ) { gMercProfiles[ ubMercID ].ubMiscFlags |= PROFILE_MISC_FLAG_ALREADY_USED_ITEMS; +#ifdef JA2UB + // Gear cost gets added to initial hiring fee in UB +#else gMercProfiles[ ubMercID ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_MERC_GEARKIT_UNPAID; +#endif // JA2UB } return(TRUE); diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 3b7f881c..56deb055 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -5478,6 +5478,7 @@ STR16 MercInfo[] = L"未结账单", //L"Unsettled Bills", L"生平", //L"Bio", L"物品", //L"Inv", + L"Special Offer!", }; diff --git a/i18n/_DutchText.cpp b/i18n/_DutchText.cpp index 976ea802..580bb33c 100644 --- a/i18n/_DutchText.cpp +++ b/i18n/_DutchText.cpp @@ -5481,6 +5481,7 @@ STR16 MercInfo[] = L"Unsettled Bills", // TODO.Translate L"Bio", // TODO.Translate L"Inv", + L"Special Offer!", }; diff --git a/i18n/_EnglishText.cpp b/i18n/_EnglishText.cpp index 0f5f947e..377ad755 100644 --- a/i18n/_EnglishText.cpp +++ b/i18n/_EnglishText.cpp @@ -5478,6 +5478,7 @@ STR16 MercInfo[] = L"Unsettled Bills", L"Bio", L"Inv", + L"Special Offer!", }; diff --git a/i18n/_FrenchText.cpp b/i18n/_FrenchText.cpp index 6a259577..fbd776a8 100644 --- a/i18n/_FrenchText.cpp +++ b/i18n/_FrenchText.cpp @@ -5485,6 +5485,7 @@ STR16 MercInfo[] = L"Payez sa solde", L"Biographie", L"Inventaire", + L"Special Offer!", }; diff --git a/i18n/_GermanText.cpp b/i18n/_GermanText.cpp index 53bb2601..4b66db3f 100644 --- a/i18n/_GermanText.cpp +++ b/i18n/_GermanText.cpp @@ -5429,6 +5429,7 @@ STR16 MercInfo[] = L"Offene Beträge", L"Bio", L"Inv", + L"Special Offer!", }; // For use at the M.E.R.C. web site. Text relating to opening an account with MERC diff --git a/i18n/_ItalianText.cpp b/i18n/_ItalianText.cpp index 6f9cbb10..0601468b 100644 --- a/i18n/_ItalianText.cpp +++ b/i18n/_ItalianText.cpp @@ -5468,6 +5468,7 @@ STR16 MercInfo[] = L"Unsettled Bills", // TODO.Translate L"Bio", // TODO.Translate L"Inv", + L"Special Offer!", }; diff --git a/i18n/_PolishText.cpp b/i18n/_PolishText.cpp index 8445de0d..f49fe637 100644 --- a/i18n/_PolishText.cpp +++ b/i18n/_PolishText.cpp @@ -5481,6 +5481,7 @@ STR16 MercInfo[] = L"Unsettled Bills", // TODO.Translate L"Bio", // TODO.Translate L"Inv", + L"Special Offer!", }; diff --git a/i18n/_RussianText.cpp b/i18n/_RussianText.cpp index 110c38e7..5b1a777e 100644 --- a/i18n/_RussianText.cpp +++ b/i18n/_RussianText.cpp @@ -5474,6 +5474,7 @@ STR16 MercInfo[] = L"Неоплаченные счета", L"Информация", L"Снаряжение", + L"Special Offer!", }; diff --git a/i18n/include/Text.h b/i18n/include/Text.h index 6d97672a..12584904 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -1262,6 +1262,7 @@ enum MERC_FILES_MERC_OUTSTANDING, MERC_FILES_BIO, //JMich_MMG: Adding two new texts for the small button, assuming we manage to add a silhouette with the gear, add it after this. MERC_FILES_INVENTORY, + MERC_FILES_SPECIAL_OFFER, TEXT_NUM_MERC_FILES, }; extern STR16 MercInfo[]; From db6da100e18a0353041db6f8063aaf58e1519a14 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:22:24 +0300 Subject: [PATCH 094/118] Reset selected gear kit when browsing mercs --- Laptop/mercs Files.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 3e41ad50..4ef50fd5 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1847,6 +1847,10 @@ void MercProcessHireAfterGear() void NextMercMember() { + // Reset selected kit, cannot assume next merc has more than 1 kit + gSelectedMercKit = 0; + MercWeaponKitSelectionUpdate( gSelectedMercKit ); + if (gfKeyState [ CTRL ]) gubCurMercIndex = LaptopSaveInfo.gubLastMercIndex; else if (gfKeyState [ SHIFT ]) @@ -1877,6 +1881,10 @@ void NextMercMember() void PrevMercMember() { + // Reset selected kit, cannot assume next merc has more than 1 kit + gSelectedMercKit = 0; + MercWeaponKitSelectionUpdate( gSelectedMercKit ); + if (gfKeyState [ CTRL ]) gubCurMercIndex = 0; else if (gfKeyState [ SHIFT ]) From fa0c5a2862ddde9c31a3b045a7b4dc62ca979a02 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:23:02 +0300 Subject: [PATCH 095/118] Prevent hiring MERC in UB if not enough funds --- Laptop/mercs Files.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 4ef50fd5..159161d7 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1203,6 +1203,22 @@ BOOLEAN MercFilesHireMerc(UINT8 ubMercID) return(FALSE);//not enough big ones $$$sATMText } +#ifdef JA2UB + Namount = 0; + Namount += gMercProfiles[ubMercID].uiWeeklySalary; + if ( gSelectedMercKit > 0 ) + { + Namount += gMercProfiles[ubMercID].usOptionalGearCost; + } + + if ( Namount > LaptopSaveInfo.iCurrentBalance ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, sATMText[4], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + return(FALSE);//not enough big ones $$$sATMText + } +#endif // JA2UB + + bReturnCode = HireMerc( &HireMercStruct ); //already have limit of mercs on the team From b23c9ac8b105a2b675a48fe5e035eeb6ac0f0e87 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:30:45 +0300 Subject: [PATCH 096/118] Do not prompt for buying inventory for 1st kit in UB --- Laptop/mercs Files.cpp | 58 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 159161d7..e95782c1 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -418,6 +418,34 @@ BOOLEAN EnterMercsFiles() return( TRUE ); } +static void TryToHireMERC() +{ + if ( (gMercProfiles[GetAvailableMercIDFromMERCArray( gubCurMercIndex )].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) + { + //bought gear before + fMercBuyEquipment = 0; + MercProcessHireAfterGear(); + } + else + { +#ifdef JA2UB + if ( gSelectedMercKit == 0 ) // First kit is free, due to M.E.R.C special offer + { + fMercBuyEquipment = 1; + MercProcessHireAfterGear(); + } + else + { + //prompt to buy gear + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[MERC_FILES_BUY_GEAR], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + } +#else + //prompt to buy gear + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[MERC_FILES_BUY_GEAR], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); +#endif // JA2UB + } +} + void SelectMercsFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) @@ -442,15 +470,7 @@ void SelectMercsFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) //else try to hire the merc else { - if ( (gMercProfiles[ GetAvailableMercIDFromMERCArray( gubCurMercIndex ) ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) - { - //bought gear before - fMercBuyEquipment = 0; - MercProcessHireAfterGear(); - } - else - //prompt to buy gear - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[ MERC_FILES_BUY_GEAR ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + TryToHireMERC(); } } } @@ -701,15 +721,7 @@ void BtnMercHireButtonCallback(GUI_BUTTON *btn,INT32 reason) //else try to hire the merc else { - if ( (gMercProfiles[ GetAvailableMercIDFromMERCArray( gubCurMercIndex ) ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) - { - //bought gear before - fMercBuyEquipment = 0; - MercProcessHireAfterGear(); - } - else - //prompt to buy gear - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[ MERC_FILES_BUY_GEAR ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + TryToHireMERC(); } InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); @@ -1358,15 +1370,7 @@ void HandleMercsFilesKeyBoardInput( ) //else try to hire the merc else { - //bought gear before - if ( (gMercProfiles[ GetAvailableMercIDFromMERCArray( gubCurMercIndex ) ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) - { - fMercBuyEquipment = 0; - MercProcessHireAfterGear(); - } - //prompt to buy gear - else - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[ MERC_FILES_BUY_GEAR ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + TryToHireMERC(); } } break; From ee2807ae64f6230d35d8555cd5a3b344af1472d9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:31:32 +0300 Subject: [PATCH 097/118] Default to 1st kit if deciding not to buy gear in UB 1st one is included in the hiring fee --- Laptop/mercs Files.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index e95782c1..a32a7a7c 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1840,11 +1840,22 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory) void MercHireButtonGearYesNoCallback (UINT8 bExitValue) { //yes, buy gear - if( bExitValue == MSG_BOX_RETURN_YES ) + if ( bExitValue == MSG_BOX_RETURN_YES ) + { fMercBuyEquipment = 1; + } //no, no gear else + { +#ifdef JA2UB + // Switch to the free, first kit + gSelectedMercKit = 0; + MercWeaponKitSelectionUpdate( gSelectedMercKit ); + fMercBuyEquipment = 1; +#else fMercBuyEquipment = 0; +#endif // JA2UB + } MercProcessHireAfterGear(); } From e2f296c42c4c1d40a63aedff344c28cc72449c65 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 1 May 2025 10:38:39 +0300 Subject: [PATCH 098/118] Remove #pragma optimize("", off) Managed to slip in in commit f21cb38. Bad Asdow, bad! --- TileEngine/lighting.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index b1bcdd67..f7652598 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -1,4 +1,3 @@ -#pragma optimize("", off) #include "builddefines.h" /**************************************************************************************** From 11caa6529cd9652ac71b4e69d508e2accb166500 Mon Sep 17 00:00:00 2001 From: zwwooooo Date: Sun, 11 May 2025 00:33:08 +0800 Subject: [PATCH 099/118] Fix the issue of garbled UTF-8 text in the szTileSetDisplayName field of the StructureMove.xml file in the game's "Drag" menu.(Method provided by @Learner) --- Tactical/SkillMenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tactical/SkillMenu.cpp b/Tactical/SkillMenu.cpp index 3ecd4aec..bb11f167 100644 --- a/Tactical/SkillMenu.cpp +++ b/Tactical/SkillMenu.cpp @@ -909,7 +909,9 @@ DragSelection::Setup( UINT32 aVal ) if ( xmlentry >= 0 ) { - swprintf( pStr, L"%hs (%s)", gStructureMovePossible[xmlentry].szTileSetDisplayName, FaceDirs[gOneCDirection[ubDirection]] ); + WCHAR buf[256]; + MultiByteToWideChar(CP_UTF8, 0, gStructureMovePossible[xmlentry].szTileSetDisplayName, -1, buf, 256); + swprintf(pStr, L"%s (%s)", buf, FaceDirs[gOneCDirection[ubDirection]]); // we have to use an offset of NOBODY in order to differentiate between person and corpse pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction( &Wrapper_Function_DragSelection_GridNo, sTempGridNo ) ); From efb54202ea16841491d13c42f4a056168e147fef Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 15 Jun 2025 10:58:12 +0300 Subject: [PATCH 100/118] Fix Mercprofile usStrategicInsertionData for bigmaps NPCs would not appear in the map if their gridno was over 65535 in large maps --- Ja2/GameVersion.h | 4 ++-- Ja2/SaveLoadGame.cpp | 11 ++++++++++- Tactical/soldier profile type.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Ja2/GameVersion.h b/Ja2/GameVersion.h index b516b225..f85ee016 100644 --- a/Ja2/GameVersion.h +++ b/Ja2/GameVersion.h @@ -22,7 +22,7 @@ extern CHAR16 zBuildInformation[256]; // // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file - +#define MERC_PROFILE_INSERTION_DATA 185 // Bigmap support for AddProfileToMap function #define GROWTH_MODIFIERS 184 #define REBELCOMMAND 183 #define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us @@ -105,7 +105,7 @@ extern CHAR16 zBuildInformation[256]; #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system -#define SAVE_GAME_VERSION GROWTH_MODIFIERS +#define SAVE_GAME_VERSION MERC_PROFILE_INSERTION_DATA //#define RUSSIANGOLD #ifdef __cplusplus diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index a0dd2cb5..4208cb56 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1467,7 +1467,16 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead = ReadFieldByField( hFile, &this->ubLastDateSpokenTo, sizeof(this->ubLastDateSpokenTo), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bLastQuoteSaidWasSpecial, sizeof(this->bLastQuoteSaidWasSpecial), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSectorZ, sizeof(this->bSectorZ), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + + if ( guiCurrentSaveGameVersion >= MERC_PROFILE_INSERTION_DATA ) + { + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof( this->usStrategicInsertionData ), sizeof( UINT32 ), numBytesRead ); + } + else + { + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + } + numBytesRead = ReadFieldByField( hFile, &this->bFriendlyOrDirectDefaultResponseUsedRecently, sizeof(this->bFriendlyOrDirectDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bRecruitDefaultResponseUsedRecently, sizeof(this->bRecruitDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bThreatenDefaultResponseUsedRecently, sizeof(this->bThreatenDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 8d427a5b..222d5401 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -934,7 +934,7 @@ public: UINT8 ubLastDateSpokenTo; UINT8 bLastQuoteSaidWasSpecial; INT8 bSectorZ; - UINT16 usStrategicInsertionData; + UINT32 usStrategicInsertionData; INT8 bFriendlyOrDirectDefaultResponseUsedRecently; INT8 bRecruitDefaultResponseUsedRecently; INT8 bThreatenDefaultResponseUsedRecently; From c02bbc90cbe374441930fd537d3e2f106b84bdc6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 18 Jun 2025 22:57:50 +0300 Subject: [PATCH 101/118] Fix helicopter for UB No need to force an assert error here. We can simply ignore the meanwhile scene just like all the others. --- Strategic/Map Screen Helicopter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index 47fcfd44..8ba308f9 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -1278,8 +1278,7 @@ void LandHelicopter( void ) else { #ifdef JA2UB - Assert( 0 ); -//No meanwhiles + //No meanwhiles in UB #else // play meanwhile scene if it hasn't been used yet HandleKillChopperMeanwhileScene(); From d9391de58a89b9941a8ab19ac660baeb3d898a90 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 22 Jun 2025 12:41:24 +0300 Subject: [PATCH 102/118] Fix laptop crush popup text Due to additional dialogue flag having the value 8, and UB not having a specific flag for mercs standing up after heli crash, the FindSoldierByProfileID would always find Steroid if he was on the team, and then display the crunched laptop popup text. Adding a new flag that is checked before we go into that branch in HandleDialogue fixes the issue. --- Tactical/Dialogue Control.cpp | 4 ++-- Tactical/Dialogue Control.h | 1 + Tactical/Overhead.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 00b32f72..10fa1d9c 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -1345,10 +1345,10 @@ void HandleDialogue( ) { HandleEveryoneDoneTheirEndGameQuotes(); } - else + else if ( QItem.uiSpecialEventData & MULTIPURPOSE_SPECIAL_EVENT_GETUP_AFTER_HELI_CRASH ) { // grab soldier ptr from profile ID - pSoldier = FindSoldierByProfileID( (UINT8)QItem.uiSpecialEventData, FALSE ); + pSoldier = FindSoldierByProfileID( (UINT8)QItem.uiSpecialEventData2, FALSE ); // FindSoldier was returning a lot of nullptrs which would crash the game very quickly after Jerry gets up. This check is here to circumvent that. if (pSoldier != nullptr) diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index f2aca38e..5c422c2e 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -262,6 +262,7 @@ enum DialogQuoteIDs #ifdef JA2UB #define MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING 0x20000000 #define MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA 0x10000000 +#define MULTIPURPOSE_SPECIAL_EVENT_GETUP_AFTER_HELI_CRASH 0x08000000 #else #define MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA 0x00000001 #define MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING 0x00000002 diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ddc86eaa..14cdf1ac 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -1077,7 +1077,7 @@ BOOLEAN ExecuteOverhead( ) pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } - SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, pSoldier->ubProfile, 0, 0, pSoldier->iFaceIndex, 0 ); + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, MULTIPURPOSE_SPECIAL_EVENT_GETUP_AFTER_HELI_CRASH, pSoldier->ubProfile, 0, pSoldier->iFaceIndex, 0 ); } } else From a1bb85ca95fad6137a64a3c5c26ab8162a25f5ea Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 27 Apr 2025 12:24:31 +0300 Subject: [PATCH 103/118] Externalize fan exitgrid location in the source sector --- Ja2/ub_config.cpp | 3 ++- Ja2/ub_config.h | 1 + Strategic/strategicmap.cpp | 3 ++- Tactical/Ja25_Tactical.cpp | 16 ++++++++++------ Tactical/Ja25_Tactical.h | 1 - 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Ja2/ub_config.cpp b/Ja2/ub_config.cpp index edf55ca0..0479cc89 100644 --- a/Ja2/ub_config.cpp +++ b/Ja2/ub_config.cpp @@ -238,7 +238,8 @@ void LoadGameUBOptions() gGameUBOptions.PowergenSectorGridNo3 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_3", 14155); gGameUBOptions.PowergenSectorGridNo4 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_4", 13980); - gGameUBOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749); + gGameUBOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger( "Unfinished Business Settings", "POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749 ); + gGameUBOptions.PowergenSectorExitgridSrcGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_SRC_GRIDNO", 10979 ); gGameUBOptions.PowergenFanSoundGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_1", 10979); gGameUBOptions.PowergenFanSoundGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_2", 19749); gGameUBOptions.StartFanbackupAgainGridNo = iniReader.ReadInteger("Unfinished Business Settings","START_FANBACKUP_AGAIN_GRIDNO", 10980); diff --git a/Ja2/ub_config.h b/Ja2/ub_config.h index dc43d6e7..c8e2780d 100644 --- a/Ja2/ub_config.h +++ b/Ja2/ub_config.h @@ -67,6 +67,7 @@ typedef struct UINT32 PowergenSectorGridNo3; UINT32 PowergenSectorGridNo4; UINT32 PowergenSectorExitgridGridNo; + UINT32 PowergenSectorExitgridSrcGridNo; UINT32 PowergenFanSoundGridNo1; UINT32 PowergenFanSoundGridNo2; UINT32 StartFanbackupAgainGridNo; diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 801bda22..010e944e 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -7778,6 +7778,7 @@ void HandleMovingEnemiesCloseToEntranceInSecondTunnelMap( ) void HandlePowerGenFanSoundModification( ) { + extern UINT32 POWERGENSECTOREXITGRID_SRC_GRIDNO; SetTileAnimCounter( TILE_ANIM__FAST_SPEED ); switch ( gJa25SaveStruct.ubStateOfFanInPowerGenSector ) @@ -7786,7 +7787,7 @@ void HandlePowerGenFanSoundModification( ) HandleAddingPowerGenFanSound( ); //MAKE SURE the fan does not have an exit grid - RemoveExitGridFromWorld( PGF__FAN_EXIT_GRID_GRIDNO ); + RemoveExitGridFromWorld( POWERGENSECTOREXITGRID_SRC_GRIDNO ); break; case PGF__STOPPED: diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 4893ce49..0767119d 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -293,7 +293,8 @@ UINT32 POWERGENSECTOR_GRIDNO1 = 15100; UINT32 POWERGENSECTOR_GRIDNO2 = 12220; UINT32 POWERGENSECTOR_GRIDNO3 = 14155; UINT32 POWERGENSECTOR_GRIDNO4 = 13980; -UINT32 POWERGENSECTOREXITGRID_GRIDNO1 = 19749; +UINT32 POWERGENSECTOREXITGRID_SRC_GRIDNO = 10979; +UINT32 POWERGENSECTOREXITGRID_DST_GRIDNO = 19749; UINT32 POWERGENFANSOUND_GRIDNO1 = 10979; UINT32 POWERGENFANSOUND_GRIDNO2 = 19749; UINT32 STARTFANBACKUPAGAIN_GRIDNO = 10980; @@ -310,11 +311,13 @@ UINT32 SECTOR_FAN_Y = 0; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_X = 14; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_Y = 11; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_Z = 1; -//J14-1 +// Destination sector for fan exitgrid +//J14-1 UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X = 14; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y = 10; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z = 1; + void InitGridNoUB() { SWITCHINMORRISAREA_GRIDNO = gGameUBOptions.SwitchInMorrisAreaGridNo; //= 15231; @@ -326,7 +329,8 @@ void InitGridNoUB() POWERGENSECTOR_GRIDNO2 = gGameUBOptions.PowergenSectorGridNo2; //= 12220; POWERGENSECTOR_GRIDNO3 = gGameUBOptions.PowergenSectorGridNo3; //= 14155; POWERGENSECTOR_GRIDNO4 = gGameUBOptions.PowergenSectorGridNo4; //= 13980; - POWERGENSECTOREXITGRID_GRIDNO1 = gGameUBOptions.PowergenSectorExitgridGridNo; // = 19749; + POWERGENSECTOREXITGRID_SRC_GRIDNO = gGameUBOptions.PowergenSectorExitgridSrcGridNo; //= 10979; // Exitgrid location in the sector it is created in + POWERGENSECTOREXITGRID_DST_GRIDNO = gGameUBOptions.PowergenSectorExitgridGridNo; // = 19749; // Exitgrid location in the destination sector POWERGENFANSOUND_GRIDNO1 = gGameUBOptions.PowergenFanSoundGridNo1; //= 10979; POWERGENFANSOUND_GRIDNO2 = gGameUBOptions.PowergenFanSoundGridNo2; //= 19749; STARTFANBACKUPAGAIN_GRIDNO = gGameUBOptions.StartFanbackupAgainGridNo; //= 10980; @@ -821,7 +825,7 @@ void StartFanBackUpAgain() gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; //Remove the exit grid - RemoveExitGridFromWorld( PGF__FAN_EXIT_GRID_GRIDNO ); + RemoveExitGridFromWorld( POWERGENSECTOREXITGRID_SRC_GRIDNO ); // FOR THE NEXT RENDER LOOP, RE-EVALUATE REDUNDENT TILES SetRenderFlags(RENDER_FLAG_FULL); @@ -942,10 +946,10 @@ void AddExitGridForFanToPowerGenSector() ExitGrid.ubGotoSectorX = EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X; //14; ExitGrid.ubGotoSectorY = EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y; //MAP_ROW_J; ExitGrid.ubGotoSectorZ = EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z; //1; - ExitGrid.usGridNo = POWERGENSECTOREXITGRID_GRIDNO1; + ExitGrid.usGridNo = POWERGENSECTOREXITGRID_DST_GRIDNO; //Add the exit grid when the fan is either stopped or blown up - AddExitGridToWorld( PGF__FAN_EXIT_GRID_GRIDNO, &ExitGrid ); + AddExitGridToWorld( POWERGENSECTOREXITGRID_SRC_GRIDNO, &ExitGrid ); } BOOLEAN HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( SOLDIERTYPE *pSoldierAtDoor, BOOLEAN fSayQuoteOnlyOnce ) diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 2c5f2156..155e6e37 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -5,7 +5,6 @@ #include "MapScreen Quotes.h" -#define PGF__FAN_EXIT_GRID_GRIDNO 10979 #define NUM_MERCS_WITH_NEW_QUOTES 20//7 From d95bae2bf6fcca2bf50395178d8b259bc5d1d024 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:13:10 +0300 Subject: [PATCH 104/118] Re-enable power generator fan sound effect for UB --- Tactical/Ja25_Tactical.cpp | 2 +- Tactical/Soldier Control.cpp | 2 +- Utils/Sound Control.cpp | 33 +++++++++++++++++++++------------ Utils/Sound Control.h | 6 ++++-- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 0767119d..2a4fc5b3 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -918,7 +918,7 @@ void HandleAddingPowerGenFanSound() sGridNo = POWERGENFANSOUND_GRIDNO2; //Create the new ambient fan sound - //gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND ); + gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND, 30 ); SetPositionSndsInActive( ); SetPositionSndsActive( ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index b80c9585..f9bdabce 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2445,7 +2445,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, if ( this->ubBodyType == QUEENMONSTER ) { - this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE ); + this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE, 15 ); } diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 2598dc28..af8946bf 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -774,6 +774,7 @@ typedef struct UINT32 uiData; BOOLEAN fAllocated; BOOLEAN fInActive; + UINT8 volume; } POSITIONSND; @@ -820,7 +821,7 @@ void RecountPositionSnds( void ) } -INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ) +INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay, UINT8 volume ) { POSITIONSND *pPositionSnd; INT32 iPositionSndIndex; @@ -849,6 +850,7 @@ INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun pPositionSnd->uiFlags = uiFlags; pPositionSnd->fAllocated = TRUE; pPositionSnd->iSoundToPlay = iSoundToPlay; + pPositionSnd->volume = volume; pPositionSnd->iSoundSampleID = NO_SAMPLE; @@ -892,7 +894,7 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ) } } -void SetPositionSndsActive( ) +void SetPositionSndsActive() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -901,20 +903,27 @@ void SetPositionSndsActive( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - if ( pPositionSnd->fInActive ) + if ( pPositionSnd->fAllocated ) { - pPositionSnd->fInActive = FALSE; + if ( pPositionSnd->fInActive ) + { + pPositionSnd->fInActive = FALSE; - // Begin sound effect - // Volume 0 - pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + // Begin sound effect + // Volume 0 + if ( pPositionSnd->iSoundToPlay == POWER_GEN_FAN_SOUND ) + { + pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN); + } + else + { + pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + } + } } } - } } @@ -1068,7 +1077,7 @@ void SetPositionSndsVolumeAndPanning( ) { if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) { - bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo ); + bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) { diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 656be5ce..e351c783 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -379,7 +379,9 @@ enum SoundDefines S_VAL, //BREAK_LIGHT_IGNITING, - NUM_SAMPLES + NUM_SAMPLES, + POWER_GEN_FAN_SOUND = 5001 // This is a workaround to get the generator fan positional sound working in UB campaign. + // Had to special case it because sound effects have been externalized. }; enum AmbientDefines @@ -453,7 +455,7 @@ void PlayDelayedJA2Sample( UINT32 uiDelay, UINT32 usNum, UINT32 usRate, UINT32 u #define POSITION_SOUND_FROM_SOLDIER 0x00000001 #define POSITION_SOUND_STATIONATY_OBJECT 0x00000002 -INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ); +INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay, UINT8 volume ); void DeletePositionSnd( INT32 iPositionSndIndex ); void SetPositionSndsActive( ); void SetPositionSndsInActive( ); From 9a78e7dfa0cbcee2424f33d19aa2f93eb14ce184 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:30:14 +0300 Subject: [PATCH 105/118] Formatting changes --- Utils/Sound Control.cpp | 222 ++++++++++++++++++++-------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index af8946bf..3c8472f8 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -768,9 +768,9 @@ void DelayedSoundTimerCallback( void ) typedef struct { UINT32 uiFlags; - INT32 sGridNo; - INT32 iSoundSampleID; - INT32 iSoundToPlay; + INT32 sGridNo; + INT32 iSoundSampleID; + INT32 iSoundToPlay; UINT32 uiData; BOOLEAN fAllocated; BOOLEAN fInActive; @@ -794,27 +794,27 @@ INT32 GetFreePositionSnd( void ) { UINT32 uiCount; - for(uiCount=0; uiCount < guiNumPositionSnds; uiCount++) + for ( uiCount = 0; uiCount < guiNumPositionSnds; uiCount++ ) { - if(( gPositionSndData[uiCount].fAllocated==FALSE ) ) - return( (INT32)uiCount ); + if ( (gPositionSndData[uiCount].fAllocated == FALSE) ) + return((INT32)uiCount); } - if( guiNumPositionSnds < NUM_POSITION_SOUND_EFFECT_SLOTS ) - return( (INT32) guiNumPositionSnds++ ); + if ( guiNumPositionSnds < NUM_POSITION_SOUND_EFFECT_SLOTS ) + return((INT32)guiNumPositionSnds++); - return( -1 ); + return(-1); } void RecountPositionSnds( void ) { INT32 uiCount; - for(uiCount=guiNumPositionSnds-1; (uiCount >=0) ; uiCount--) + for ( uiCount = guiNumPositionSnds - 1; (uiCount >= 0); uiCount-- ) { - if( ( gPositionSndData[uiCount].fAllocated ) ) + if ( (gPositionSndData[uiCount].fAllocated) ) { - guiNumPositionSnds=(UINT32)(uiCount+1); + guiNumPositionSnds = (UINT32)(uiCount + 1); break; } } @@ -826,57 +826,57 @@ INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun POSITIONSND *pPositionSnd; INT32 iPositionSndIndex; - if( ( iPositionSndIndex = GetFreePositionSnd() )==(-1) ) + if ( (iPositionSndIndex = GetFreePositionSnd()) == (-1) ) return(-1); - memset( &gPositionSndData[ iPositionSndIndex ], 0, sizeof( POSITIONSND ) ); + memset( &gPositionSndData[iPositionSndIndex], 0, sizeof( POSITIONSND ) ); - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[iPositionSndIndex]; // Default to inactive if ( gfPositionSoundsActive ) { - pPositionSnd->fInActive = FALSE; + pPositionSnd->fInActive = FALSE; } else { - pPositionSnd->fInActive = TRUE; + pPositionSnd->fInActive = TRUE; } - pPositionSnd->sGridNo = sGridNo; - pPositionSnd->uiData = uiData; - pPositionSnd->uiFlags = uiFlags; - pPositionSnd->fAllocated = TRUE; + pPositionSnd->sGridNo = sGridNo; + pPositionSnd->uiData = uiData; + pPositionSnd->uiFlags = uiFlags; + pPositionSnd->fAllocated = TRUE; pPositionSnd->iSoundToPlay = iSoundToPlay; pPositionSnd->volume = volume; pPositionSnd->iSoundSampleID = NO_SAMPLE; - return( iPositionSndIndex ); + return(iPositionSndIndex); } void DeletePositionSnd( INT32 iPositionSndIndex ) { POSITIONSND *pPositionSnd; - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[iPositionSndIndex]; if ( pPositionSnd->fAllocated ) { - // Turn inactive first... - pPositionSnd->fInActive = TRUE; + // Turn inactive first... + pPositionSnd->fInActive = TRUE; - // End sound... - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - SoundStop( pPositionSnd->iSoundSampleID ); - } + // End sound... + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + SoundStop( pPositionSnd->iSoundSampleID ); + } - pPositionSnd->fAllocated = FALSE; + pPositionSnd->fAllocated = FALSE; - RecountPositionSnds( ); + RecountPositionSnds(); } } @@ -884,13 +884,13 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ) { POSITIONSND *pPositionSnd; - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[iPositionSndIndex]; if ( pPositionSnd->fAllocated ) { - pPositionSnd->sGridNo = sGridNo; + pPositionSnd->sGridNo = sGridNo; - SetPositionSndsVolumeAndPanning( ); + SetPositionSndsVolumeAndPanning(); } } @@ -915,7 +915,7 @@ void SetPositionSndsActive() // Volume 0 if ( pPositionSnd->iSoundToPlay == POWER_GEN_FAN_SOUND ) { - pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN); + pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN ); } else { @@ -927,7 +927,7 @@ void SetPositionSndsActive() } -void SetPositionSndsInActive( ) +void SetPositionSndsInActive() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -936,20 +936,20 @@ void SetPositionSndsInActive( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - pPositionSnd->fInActive = TRUE; - - // End sound... - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + if ( pPositionSnd->fAllocated ) { - SoundStop( pPositionSnd->iSoundSampleID ); - pPositionSnd->iSoundSampleID = NO_SAMPLE; + pPositionSnd->fInActive = TRUE; + + // End sound... + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + SoundStop( pPositionSnd->iSoundSampleID ); + pPositionSnd->iSoundSampleID = NO_SAMPLE; + } } } - } } // == Lesh slightly changed this function ============ @@ -959,51 +959,51 @@ UINT8 PositionSoundDir( INT32 sGridNo ) INT16 sScreenX, sScreenY; INT16 sMiddleX; INT16 sDif, sAbsDif; - - if (TileIsOutOfBounds(sGridNo)) + + if ( TileIsOutOfBounds( sGridNo ) ) { - return( MIDDLEPAN ); + return(MIDDLEPAN); } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); // Get screen coordinates for current position of soldier - GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY); + GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY ); // Get middle of where we are now.... - sMiddleX = gsTopLeftWorldX + ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2; + sMiddleX = gsTopLeftWorldX + (gsBottomRightWorldX - gsTopLeftWorldX) / 2; sDif = sMiddleX - sScreenX; - if ( ( sAbsDif = abs( sDif ) ) > 64 ) + if ( (sAbsDif = abs( sDif )) > 64 ) { // OK, NOT the middle. // Is it outside the screen? - if ( sAbsDif > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) ) - { + if ( sAbsDif > ((gsBottomRightWorldX - gsTopLeftWorldX) / 2) ) + { // yes, outside... if ( sDif > 0 ) { - return( FARLEFT ); + return(FARLEFT); //return( 1 ); } - else - return( FARRIGHT ); - //return( 126 ); + else + return(FARRIGHT); + //return( 126 ); - } + } else // inside screen { - if ( sDif > 0) - return( LEFTSIDE ); + if ( sDif > 0 ) + return(LEFTSIDE); else - return( RIGHTSIDE ); + return(RIGHTSIDE); } } else // hardly any difference, so sound should be played from middle - return(MIDDLE); + return(MIDDLE); } @@ -1016,21 +1016,21 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT32 sGridNo ) INT16 sDifY, sAbsDifY; INT16 sMaxDistX, sMaxDistY; double sMaxSoundDist, sSoundDist; - - if (TileIsOutOfBounds(sGridNo)) + + if ( TileIsOutOfBounds( sGridNo ) ) { - return( bInitialVolume ); + return(bInitialVolume); } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); // Get screen coordinates for current position of soldier - GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY); + GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY ); // Get middle of where we are now.... - sMiddleX = gsTopLeftWorldX + ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2; - sMiddleY = gsTopLeftWorldY + ( gsBottomRightWorldY - gsTopLeftWorldY ) / 2; + sMiddleX = gsTopLeftWorldX + (gsBottomRightWorldX - gsTopLeftWorldX) / 2; + sMiddleY = gsTopLeftWorldY + (gsBottomRightWorldY - gsTopLeftWorldY) / 2; sDifX = sMiddleX - sScreenX; sDifY = sMiddleY - sScreenY; @@ -1038,28 +1038,28 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT32 sGridNo ) sAbsDifX = abs( sDifX ); sAbsDifY = abs( sDifY ); - sMaxDistX = (INT16)( ( gsBottomRightWorldX - gsTopLeftWorldX ) * 1.5 ); - sMaxDistY = (INT16)( ( gsBottomRightWorldY - gsTopLeftWorldY ) * 1.5 ); + sMaxDistX = (INT16)((gsBottomRightWorldX - gsTopLeftWorldX) * 1.5); + sMaxDistY = (INT16)((gsBottomRightWorldY - gsTopLeftWorldY) * 1.5); - sMaxSoundDist = sqrt( (double) ( sMaxDistX * sMaxDistX ) + ( sMaxDistY * sMaxDistY ) ); - sSoundDist = sqrt( (double)( sAbsDifX * sAbsDifX ) + ( sAbsDifY * sAbsDifY ) ); + sMaxSoundDist = sqrt( (double)(sMaxDistX * sMaxDistX) + (sMaxDistY * sMaxDistY) ); + sSoundDist = sqrt( (double)(sAbsDifX * sAbsDifX) + (sAbsDifY * sAbsDifY) ); if ( sSoundDist == 0 ) { - return( bInitialVolume ); + return(bInitialVolume); } if ( sSoundDist > sMaxSoundDist ) { - sSoundDist = sMaxSoundDist; + sSoundDist = sMaxSoundDist; } // Scale - return( (INT8)( bInitialVolume * ( ( sMaxSoundDist - sSoundDist ) / sMaxSoundDist ) ) ); + return((INT8)(bInitialVolume * ((sMaxSoundDist - sSoundDist) / sMaxSoundDist))); } -void SetPositionSndsVolumeAndPanning( ) +void SetPositionSndsVolumeAndPanning() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -1069,49 +1069,49 @@ void SetPositionSndsVolumeAndPanning( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - if ( !pPositionSnd->fInActive ) + if ( pPositionSnd->fAllocated ) { - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); - - if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) + if ( !pPositionSnd->fInActive ) { - pSoldier = (SOLDIERTYPE*)pPositionSnd->uiData; - - if ( pSoldier->bVisible == -1 ) + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) { - // Limit volume,,, - if ( bVolume > 10 ) + bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); + + if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) { - bVolume = 10; + pSoldier = (SOLDIERTYPE *)pPositionSnd->uiData; + + if ( pSoldier->bVisible == -1 ) + { + // Limit volume,,, + if ( bVolume > 10 ) + { + bVolume = 10; + } + } } + + //if the sound is from a stationary object + if ( pPositionSnd->uiFlags & POSITION_SOUND_STATIONATY_OBJECT ) + { + // make sure you can always hear it + if ( bVolume < 5 ) + { + bVolume = 5; + } + } + + SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume ); + + ubPan = PositionSoundDir( pPositionSnd->sGridNo ); + + SoundSetPan( pPositionSnd->iSoundSampleID, ubPan ); } } - - //if the sound is from a stationay object - if( pPositionSnd->uiFlags & POSITION_SOUND_STATIONATY_OBJECT ) - { - // make sure you can always hear it - if ( bVolume < 5 ) - { - bVolume = 5; - } - } - - SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume ); - - ubPan = PositionSoundDir( pPositionSnd->sGridNo ); - - SoundSetPan( pPositionSnd->iSoundSampleID, ubPan ); - } } } - } } From 2ae110971bf5132bce2fc49f9dc1177256f6d6cb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:31:42 +0300 Subject: [PATCH 106/118] spelling fixes --- Tactical/Ja25_Tactical.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 2a4fc5b3..38313a09 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -650,7 +650,7 @@ void HandleWhenCertainPercentageOfEnemiesDie() UINT32 uiPercentEnemiesKilled; UINT8 ubSectorID; - //if there isnt enemies in the sector + //if there isn't enemies in the sector if( ( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) == 0 ) { //get out @@ -667,7 +667,7 @@ void HandleWhenCertainPercentageOfEnemiesDie() switch( ubSectorID ) { case SEC_K15: - //all enemies are dead and if the quote hasnt been said yet + //all enemies are dead and if the quote hasn't been said yet if( uiPercentEnemiesKilled >= 100 && !( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX ) ) { INT16 bProfile = RandomProfileIdFromNewMercsOnPlayerTeam(); @@ -707,7 +707,7 @@ void StopPowerGenFan() return; } - //Remeber how the player got through + //Remember how the player got through SetJa25GeneralFlag( JA_GF__POWER_GEN_FAN_HAS_BEEN_STOPPED ); gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__STOPPED; @@ -725,7 +725,7 @@ void StopPowerGenFan() //Turn off the power gen fan sound HandleRemovingPowerGenFanSound(); - //remeber which turn the fan stopped on + //remember which turn the fan stopped on gJa25SaveStruct.uiTurnPowerGenFanWentDown = gJa25SaveStruct.uiTacticalTurnCounter; @@ -733,7 +733,7 @@ void StopPowerGenFan() // Replace the Fan graphic // - // Turn on permenant changes.... + // Turn on permanent changes.... ApplyMapChangesToMapTempFile( TRUE ); //Add the exit grid to the power gen fan @@ -788,7 +788,7 @@ void StartFanBackUpAgain() return; } - //Remeber how the player got through + //Remember how the player got through gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__RUNNING_NORMALLY; @@ -800,7 +800,7 @@ void StartFanBackUpAgain() // Replace the Fan graphic // - // Turn on permenant changes.... + // Turn on permanent changes.... ApplyMapChangesToMapTempFile( TRUE ); // Remove it! From 4d948fda069dbb59fbc27d05d7edff1792f0d720 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 22:50:40 +0300 Subject: [PATCH 107/118] Fix powergen fan stopping in UB Sector Y & Z coordinates were mixed up in code, which would then always fail the check for correct sector. --- Tactical/Ja25_Tactical.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 38313a09..f147dc0d 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -305,8 +305,8 @@ UINT32 SECTOR_LAUNCH_MISSLES_Y = 12; UINT32 SECTOR_LAUNCH_MISSLES_Z = 3; //J13-0 UINT32 SECTOR_FAN_X = 13; -UINT32 SECTOR_FAN_Z = 10; -UINT32 SECTOR_FAN_Y = 0; +UINT32 SECTOR_FAN_Y = 10; +UINT32 SECTOR_FAN_Z = 0; //K14-1 UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_X = 14; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_Y = 11; @@ -342,8 +342,8 @@ void InitGridNoUB() SECTOR_LAUNCH_MISSLES_Z = gGameUBOptions.SectorLaunchMisslesZ; //3; //J13-0 SECTOR_FAN_X = gGameUBOptions.SectorFanX; //13; - SECTOR_FAN_Z = gGameUBOptions.SectorFanY; //10; - SECTOR_FAN_Y = gGameUBOptions.SectorFanZ; //0; + SECTOR_FAN_Y = gGameUBOptions.SectorFanY; //10; + SECTOR_FAN_Z = gGameUBOptions.SectorFanZ; //0; //K14-1 SECTOR_OPEN_GATE_IN_TUNNEL_X = gGameUBOptions.SectorOpenGateInTunnelX; //14; SECTOR_OPEN_GATE_IN_TUNNEL_Y = gGameUBOptions.SectorOpenGateInTunnelY; //11; From 5e2c61ef123809b253666e01221e80767c847a34 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Jun 2025 22:49:29 +0300 Subject: [PATCH 108/118] Externalized UB bloodcat quest sector --- Ja2/ub_config.cpp | 5 +++++ Ja2/ub_config.h | 5 ++++- Strategic/Queen Command.cpp | 2 +- Tactical/Ja25_Tactical.cpp | 10 +++++++++- Tactical/Ja25_Tactical.h | 4 ++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Ja2/ub_config.cpp b/Ja2/ub_config.cpp index 0479cc89..908f7584 100644 --- a/Ja2/ub_config.cpp +++ b/Ja2/ub_config.cpp @@ -357,6 +357,11 @@ void LoadGameUBOptions() gGameUBOptions.H10SectorPlayerQuoteZ = iniReader.ReadInteger("Unfinished Business Settings","H10_SECTOR_PLAYER_QUOTE_Z", 0); + gGameUBOptions.BettyBloodCatSectorX = iniReader.ReadInteger( "Unfinished Business Settings", "BETTY_BLOODCAT_SECTOR_X", 10 ); + gGameUBOptions.BettyBloodCatSectorY = iniReader.ReadInteger( "Unfinished Business Settings", "BETTY_BLOODCAT_SECTOR_Y", 9 ); + gGameUBOptions.BettyBloodCatSectorZ = iniReader.ReadInteger( "Unfinished Business Settings", "BETTY_BLOODCAT_SECTOR_Z", 0 ); + + if ( gGameUBOptions.InGameHeli == TRUE ) gGameUBOptions.InGameHeliCrash = FALSE; diff --git a/Ja2/ub_config.h b/Ja2/ub_config.h index c8e2780d..d5c98aea 100644 --- a/Ja2/ub_config.h +++ b/Ja2/ub_config.h @@ -220,7 +220,10 @@ typedef struct UINT32 SectorDoorInTunnelGridNo; UINT8 MaxNumberOfMercs; - + + INT16 BettyBloodCatSectorX; + INT16 BettyBloodCatSectorY; + INT8 BettyBloodCatSectorZ; } GAME_UB_OPTIONS; extern GAME_UB_OPTIONS gGameUBOptions; diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 074ef6c3..b5ff2ce4 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -3171,7 +3171,7 @@ BOOLEAN CheckPendingNonPlayerTeam( UINT8 usTeam ) void HandleBloodCatDeaths( SECTORINFO *pSector ) { //if the current sector is the first part of the town - if( gWorldSectorX == 10 && gWorldSectorY == 9 && gbWorldSectorZ == 0 ) + if( gWorldSectorX == BETTY_BLOODCAT_SECTOR_X && gWorldSectorY == BETTY_BLOODCAT_SECTOR_Y && gbWorldSectorZ == BETTY_BLOODCAT_SECTOR_Z ) { //if ALL the bloodcats are killed if( pSector->bBloodCats == 0 ) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index f147dc0d..28ee41e2 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -317,6 +317,9 @@ UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X = 14; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y = 10; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z = 1; +INT16 BETTY_BLOODCAT_SECTOR_X = 10; +INT16 BETTY_BLOODCAT_SECTOR_Y = 9; +INT8 BETTY_BLOODCAT_SECTOR_Z = 0; void InitGridNoUB() { @@ -352,7 +355,12 @@ void InitGridNoUB() EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X = gGameUBOptions.ExitForFanToPowerGenSectorX; //14; EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y = gGameUBOptions.ExitForFanToPowerGenSectorY; //10; EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z = gGameUBOptions.ExitForFanToPowerGenSectorZ; //1; - + + BETTY_BLOODCAT_SECTOR_X = gGameUBOptions.BettyBloodCatSectorX; + BETTY_BLOODCAT_SECTOR_Y = gGameUBOptions.BettyBloodCatSectorY; + BETTY_BLOODCAT_SECTOR_Z = gGameUBOptions.BettyBloodCatSectorZ; + + MANUEL_UB = gGameUBOptions.ubMANUEL_UB; BIGGENS_UB = gGameUBOptions.ubBIGGENS_UB; JOHN_K_UB = gGameUBOptions.ubJOHN_K_UB; diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 155e6e37..9e1205f6 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -143,6 +143,10 @@ extern UINT8 RAUL_UB; extern UINT8 MORRIS_UB; extern UINT8 RUDY_UB; +extern INT16 BETTY_BLOODCAT_SECTOR_X; +extern INT16 BETTY_BLOODCAT_SECTOR_Y; +extern INT8 BETTY_BLOODCAT_SECTOR_Z; + extern void Old_UB_Inventory (); extern void New_UB_Inventory (); From 09ce3327215df22be1e086406d860830558a8b39 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 27 Jun 2025 15:59:45 +0300 Subject: [PATCH 109/118] Allow 10 size squads for 720p resolution in UB --- Ja2/GameInitOptionsScreen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ja2/GameInitOptionsScreen.cpp b/Ja2/GameInitOptionsScreen.cpp index fcad1e9d..b2eb2216 100644 --- a/Ja2/GameInitOptionsScreen.cpp +++ b/Ja2/GameInitOptionsScreen.cpp @@ -1830,7 +1830,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; - if (iResolution >= _800x600 && iResolution < _1024x768) + if (iResolution >= _800x600 && iResolution < _1280x720) maxSquadSize = GIO_SQUAD_SIZE_8; if ( iCurrentSquadSize < maxSquadSize ) @@ -1850,7 +1850,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) btn->uiFlags|=(BUTTON_CLICKED_ON); UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; - if (iResolution >= _800x600 && iResolution < _1024x768) + if (iResolution >= _800x600 && iResolution < _1280x720 ) maxSquadSize = GIO_SQUAD_SIZE_8; if ( iCurrentSquadSize < maxSquadSize ) From 49a56d01ac6de314de0fdaffdee44143399fd768 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 8 Jul 2025 20:21:17 +0300 Subject: [PATCH 110/118] Load correct militia icons for 720p resolution --- Strategic/Map Screen Interface Map.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 73af166a..dc705df5 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -5283,12 +5283,12 @@ BOOLEAN LoadMilitiaPopUpBox( void ) // load the militia pop up box VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\Militia.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) + if ( isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\Militia_1024x768.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) FilenameForBPP("INTERFACE\\Militia_800x600.sti", VObjectDesc.ImageFile); else - FilenameForBPP("INTERFACE\\Militia_1024x768.sti", VObjectDesc.ImageFile); + FilenameForBPP("INTERFACE\\Militia.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMilitia)); From 7bb7c543172533b5046eb8376a7f256ee00520dc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 21 Jul 2025 03:30:22 +0300 Subject: [PATCH 111/118] Guard against integer underflow (#462) --- Strategic/Strategic AI.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index 378a3584..8a3ca8a1 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -7151,15 +7151,16 @@ void InitializeGroup( const GROUP_TYPE groupType, const UINT8 groupSize, UINT8 & tankCount++; } - if ( gGameExternalOptions.fASDAssignsJeeps && ASDSoldierUpgradeToJeep( ) ) + if ( troopCount > 0 && gGameExternalOptions.fASDAssignsJeeps && ASDSoldierUpgradeToJeep( ) ) { troopCount--; jeepCount++; } - if ( gGameExternalOptions.fASDAssignsRobots && ASDSoldierUpgradeToRobot() ) + if ( troopCount > 0 && gGameExternalOptions.fASDAssignsRobots && ASDSoldierUpgradeToRobot() ) { - const int numRobots = 1 + Random(difficultyMod); + // Limit amount of robots, if randomized difficulty bonus would cause us to go over the troopCount amount + const int numRobots = min( (1 + Random(difficultyMod)), troopCount); troopCount -= numRobots; robotCount += numRobots; } From 872a356e8283f1e8fd01f66b6b8093c652da5281 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 23 Jul 2025 14:36:15 +0300 Subject: [PATCH 112/118] Correct column size check --- TileEngine/worlddef.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 628a35e3..a1fc4b44 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2929,7 +2929,7 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor SetWorldSize(iRowSize, iColSize); // We still have the "normal" map size AND the map is saved in vanilla format - if ((iRowSize <= OLD_WORLD_ROWS && iRowSize <= OLD_WORLD_COLS) && (dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION)) + if ((iRowSize <= OLD_WORLD_ROWS && iColSize <= OLD_WORLD_COLS) && (dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION)) { // Check "vanilla map saving" gfVanillaMode = TRUE;//dnl ch74 191013 From 8644e5f8b9543105e2067c49daac5f8f7ed9d1a5 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Fri, 25 Jul 2025 10:24:55 +0200 Subject: [PATCH 113/118] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9eeb84e4..6a605397 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -200,6 +200,7 @@ jobs: git push --delete origin refs/tags/latest || true git tag latest git push --force origin refs/tags/latest + sleep 15 # make sure github can find the tag for gh release gh release create latest ../dist/* \ --generate-notes \ --title "Latest (unstable)" \ From eb3f62c3d529d3e74d8d4a5537f48b3953c33eb1 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Fri, 1 Aug 2025 20:52:22 +0200 Subject: [PATCH 114/118] Reverting Commit 9122d7a it made: CAN_FAN_THE_HAMMER = FALSE now disables the burst mode on pistols which effectivly resulted in pistols burst mode only being avaialbale with can fan the hammer active which further resulted in being required to fire from hip mode when using burst with pistols that's not a desired behaviour for burst on pistols, their burst should not depend on fan the hammer therefore reverted --- Tactical/Weapons.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 9649faa0..77e7e0a3 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -9957,10 +9957,6 @@ BOOLEAN IsGunBurstCapable(OBJECTTYPE* pObject, BOOLEAN fNotify, SOLDIERTYPE* pSo fCapable = TRUE; } } - else if (Weapon[pObject->usItem].fBurstOnlyByFanTheHammer) - { - fCapable = FALSE; - } } } } From 4ae331c19eb1146204c80ceb4e6d1d3e90e60792 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Sun, 3 Aug 2025 08:12:48 +0200 Subject: [PATCH 115/118] IniOption Food items can show without using Food - food items are usualy not shown in game without using Food - option ALWAYS_FOOD allows them to be shown even without - default is false, no food items without Food --- Ja2/GameSettings.cpp | 1 + Ja2/GameSettings.h | 1 + Tactical/Items.cpp | 23 +++++++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index c437d542..cd796702 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -1998,6 +1998,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fFoodDecayInSectors = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_DECAY_IN_SECTORS", TRUE); gGameExternalOptions.sFoodDecayModificator = iniReader.ReadFloat("Tactical Food Settings", "FOOD_DECAY_MODIFICATOR", 1.0f, 0.1f, 10.0f); gGameExternalOptions.fFoodEatingSounds = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_EATING_SOUNDS", TRUE); + gGameExternalOptions.fAlwaysFood = iniReader.ReadBoolean("Tactical Food Settings", "ALWAYS_FOOD", FALSE); //################# Disease Settings ################## gGameExternalOptions.fDisease = iniReader.ReadBoolean( "Disease Settings", "DISEASE", FALSE ); diff --git a/Ja2/GameSettings.h b/Ja2/GameSettings.h index 1aeb3404..6148086c 100644 --- a/Ja2/GameSettings.h +++ b/Ja2/GameSettings.h @@ -506,6 +506,7 @@ typedef struct FLOAT sFoodDecayModificator; BOOLEAN fFoodEatingSounds; + BOOLEAN fAlwaysFood; // Flugente: disease settings BOOLEAN fDisease; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index c1fe83a0..61f51e32 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1271,14 +1271,21 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; - // silversurfer: no food items if the food system is off - if (!UsingFoodSystem() && Item[usItemIndex].foodtype > 0) - { - // silversurfer: Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. - // kitty: and only if food isn't a drug at the same time, to make sure using those drugs without food system is possible - if (Food[Item[usItemIndex].foodtype].bFoodPoints > 0 && Item[usItemIndex].drugtype == 0 ) - return FALSE; - } + // kitty: players might want food items in game for roleplay reasons, i.e. when interacting with npc-dealer in restaurant, no food might seems odd + // with the option "ALWAYS_FOOD" set TRUE, food items will show even without using the foodsystem + // should it be set to FALSE, no food items will be shown without using the foodsystem + if (!gGameExternalOptions.fAlwaysFood) + { + // silversurfer: no food items if the food system is off + if (!UsingFoodSystem() && Item[usItemIndex].foodtype > 0 ) + { + // silversurfer: Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. + // kitty: and only if food isn't a drug at the same time, to make sure using those drugs without food system is possible + if (Food[Item[usItemIndex].foodtype].bFoodPoints > 0 && Item[usItemIndex].drugtype == 0 ) + + return FALSE; + } + } // kitty: no disease items if the disease system is off // whether the item is exclusive is defined by tag From 1074e9c408e2ad1414d51512c65065965dd939de Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:33:41 +0300 Subject: [PATCH 116/118] Fix save game compability for MERCPROFILESTRUCT --- Ja2/SaveLoadGame.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 4208cb56..71c4d713 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1474,7 +1474,8 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for } else { - numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(UINT16), sizeof(UINT16), numBytesRead); + buffer += 4; // To make numBytesRead check match the struct size. 2 bytes from uint32 - uint16 and 2 bytes due to struct memory layout change when usStrategicInsertionData was increased to uint32 } numBytesRead = ReadFieldByField( hFile, &this->bFriendlyOrDirectDefaultResponseUsedRecently, sizeof(this->bFriendlyOrDirectDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); From c3a34a660daf8bdaec1b594654022801c291d709 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:01:40 +0300 Subject: [PATCH 117/118] Check squads are on the same level --- Strategic/Strategic Movement.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index b1e0b6be..4afc1b94 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -2644,6 +2644,7 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) { if ( pGroup != pFirstGroup && (pGroup->usGroupTeam == OUR_TEAM || pGroup->usGroupTeam == MILITIA_TEAM) && pGroup->fBetweenSectors && pGroup->ubNextX == pFirstGroup->ubSectorX && pGroup->ubNextY == pFirstGroup->ubSectorY && + pFirstGroup->ubSectorZ == pGroup->ubSectorZ && !(pGroup->uiFlags & GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) && !IsGroupTheHelicopterGroup( pGroup ) ) { From 6a9df9f22cbec3da2ab481cf42388b0027aded84 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:30:09 +0200 Subject: [PATCH 118/118] Fixes to npc-actions Pacos --- Tactical/Interface Dialogue.cpp | 5 +++-- Tactical/Overhead.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index d805af37..d9cc75fd 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -2353,7 +2353,8 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_HAVE_PACOS_FOLLOW: pSoldier = FindSoldierByProfileID( 114, FALSE ); - sGridNo = 18193; //dnl!!! + sGridNo = 8537; //dnl!!! + //kitty: changed gridno from 18193 to 8537, that's at entrance door to rebel basement, where Fatima and Dimitri dialogue happens if (pSoldier) { if (NewOKDestination( pSoldier, sGridNo, TRUE, 0 ) ) @@ -4331,7 +4332,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_PUT_PACOS_IN_BASEMENT: gMercProfiles[ PACOS ].sSectorX = 10; gMercProfiles[ PACOS ].sSectorY = MAP_ROW_A; - gMercProfiles[ PACOS ].bSectorZ = 0; + gMercProfiles[ PACOS ].bSectorZ = 1; //kitty: fixed - first level underground is 1, not 0 break; case NPC_ACTION_HISTORY_ASSASSIN: AddHistoryToPlayersLog( HISTORY_ASSASSIN, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 14cdf1ac..ad349607 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -7915,7 +7915,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( CheckFact( FACT_FIRST_BATTLE_BEING_FOUGHT, 0 ) ) { // ATE: Need to trigger record for this event .... for NPC scripting - TriggerNPCRecord( PACOS, 18 ); + TriggerNPCRecord( PACOS, 20 ); // this is our first battle... and we won! SetFactTrue( FACT_FIRST_BATTLE_FOUGHT );