mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
*** Merged Code from Multiplayer Branch Revision 2960 ***
- Virtual File System (VFS) by birdflu. This is needed for Multiplayer and is also used for Single Player. Very neat system :-) - Multiplayer Version 1.1 + some additional features and bugfixes * INFO: If you compile a new EXE and want to test, be sure to also use the latest SVN GameDir files in your JA2 install directory * git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2961 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -227,7 +227,7 @@ void ExtractAndUpdateMapInfo()
|
||||
gMapInformation.ubRestrictedScrollID = (UINT8)temp;
|
||||
|
||||
//set up fields for exitgrid information
|
||||
Get16BitStringFromField( 7, str );
|
||||
Get16BitStringFromField( 7, str, 10 );
|
||||
if( str[0] >= 'a' && str[0] <= 'z' )
|
||||
str[0] -= 32; //uppercase it!
|
||||
if( str[0] >= 'A' && str[0] <= 'Z' &&
|
||||
|
||||
@@ -1068,7 +1068,7 @@ void FDlgDwnCallback( GUI_BUTTON *butn, INT32 reason )
|
||||
|
||||
BOOLEAN ExtractFilenameFromFields()
|
||||
{
|
||||
Get16BitStringFromField( 0, gzFilename );
|
||||
Get16BitStringFromField( 0, gzFilename, 31 );
|
||||
return ValidFilename();
|
||||
}
|
||||
|
||||
|
||||
@@ -2787,7 +2787,7 @@ void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
void ExtractTempFilename()
|
||||
{
|
||||
CHAR16 str[40];
|
||||
Get16BitStringFromField( 1, str );
|
||||
Get16BitStringFromField( 1, str, 40 );
|
||||
if( wcscmp( gszTempFilename, str ) )
|
||||
{
|
||||
wcscpy( gszTempFilename, str );
|
||||
|
||||
+233
-189
@@ -40,6 +40,10 @@
|
||||
#include "Text.h"
|
||||
#include "connect.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
#include "VFS/File/vfs_file.h"
|
||||
|
||||
#define GAME_SETTINGS_FILE "Ja2_Settings.INI"
|
||||
|
||||
#define GAME_INI_FILE "..\\Ja2.ini"
|
||||
@@ -89,6 +93,7 @@ BOOLEAN IsNIVModeValid(bool checkRes)
|
||||
{
|
||||
if(iResolution == 0 && checkRes == true)
|
||||
return( FALSE );
|
||||
#ifndef USE_VFS
|
||||
if(gCustomDataCat.GetRootDir() == "")
|
||||
return( FALSE );
|
||||
char customDataPath[MAX_PATH];
|
||||
@@ -96,6 +101,14 @@ BOOLEAN IsNIVModeValid(bool checkRes)
|
||||
if(StringToLower((std::string)customDataPath) == "data")
|
||||
return( FALSE );
|
||||
return( TRUE );
|
||||
#else
|
||||
// Check if the Profile with the NAME = "v1.13" is found in the specificed vfs_config.*.ini
|
||||
if(GetVFS()->GetProfileStack()->GetProfile(L"v1.13") != NULL)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -230,124 +243,146 @@ BOOLEAN LoadGameSettings()
|
||||
|
||||
BOOLEAN SaveGameSettings()
|
||||
{
|
||||
char gameSettingsFilePath[MAX_PATH];
|
||||
FILE *file_pointer;
|
||||
|
||||
//Record the current settings into the game settins structure
|
||||
gGameSettings.ubSoundEffectsVolume = (UINT8)GetSoundEffectsVolume( );
|
||||
gGameSettings.ubSpeechVolume = (UINT8)GetSpeechVolume( );
|
||||
gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( );
|
||||
|
||||
#ifndef USE_VFS
|
||||
char gameSettingsFilePath[MAX_PATH];
|
||||
FILE *file_pointer;
|
||||
|
||||
sprintf(gameSettingsFilePath, "%s\\%s", gCustomDataCat.GetRootDir().c_str(), GAME_SETTINGS_FILE);
|
||||
|
||||
fopen_s( &file_pointer, gameSettingsFilePath, "w" );
|
||||
|
||||
if( file_pointer )
|
||||
if( !file_pointer )
|
||||
{
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , "; Jagged Alliance 2 --Settings File-- \n" );
|
||||
fprintf_s (file_pointer , "; \n" );
|
||||
fprintf_s (file_pointer , "; Please note that this file is automatically generated by the game. \n" );
|
||||
fprintf_s (file_pointer , "; \n" );
|
||||
fprintf_s (file_pointer , "; While it is safe to change things from within this file, not all values are acceptable. Some may break the game, \n" );
|
||||
fprintf_s (file_pointer , "; some may be ignored, but most likely they will be acceptable or reset to a default value. \n" );
|
||||
fprintf_s (file_pointer , "; \n" );
|
||||
fprintf_s (file_pointer , "; Please note, This file and its contents are in a beta phase. Expect changes, however they should be minimal and automated.\n" );
|
||||
fprintf_s (file_pointer , "; \n" );
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , "\n" );
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , ";\n" );
|
||||
fprintf_s (file_pointer , "; The Current Game Setting Struct is defined as : \n" );
|
||||
fprintf_s (file_pointer , ";\n" );
|
||||
fprintf_s (file_pointer , "; typedef struct \n");
|
||||
fprintf_s (file_pointer , "; { \n");
|
||||
fprintf_s (file_pointer , "; INT8 bLastSavedGameSlot; // The last saved game number goes in here \n");
|
||||
fprintf_s (file_pointer , "; UINT8 ubMusicVolumeSetting; // Volume Setting \n");
|
||||
fprintf_s (file_pointer , "; UINT8 ubSoundEffectsVolume; // Volume Setting \n");
|
||||
fprintf_s (file_pointer , "; UINT8 ubSpeechVolume; // Volume Setting \n");
|
||||
fprintf_s (file_pointer , "; UINT8 fOptions[ NUM_ALL_GAME_OPTIONS ]; // Toggle Options (Speech, Subtitles, Show Tree Tops, etc.. ) \n");
|
||||
fprintf_s (file_pointer , "; UINT32 uiMeanwhileScenesSeenFlags; // Bit Vector describing seen 'mean whiles..' \n");
|
||||
fprintf_s (file_pointer , "; BOOLEAN fHideHelpInAllScreens; // Controls Help \"do not show help again\" checkbox \n");
|
||||
fprintf_s (file_pointer , "; UINT8 ubSizeOfDisplayCover; // The number of grids the player designates thru [Delete + ( = or - )] \n");
|
||||
fprintf_s (file_pointer , "; UINT8 ubSizeOfLOS; // The number of grids the player designates thru [End + ( = or - )] \n");
|
||||
fprintf_s (file_pointer , "; } GAME_SETTINGS; \n");
|
||||
fprintf_s (file_pointer , ";\n" );
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , "\n\n" );
|
||||
fprintf_s (file_pointer , "[JA2 Game Settings]\n" );
|
||||
|
||||
|
||||
fprintf_s (file_pointer , "bLastSavedGameSlot = %d \n" , gGameSettings.bLastSavedGameSlot );
|
||||
fprintf_s (file_pointer , "ubMusicVolumeSetting = %u \n" , gGameSettings.ubMusicVolumeSetting );
|
||||
fprintf_s (file_pointer , "ubSoundEffectsVolume = %u \n" , gGameSettings.ubSoundEffectsVolume );
|
||||
fprintf_s (file_pointer , "ubSpeechVolume = %u \n" , gGameSettings.ubSpeechVolume );
|
||||
fprintf_s (file_pointer , "uiMeanwhileScenesSeenFlags = %u \n" , gGameSettings.uiMeanwhileScenesSeenFlags );
|
||||
fprintf_s (file_pointer , "fHideHelpInAllScreens = %s \n" , (gGameSettings.fHideHelpInAllScreens ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "ubSizeOfDisplayCover = %u \n" , gGameSettings.ubSizeOfDisplayCover );
|
||||
fprintf_s (file_pointer , "ubSizeOfLOS = %u \n" , gGameSettings.ubSizeOfLOS );
|
||||
fprintf_s (file_pointer , "TOPTION_SPEECH = %s \n" , (gGameSettings.fOptions[TOPTION_SPEECH] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_MUTE_CONFIRMATIONS = %s \n" , (gGameSettings.fOptions[TOPTION_MUTE_CONFIRMATIONS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SUBTITLES = %s \n" , (gGameSettings.fOptions[TOPTION_SUBTITLES] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_KEY_ADVANCE_SPEECH = %s \n" , (gGameSettings.fOptions[TOPTION_KEY_ADVANCE_SPEECH] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_ANIMATE_SMOKE = %s \n" , (gGameSettings.fOptions[TOPTION_ANIMATE_SMOKE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_BLOOD_N_GORE = %s \n" , (gGameSettings.fOptions[TOPTION_BLOOD_N_GORE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_DONT_MOVE_MOUSE = %s \n" , (gGameSettings.fOptions[TOPTION_DONT_MOVE_MOUSE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_OLD_SELECTION_METHOD = %s \n" , (gGameSettings.fOptions[TOPTION_OLD_SELECTION_METHOD] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_ALWAYS_SHOW_MOVEMENT_PATH = %s \n" , (gGameSettings.fOptions[TOPTION_ALWAYS_SHOW_MOVEMENT_PATH] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SHOW_MISSES = %s \n" , (gGameSettings.fOptions[TOPTION_SHOW_MISSES] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_RTCONFIRM = %s \n" , (gGameSettings.fOptions[TOPTION_RTCONFIRM] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SLEEPWAKE_NOTIFICATION = %s \n" , (gGameSettings.fOptions[TOPTION_SLEEPWAKE_NOTIFICATION] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_USE_METRIC_SYSTEM = %s \n" , (gGameSettings.fOptions[TOPTION_USE_METRIC_SYSTEM] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_MERC_ALWAYS_LIGHT_UP = %s \n" , (gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SMART_CURSOR = %s \n" , (gGameSettings.fOptions[TOPTION_SMART_CURSOR] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SNAP_CURSOR_TO_DOOR = %s \n" , (gGameSettings.fOptions[TOPTION_SNAP_CURSOR_TO_DOOR] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_GLOW_ITEMS = %s \n" , (gGameSettings.fOptions[TOPTION_GLOW_ITEMS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_TOGGLE_TREE_TOPS = %s \n" , (gGameSettings.fOptions[TOPTION_TOGGLE_TREE_TOPS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_TOGGLE_WIREFRAME = %s \n" , (gGameSettings.fOptions[TOPTION_TOGGLE_WIREFRAME] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_3D_CURSOR = %s \n" , (gGameSettings.fOptions[TOPTION_3D_CURSOR] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_CTH_CURSOR = %s \n" , (gGameSettings.fOptions[TOPTION_CTH_CURSOR] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_GL_BURST_CURSOR = %s \n" , (gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_DROP_ALL = %s \n" , (gGameSettings.fOptions[TOPTION_DROP_ALL] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_GL_HIGH_ANGLE = %s \n" , (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_AIM_LEVEL_RESTRICTION = %s \n" , (gGameSettings.fOptions[TOPTION_AIM_LEVEL_RESTRICTION] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SPACE_SELECTS_NEXT_SQUAD = %s \n" , (gGameSettings.fOptions[TOPTION_SPACE_SELECTS_NEXT_SQUAD] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SHOW_ITEM_SHADOW = %s \n" , (gGameSettings.fOptions[TOPTION_SHOW_ITEM_SHADOW] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SHOW_WEAPON_RANGE_IN_TILES = %s \n" , (gGameSettings.fOptions[TOPTION_SHOW_WEAPON_RANGE_IN_TILES] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_TRACERS_FOR_SINGLE_FIRE = %s \n" , (gGameSettings.fOptions[TOPTION_TRACERS_FOR_SINGLE_FIRE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_RAIN_SOUND = %s \n" , (gGameSettings.fOptions[TOPTION_RAIN_SOUND] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_ALLOW_CROWS = %s \n" , (gGameSettings.fOptions[TOPTION_ALLOW_CROWS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_ALLOW_SOLDIER_TOOLTIPS = %s \n" , (gGameSettings.fOptions[TOPTION_ALLOW_SOLDIER_TOOLTIPS] ? "TRUE" : "FALSE" ) ); // changed from random IMP personality - SANDRO
|
||||
fprintf_s (file_pointer , "TOPTION_USE_AUTO_SAVE = %s \n" , (gGameSettings.fOptions[TOPTION_USE_AUTO_SAVE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SILENT_SKYRIDER = %s \n" , (gGameSettings.fOptions[TOPTION_SILENT_SKYRIDER] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_LOW_CPU_USAGE = %s \n" , (gGameSettings.fOptions[TOPTION_LOW_CPU_USAGE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_ENHANCED_DESC_BOX = %s \n" , (gGameSettings.fOptions[TOPTION_ENHANCED_DESC_BOX] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_TOGGLE_TURN_MODE = %s \n" , (gGameSettings.fOptions[TOPTION_TOGGLE_TURN_MODE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_CHEAT_MODE_OPTIONS_HEADER = %s \n" , (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_FORCE_BOBBY_RAY_SHIPMENTS = %s \n" , (gGameSettings.fOptions[TOPTION_FORCE_BOBBY_RAY_SHIPMENTS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_CHEAT_MODE_OPTIONS_END = %s \n" , (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_DEBUG_MODE_OPTIONS_HEADER = %s \n" , (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_SHOW_RESET_ALL_OPTIONS = %s \n" , (gGameSettings.fOptions[TOPTION_SHOW_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_RESET_ALL_OPTIONS = %s \n" , (gGameSettings.fOptions[TOPTION_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE = %s \n" , (gGameSettings.fOptions[TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP = %s \n" , (gGameSettings.fOptions[TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_RENDER_MOUSE_REGIONS = %s \n" , (gGameSettings.fOptions[TOPTION_RENDER_MOUSE_REGIONS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_DEBUG_MODE_OPTIONS_END = %s \n" , (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , "; Options beyond this point are Code derived options, DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOUR ARE DOING. \n" );
|
||||
fprintf_s (file_pointer , "; They are only included here for complete transparency for all GameSettings content. \n" );
|
||||
fprintf_s (file_pointer , ";******************************************************************************************************************************\n" );
|
||||
fprintf_s (file_pointer , "TOPTION_LAST_OPTION = %s \n" , (gGameSettings.fOptions[TOPTION_LAST_OPTION] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "NUM_GAME_OPTIONS = %s \n" , (gGameSettings.fOptions[NUM_GAME_OPTIONS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_MERC_CASTS_LIGHT = %s \n" , (gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_HIDE_BULLETS = %s \n" , (gGameSettings.fOptions[TOPTION_HIDE_BULLETS] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "TOPTION_TRACKING_MODE = %s \n" , (gGameSettings.fOptions[TOPTION_TRACKING_MODE] ? "TRUE" : "FALSE" ) );
|
||||
fprintf_s (file_pointer , "NUM_ALL_GAME_OPTIONS = %s \n" , (gGameSettings.fOptions[NUM_ALL_GAME_OPTIONS] ? "TRUE" : "FALSE" ) );
|
||||
|
||||
//?fclose( file_pointer );
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::stringstream settings;
|
||||
const char endl[] = "\r\n";
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << "; Jagged Alliance 2 --Settings File-- " << endl;
|
||||
settings << "; " << endl;
|
||||
settings << "; Please note that this file is automatically generated by the game. " << endl;
|
||||
settings << "; " << endl;
|
||||
settings << "; While it is safe to change things from within this file, not all values are acceptable. Some may break the game, " << endl;
|
||||
settings << "; some may be ignored, but most likely they will be acceptable or reset to a default value. " << endl;
|
||||
settings << "; " << endl;
|
||||
settings << "; Please note, This file and its contents are in a beta phase. Expect changes, however they should be minimal and automated." << endl;
|
||||
settings << "; " << endl;
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << endl;
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << endl;
|
||||
settings << "; The Current Game Setting Struct is defined as : " << endl;
|
||||
settings << ";" << endl;
|
||||
settings << "; typedef struct" << endl;
|
||||
settings << "; {" << endl;
|
||||
settings << "; INT8 bLastSavedGameSlot; // The last saved game number goes in here" << endl;
|
||||
settings << "; UINT8 ubMusicVolumeSetting; // Volume Setting" << endl;
|
||||
settings << "; UINT8 ubSoundEffectsVolume; // Volume Setting" << endl;
|
||||
settings << "; UINT8 ubSpeechVolume; // Volume Setting" << endl;
|
||||
settings << "; UINT8 fOptions[ NUM_ALL_GAME_OPTIONS ]; // Toggle Options (Speech, Subtitles, Show Tree Tops, etc.. )" << endl;
|
||||
settings << "; UINT32 uiMeanwhileScenesSeenFlags; // Bit Vector describing seen 'mean whiles..'" << endl;
|
||||
settings << "; BOOLEAN fHideHelpInAllScreens; // Controls Help \"do not show help again\" checkbox" << endl;
|
||||
settings << "; UINT8 ubSizeOfDisplayCover; // The number of grids the player designates thru [Delete + ( = or - )]" << endl;
|
||||
settings << "; UINT8 ubSizeOfLOS; // The number of grids the player designates thru [End + ( = or - )]" << endl;
|
||||
settings << "; } GAME_SETTINGS" << endl;
|
||||
settings << ";" << endl;
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << endl << endl;
|
||||
settings << "[JA2 Game Settings]" << endl;
|
||||
|
||||
settings << "bLastSavedGameSlot = " << (int)gGameSettings.bLastSavedGameSlot << endl;
|
||||
settings << "ubMusicVolumeSetting = " << (int)gGameSettings.ubMusicVolumeSetting << endl;
|
||||
settings << "ubSoundEffectsVolume = " << (int)gGameSettings.ubSoundEffectsVolume << endl;
|
||||
settings << "ubSpeechVolume = " << (int)gGameSettings.ubSpeechVolume << endl;
|
||||
settings << "uiMeanwhileScenesSeenFlags = " << gGameSettings.uiMeanwhileScenesSeenFlags << endl;
|
||||
settings << "fHideHelpInAllScreens = " << (gGameSettings.fHideHelpInAllScreens ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "ubSizeOfDisplayCover = " << (int)gGameSettings.ubSizeOfDisplayCover << endl;
|
||||
settings << "ubSizeOfLOS = " << (int)gGameSettings.ubSizeOfLOS << endl;
|
||||
settings << "TOPTION_SPEECH = " << (gGameSettings.fOptions[TOPTION_SPEECH] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_MUTE_CONFIRMATIONS = " << (gGameSettings.fOptions[TOPTION_MUTE_CONFIRMATIONS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SUBTITLES = " << (gGameSettings.fOptions[TOPTION_SUBTITLES] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_KEY_ADVANCE_SPEECH = " << (gGameSettings.fOptions[TOPTION_KEY_ADVANCE_SPEECH] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_ANIMATE_SMOKE = " << (gGameSettings.fOptions[TOPTION_ANIMATE_SMOKE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_BLOOD_N_GORE = " << (gGameSettings.fOptions[TOPTION_BLOOD_N_GORE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_DONT_MOVE_MOUSE = " << (gGameSettings.fOptions[TOPTION_DONT_MOVE_MOUSE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_OLD_SELECTION_METHOD = " << (gGameSettings.fOptions[TOPTION_OLD_SELECTION_METHOD] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_ALWAYS_SHOW_MOVEMENT_PATH = " << (gGameSettings.fOptions[TOPTION_ALWAYS_SHOW_MOVEMENT_PATH] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SHOW_MISSES = " << (gGameSettings.fOptions[TOPTION_SHOW_MISSES] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_RTCONFIRM = " << (gGameSettings.fOptions[TOPTION_RTCONFIRM] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SLEEPWAKE_NOTIFICATION = " << (gGameSettings.fOptions[TOPTION_SLEEPWAKE_NOTIFICATION] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_USE_METRIC_SYSTEM = " << (gGameSettings.fOptions[TOPTION_USE_METRIC_SYSTEM] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_MERC_ALWAYS_LIGHT_UP = " << (gGameSettings.fOptions[TOPTION_MERC_ALWAYS_LIGHT_UP] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SMART_CURSOR = " << (gGameSettings.fOptions[TOPTION_SMART_CURSOR] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SNAP_CURSOR_TO_DOOR = " << (gGameSettings.fOptions[TOPTION_SNAP_CURSOR_TO_DOOR] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_GLOW_ITEMS = " << (gGameSettings.fOptions[TOPTION_GLOW_ITEMS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_TOGGLE_TREE_TOPS = " << (gGameSettings.fOptions[TOPTION_TOGGLE_TREE_TOPS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_TOGGLE_WIREFRAME = " << (gGameSettings.fOptions[TOPTION_TOGGLE_WIREFRAME] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_3D_CURSOR = " << (gGameSettings.fOptions[TOPTION_3D_CURSOR] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_CTH_CURSOR = " << (gGameSettings.fOptions[TOPTION_CTH_CURSOR] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_GL_BURST_CURSOR = " << (gGameSettings.fOptions[TOPTION_GL_BURST_CURSOR] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_DROP_ALL = " << (gGameSettings.fOptions[TOPTION_DROP_ALL] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_GL_HIGH_ANGLE = " << (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_AIM_LEVEL_RESTRICTION = " << (gGameSettings.fOptions[TOPTION_AIM_LEVEL_RESTRICTION] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SPACE_SELECTS_NEXT_SQUAD = " << (gGameSettings.fOptions[TOPTION_SPACE_SELECTS_NEXT_SQUAD] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SHOW_ITEM_SHADOW = " << (gGameSettings.fOptions[TOPTION_SHOW_ITEM_SHADOW] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SHOW_WEAPON_RANGE_IN_TILES = " << (gGameSettings.fOptions[TOPTION_SHOW_WEAPON_RANGE_IN_TILES] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_TRACERS_FOR_SINGLE_FIRE = " << (gGameSettings.fOptions[TOPTION_TRACERS_FOR_SINGLE_FIRE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_RAIN_SOUND = " << (gGameSettings.fOptions[TOPTION_RAIN_SOUND] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_ALLOW_CROWS = " << (gGameSettings.fOptions[TOPTION_ALLOW_CROWS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_ALLOW_SOLDIER_TOOLTIPS = " << (gGameSettings.fOptions[TOPTION_ALLOW_SOLDIER_TOOLTIPS] ? "TRUE" : "FALSE" ) << endl; // changed from random IMP personality - SANDRO
|
||||
settings << "TOPTION_USE_AUTO_SAVE = " << (gGameSettings.fOptions[TOPTION_USE_AUTO_SAVE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SILENT_SKYRIDER = " << (gGameSettings.fOptions[TOPTION_SILENT_SKYRIDER] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_LOW_CPU_USAGE = " << (gGameSettings.fOptions[TOPTION_LOW_CPU_USAGE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_ENHANCED_DESC_BOX = " << (gGameSettings.fOptions[TOPTION_ENHANCED_DESC_BOX] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_TOGGLE_TURN_MODE = " << (gGameSettings.fOptions[TOPTION_TOGGLE_TURN_MODE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_CHEAT_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_FORCE_BOBBY_RAY_SHIPMENTS = " << (gGameSettings.fOptions[TOPTION_FORCE_BOBBY_RAY_SHIPMENTS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_CHEAT_MODE_OPTIONS_END = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_DEBUG_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_SHOW_RESET_ALL_OPTIONS = " << (gGameSettings.fOptions[TOPTION_SHOW_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_RESET_ALL_OPTIONS = " << (gGameSettings.fOptions[TOPTION_RESET_ALL_OPTIONS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE = " << (gGameSettings.fOptions[TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_RENDER_OPTIONS_GROUP] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_RENDER_MOUSE_REGIONS = " << (gGameSettings.fOptions[TOPTION_RENDER_MOUSE_REGIONS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_DEBUG_MODE_OPTIONS_END = " << (gGameSettings.fOptions[TOPTION_DEBUG_MODE_OPTIONS_END] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << "; Options beyond this point are Code derived options, DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOUR ARE DOING." << endl;
|
||||
settings << "; They are only included here for complete transparency for all GameSettings content. " << endl;
|
||||
settings << ";******************************************************************************************************************************" << endl;
|
||||
settings << "TOPTION_LAST_OPTION = " << (gGameSettings.fOptions[TOPTION_LAST_OPTION] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "NUM_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_MERC_CASTS_LIGHT = " << (gGameSettings.fOptions[TOPTION_MERC_CASTS_LIGHT] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_HIDE_BULLETS = " << (gGameSettings.fOptions[TOPTION_HIDE_BULLETS] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "TOPTION_TRACKING_MODE = " << (gGameSettings.fOptions[TOPTION_TRACKING_MODE] ? "TRUE" : "FALSE" ) << endl;
|
||||
settings << "NUM_ALL_GAME_OPTIONS = " << (gGameSettings.fOptions[NUM_ALL_GAME_OPTIONS] ? "TRUE" : "FALSE" ) << endl;
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf_s (file_pointer , settings.str().c_str());
|
||||
fclose( file_pointer );
|
||||
#else
|
||||
vfs::UInt32 written;
|
||||
try
|
||||
{
|
||||
vfs::COpenWriteFile wfile(GAME_SETTINGS_FILE,true,true);
|
||||
wfile.file().Write(settings.str().c_str(), settings.str().length(),written);
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
{
|
||||
vfs::CFile wfile(GAME_SETTINGS_FILE);
|
||||
if(wfile.OpenWrite(true,true))
|
||||
{
|
||||
wfile.Write(settings.str().c_str(), settings.str().length(),written);
|
||||
wfile.Close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return( TRUE );
|
||||
|
||||
@@ -508,9 +543,13 @@ void LoadGameExternalOptions()
|
||||
|
||||
|
||||
// WANNE: FILE TRANSFER: We disable reading from ja2_options.ini until we get file transfer working
|
||||
if(is_networked)
|
||||
memset(&iniReader, 0, sizeof (CIniReader) );//disable ini in mp (taking default values)
|
||||
|
||||
if(is_networked)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
//memset(&iniReader, 0, sizeof (CIniReader) );//disable ini in mp (taking default values)
|
||||
iniReader.Clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
//################# Laptop Settings #################
|
||||
|
||||
@@ -546,10 +585,14 @@ void LoadGameExternalOptions()
|
||||
if (gGameExternalOptions.iaIMPSlots[idx] < 0)
|
||||
{
|
||||
if (idx < COUNT_STANDARD_MALE_SLOTS)
|
||||
{
|
||||
gGameExternalOptions.iaIMPSlots[idx] = FIRST_STANDARD_MALE_SLOT+idx;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is bad so just use the last standard slot #
|
||||
gGameExternalOptions.iaIMPSlots[idx] = FIRST_STANDARD_MALE_SLOT+COUNT_STANDARD_MALE_SLOTS-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
gGameExternalOptions.iaIMPSlots[gGameExternalOptions.iIMPMaleCharacterCount] = -1;
|
||||
@@ -560,17 +603,21 @@ void LoadGameExternalOptions()
|
||||
if (gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] < 0)
|
||||
{
|
||||
if (idx < COUNT_STANDARD_FEMALE_SLOTS)
|
||||
{
|
||||
gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] = FIRST_STANDARD_FEMALE_SLOT+idx;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is bad so just use the last standard slot #
|
||||
gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] = FIRST_STANDARD_FEMALE_SLOT+COUNT_STANDARD_FEMALE_SLOTS-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
gGameExternalOptions.iaIMPSlots[gGameExternalOptions.iIMPFemaleCharacterCount+gGameExternalOptions.iIMPMaleCharacterCount+1] = -1;
|
||||
|
||||
//Character generation
|
||||
gGameExternalOptions.iMinAttribute = iniReader.ReadInteger("JA2 Laptop Settings","MIN_ATTRIBUTE_POINT",35, 1, 99);
|
||||
gGameExternalOptions.iMaxAttribute = iniReader.ReadInteger("JA2 Laptop Settings","MAX_ATTRIBUTE_POINT",90, gGameExternalOptions.iMinAttribute+1, 100);
|
||||
gGameExternalOptions.iMinAttribute = iniReader.ReadInteger("JA2 Laptop Settings","MIN_ATTRIBUTE_POINT",35, 1, 99);
|
||||
gGameExternalOptions.iMaxAttribute = iniReader.ReadInteger("JA2 Laptop Settings","MAX_ATTRIBUTE_POINT",90, gGameExternalOptions.iMinAttribute+1, 100);
|
||||
gGameExternalOptions.iImpAttributePoints = iniReader.ReadInteger("JA2 Laptop Settings","IMPATTRIBUTEPOINTS",40, 1, 100);
|
||||
gGameExternalOptions.iMaxZeroBonus = iniReader.ReadInteger("JA2 Laptop Settings","MAX_ZERO_BONUS",15, 0, 100);
|
||||
gGameExternalOptions.iStartAttribute = iniReader.ReadInteger("JA2 Laptop Settings","START_ATTRIBUTE",55, 1, 100);
|
||||
@@ -579,7 +626,6 @@ void LoadGameExternalOptions()
|
||||
// These two removed - SANDRO
|
||||
//gGameExternalOptions.iCustomPersonality = (INT8) iniReader.ReadInteger("JA2 Laptop Settings","CUSTOM_PERSONALITY",0, 0, NUM_PERSONALITYTRAIT-1);
|
||||
//gGameExternalOptions.iCustomAttitude = (INT8) iniReader.ReadInteger("JA2 Laptop Settings","CUSTOM_ATTITUDE",0, 0, NUM_ATTITUDES-1);
|
||||
|
||||
// These three added - SANDRO
|
||||
gGameExternalOptions.iIMPStartingLevelCostMultiplier = iniReader.ReadInteger("JA2 Laptop Settings","IMP_STARTING_LEVEL_COST_MULTIPLIER", 5, 0, 100);
|
||||
gGameExternalOptions.iBonusPointsForDisability = iniReader.ReadInteger("JA2 Laptop Settings","IMP_BONUS_POINTS_FOR_DISABILITY",20, 0, 500);
|
||||
@@ -592,17 +638,17 @@ void LoadGameExternalOptions()
|
||||
//Merc Death Settings:
|
||||
gGameExternalOptions.gfMercsDieOnAssignment = iniReader.ReadBoolean("JA2 Laptop Settings","MERCS_DIE_ON_ASSIGNMENT",TRUE);
|
||||
gGameExternalOptions.giEasyMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EASY_MERC_DEATHS",1, 0, 10);
|
||||
gGameExternalOptions.giExperiencedMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERIENCED_MERC_DEATHS",2, 0, 10);
|
||||
gGameExternalOptions.giExpertMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERT_MERC_DEATHS",3, 0, 10);
|
||||
gGameExternalOptions.giInsaneMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","INSANE_MERC_DEATHS",4, 0, 10);
|
||||
gGameExternalOptions.giExperiencedMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERIENCED_MERC_DEATHS",2, 0, 10);
|
||||
gGameExternalOptions.giExpertMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","EXPERT_MERC_DEATHS",3, 0, 10);
|
||||
gGameExternalOptions.giInsaneMercDeaths = iniReader.ReadInteger("JA2 Laptop Settings","INSANE_MERC_DEATHS",4, 0, 10);
|
||||
|
||||
//################# System Settings #################
|
||||
gGameExternalOptions.gubDeadLockDelay = (UINT8) iniReader.ReadInteger("JA2 System Settings","DEAD_LOCK_DELAY",15, 5, 50);
|
||||
gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents = iniReader.ReadBoolean("JA2 System Settings","ENABLE_EMERGENCY_BUTTON_NUMLOCK_TO_SKIP_STRATEGIC_EVENTS",0);
|
||||
|
||||
// WDS - Automatically try to save when an assertion failure occurs
|
||||
gGameExternalOptions.autoSaveOnAssertionFailure = iniReader.ReadBoolean("JA2 System Settings","AUTO_SAVE_ON_ASSERTION_FAILURE", FALSE);
|
||||
gGameExternalOptions.autoSaveTime = iniReader.ReadInteger("JA2 System Settings","AUTO_SAVE_TIME", 6, 0, 24);
|
||||
gGameExternalOptions.autoSaveOnAssertionFailure = iniReader.ReadBoolean("JA2 System Settings","AUTO_SAVE_ON_ASSERTION_FAILURE", FALSE);
|
||||
gGameExternalOptions.autoSaveTime = iniReader.ReadInteger("JA2 System Settings","AUTO_SAVE_TIME", 6, 0, 24);
|
||||
|
||||
//################# Video Settings #################
|
||||
gGameExternalOptions.gfVSync = iniReader.ReadBoolean("JA2 Video Settings","VERTICAL_SYNC",0);
|
||||
@@ -617,7 +663,7 @@ void LoadGameExternalOptions()
|
||||
|
||||
|
||||
//################# Sound Settings #################
|
||||
gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("JA2 Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME",0, 0, 1000 /*1000 = 10x?*/);
|
||||
gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("JA2 Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME",0, 0, 1000 /*1000 = 10x?*/);
|
||||
|
||||
|
||||
|
||||
@@ -641,14 +687,14 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.gfAllowLimitedVision = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_LIMITED_VISION",0);
|
||||
|
||||
// Maximal search distance for grenades
|
||||
//gGameExternalOptions.guiMaxTossSearchDist = iniReader.ReadInteger("JA2 Tactical Settings","MaxTossSearchDist",3);
|
||||
//gGameExternalOptions.guiMaxTossSearchDist = iniReader.ReadInteger("JA2 Tactical Settings","MaxTossSearchDist",3);
|
||||
|
||||
// Soldier tool tips - removed from here, placed into preferences - SANDRO
|
||||
//gGameExternalOptions.gfAllowSoldierToolTips = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_SOLDIER_TOOL_TIPS",0);
|
||||
//SCORE: Settings for UDT
|
||||
gGameExternalOptions.gfAllowUDTRange = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_UDT_RANGE",0);
|
||||
gGameExternalOptions.gfAllowUDTDetail = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_UDT_DETAIL",0);
|
||||
gGameExternalOptions.ubUDTModifier = (UINT8) iniReader.ReadInteger("JA2 Tactical Settings", "UDT_MODIFIER", 50);
|
||||
gGameExternalOptions.gfAllowUDTRange = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_UDT_RANGE",0);
|
||||
gGameExternalOptions.gfAllowUDTDetail = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_UDT_DETAIL",0);
|
||||
gGameExternalOptions.ubUDTModifier = (UINT8) iniReader.ReadInteger("JA2 Tactical Settings", "UDT_MODIFIER", 50);
|
||||
|
||||
// ShadoWarrior: Tooltip changes (start)
|
||||
gGameExternalOptions.ubSoldierTooltipDetailLevel = (UINT8) iniReader.ReadInteger("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DETAIL_LEVEL", 1, 0, 4);
|
||||
@@ -679,25 +725,23 @@ void LoadGameExternalOptions()
|
||||
// ShadoWarrior: Tooltip changes (end)
|
||||
|
||||
// Unload weapons & remove attachments
|
||||
gGameExternalOptions.gfShiftFUnloadWeapons = iniReader.ReadBoolean("JA2 Tactical Settings","SHIFT_F_UNLOAD_WEAPONS",1);
|
||||
gGameExternalOptions.gfShiftFRemoveAttachments = iniReader.ReadBoolean("JA2 Tactical Settings","SHIFT_F_REMOVE_ATTACHMENTS",1);
|
||||
gGameExternalOptions.gfShiftFUnloadWeapons = iniReader.ReadBoolean("JA2 Tactical Settings","SHIFT_F_UNLOAD_WEAPONS",1);
|
||||
gGameExternalOptions.gfShiftFRemoveAttachments = iniReader.ReadBoolean("JA2 Tactical Settings","SHIFT_F_REMOVE_ATTACHMENTS",1);
|
||||
|
||||
gGameExternalOptions.fEnableArmorCoverage = iniReader.ReadBoolean("JA2 Tactical Settings", "ENABLE_ARMOR_COVERAGE", FALSE); // ShadoWarrior for Captain J's armor coverage
|
||||
|
||||
// The_Bob - real time sneaking code 01/06/09
|
||||
// Suport disabling real time sneaking via external .ini file
|
||||
gGameExternalOptions.fAllowRealTimeSneak = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_REAL_TIME_SNEAK", FALSE);
|
||||
// Silence the RT sneaking messages
|
||||
gGameExternalOptions.fQuietRealTimeSneak = iniReader.ReadBoolean("JA2 Tactical Settings","QUIET_REAL_TIME_SNEAK", FALSE);
|
||||
|
||||
|
||||
//################# Rain Settings ##################
|
||||
|
||||
// Rain settings
|
||||
gGameExternalOptions.gfAllowRain = iniReader.ReadBoolean("JA2 Rain Settings","ALLOW_RAIN",0);
|
||||
gGameExternalOptions.gusRainChancePerDay = iniReader.ReadInteger("JA2 Rain Settings","RAIN_CHANCE_PER_DAY",100, 0, 100);
|
||||
gGameExternalOptions.gusRainMinLength = iniReader.ReadInteger("JA2 Rain Settings","RAIN_MIN_LENGTH_IN_MINUTES",60, 1, 1438 /* 24 hrs - 2 minutes */);
|
||||
gGameExternalOptions.gusRainMaxLength = iniReader.ReadInteger("JA2 Rain Settings","RAIN_MAX_LENGTH_IN_MINUTES",300, gGameExternalOptions.gusRainMinLength+1, 1439);
|
||||
gGameExternalOptions.gusRainMinLength = iniReader.ReadInteger("JA2 Rain Settings","RAIN_MIN_LENGTH_IN_MINUTES",60, 1, 1438 /* 24 hrs - 2 minutes */);
|
||||
gGameExternalOptions.gusRainMaxLength = iniReader.ReadInteger("JA2 Rain Settings","RAIN_MAX_LENGTH_IN_MINUTES",300, gGameExternalOptions.gusRainMinLength+1, 1439);
|
||||
gGameExternalOptions.guiMaxRainDrops = iniReader.ReadInteger("JA2 Rain Settings","MAX_RAIN_DROPS",80, 1, 800);
|
||||
gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity = iniReader.ReadInteger("JA2 Rain Settings","WEAPON_RELIABILITY_REDUCTION_PER_RAIN_INTENSITY",0, 0, 10);
|
||||
gGameExternalOptions.ubBreathGainReductionPerRainIntensity = iniReader.ReadDouble("JA2 Rain Settings","BREATH_GAIN_REDUCTION_PER_RAIN_INTENSITY",25, 1, 100);
|
||||
@@ -740,12 +784,12 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.fStealingDisabled = iniReader.ReadBoolean("JA2 Gameplay Settings","STEALING_FROM_SHIPMENTS_DISABLED",FALSE);
|
||||
|
||||
// WDS: Game progress
|
||||
gGameExternalOptions.ubGameProgressPortionKills = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_KILLS", 25, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressPortionKills = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_KILLS", 25, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressPortionControl = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_CONTROL", 25, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressPortionIncome = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_INCOME", 50, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressPortionVisited = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_VISITED", 0, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressMinimum = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_MINIMUM", 0, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_INCREMENT", 0, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressMinimum = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_MINIMUM", 0, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_INCREMENT", 0, 0, 100);
|
||||
|
||||
// Any way to warn on this?
|
||||
if (gGameExternalOptions.ubGameProgressPortionKills +
|
||||
@@ -753,7 +797,7 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.ubGameProgressPortionIncome +
|
||||
gGameExternalOptions.ubGameProgressPortionVisited != 100)
|
||||
{
|
||||
gGameExternalOptions.ubGameProgressPortionKills = 25;
|
||||
gGameExternalOptions.ubGameProgressPortionKills = 25;
|
||||
gGameExternalOptions.ubGameProgressPortionControl = 25;
|
||||
gGameExternalOptions.ubGameProgressPortionIncome = 50;
|
||||
gGameExternalOptions.ubGameProgressPortionVisited = 0;
|
||||
@@ -763,12 +807,12 @@ void LoadGameExternalOptions()
|
||||
//gGameExternalOptions.ubIMPStartingLevel = iniReader.ReadInteger("JA2 Gameplay Settings","IMP_STARTING_LEVEL", 1, 1, 7);
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_PLAYER_MERCS", 24, 1, CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfPlayerVehicles = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_PLAYER_VEHICLES", 2, 2, CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfEnemies = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_ENEMIES", 32, 16, CODE_MAXIMUM_NUMBER_OF_ENEMIES);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfCreatures = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_CREATURES", 32, 0, CODE_MAXIMUM_NUMBER_OF_CREATURES);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfRebels = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_REBELS", 32, 16, CODE_MAXIMUM_NUMBER_OF_REBELS);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfCivilians = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_CIVS", 32, 16, CODE_MAXIMUM_NUMBER_OF_CIVS);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_PLAYER_MERCS", 24, 1, CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfPlayerVehicles = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_PLAYER_VEHICLES", 2, 2, CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfEnemies = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_ENEMIES", 32, 16, CODE_MAXIMUM_NUMBER_OF_ENEMIES);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfCreatures = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_CREATURES", 32, 0, CODE_MAXIMUM_NUMBER_OF_CREATURES);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfRebels = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_REBELS", 32, 16, CODE_MAXIMUM_NUMBER_OF_REBELS);
|
||||
gGameExternalOptions.ubGameMaximumNumberOfCivilians = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_NUMBER_CIVS", 32, 16, CODE_MAXIMUM_NUMBER_OF_CIVS);
|
||||
|
||||
//Global game events
|
||||
gGameExternalOptions.ubGameProgressStartMadlabQuest = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_START_MADLAB_QUEST",35, 1, 100);
|
||||
@@ -851,7 +895,7 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.gfInsaneAggressiveQueen = iniReader.ReadBoolean("JA2 Gameplay Settings","INSANE_QUEEN_AGGRESSIVE",TRUE);
|
||||
|
||||
// WDS - New AI
|
||||
gGameExternalOptions.useNewAI = iniReader.ReadBoolean("JA2 Gameplay Settings","NEW_AGGRESSIVE_AI",FALSE);
|
||||
gGameExternalOptions.useNewAI = iniReader.ReadBoolean("JA2 Gameplay Settings","NEW_AGGRESSIVE_AI",FALSE);
|
||||
|
||||
gGameExternalOptions.gfInvestigateSector = iniReader.ReadBoolean("JA2 Gameplay Settings","ENEMY_INVESTIGATE_SECTOR",FALSE);
|
||||
gGameExternalOptions.gfReassignPendingReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","REASSIGN_PENDING_REINFORCEMENTS",TRUE);
|
||||
@@ -886,14 +930,14 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.gflimitedRoaming = iniReader.ReadBoolean("JA2 Gameplay Settings","RESTRICT_ROAMING",FALSE);
|
||||
|
||||
// WDS - Improve Tony's and Devin's inventory like BR's
|
||||
gGameExternalOptions.tonyUsesBRSetting = iniReader.ReadBoolean("JA2 Gameplay Settings","TONY_USES_BR_SETTING", FALSE);
|
||||
gGameExternalOptions.devinUsesBRSetting = iniReader.ReadBoolean("JA2 Gameplay Settings","DEVIN_USES_BR_SETTING", FALSE);
|
||||
gGameExternalOptions.tonyUsesBRSetting = iniReader.ReadBoolean("JA2 Gameplay Settings","TONY_USES_BR_SETTING", FALSE);
|
||||
gGameExternalOptions.devinUsesBRSetting = iniReader.ReadBoolean("JA2 Gameplay Settings","DEVIN_USES_BR_SETTING", FALSE);
|
||||
|
||||
// WDS - Smart goggle switching
|
||||
gGameExternalOptions.smartGoggleSwitch = iniReader.ReadBoolean("JA2 Gameplay Settings","SMART_GOGGLE_SWITCH", FALSE);
|
||||
gGameExternalOptions.smartGoggleSwitch = iniReader.ReadBoolean("JA2 Gameplay Settings","SMART_GOGGLE_SWITCH", FALSE);
|
||||
|
||||
// WDS - Automatically flag mines
|
||||
gGameExternalOptions.automaticallyFlagMines = iniReader.ReadBoolean("JA2 Gameplay Settings","AUTOMATICALLY_FLAG_MINES", FALSE);
|
||||
gGameExternalOptions.automaticallyFlagMines = iniReader.ReadBoolean("JA2 Gameplay Settings","AUTOMATICALLY_FLAG_MINES", FALSE);
|
||||
|
||||
//Assignment Settings (training, repairing, doctoring, etc)
|
||||
gGameExternalOptions.ubAssignmentUnitsPerDay = iniReader.ReadInteger("JA2 Gameplay Settings","ASSIGNMENT_UNITS_PER_DAY",24, 1, 96);
|
||||
@@ -916,8 +960,8 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.ubHighActivityLevel = iniReader.ReadInteger("JA2 Gameplay Settings","HIGH_ACTIVITY_LEVEL",12, 1, 100);
|
||||
gGameExternalOptions.ubDoctoringRateDivisor = iniReader.ReadInteger("JA2 Gameplay Settings","DOCTORING_RATE_DIVISOR",2400, 1200, 24000);
|
||||
gGameExternalOptions.ubHospitalHealingRate = iniReader.ReadInteger("JA2 Gameplay Settings","HOSPITAL_HEALING_RATE",5, 1, 10);
|
||||
gGameExternalOptions.ubBaseMedicalSkillToDealWithEmergency = iniReader.ReadInteger("JA2 Gameplay Settings","BASE_MEDICAL_SKILL_TO_DEAL_WITH_EMERGENCY",20, 0, 100);
|
||||
gGameExternalOptions.ubMultiplierForDifferenceInLifeValueForEmergency = iniReader.ReadInteger("JA2 Gameplay Settings","MULTIPLIER_FOR_DIFFERENCE_IN_LIFE_VALUE_FOR_EMERGENCY",4, 1, 10);
|
||||
gGameExternalOptions.ubBaseMedicalSkillToDealWithEmergency = iniReader.ReadInteger("JA2 Gameplay Settings","BASE_MEDICAL_SKILL_TO_DEAL_WITH_EMERGENCY",20, 0, 100);
|
||||
gGameExternalOptions.ubMultiplierForDifferenceInLifeValueForEmergency = iniReader.ReadInteger("JA2 Gameplay Settings","MULTIPLIER_FOR_DIFFERENCE_IN_LIFE_VALUE_FOR_EMERGENCY",4, 1, 10);
|
||||
gGameExternalOptions.ubPointCostPerHealthBelowOkLife = iniReader.ReadInteger("JA2 Gameplay Settings","POINT_COST_PER_HEALTH_BELOW_OKLIFE",2, 1, 5);//OKLIFE = 15
|
||||
|
||||
gGameExternalOptions.ubRepairCostPerJam = iniReader.ReadInteger("JA2 Gameplay Settings","REPAIR_COST_PER_JAM",2, 1, 10);
|
||||
@@ -943,116 +987,116 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.fEnableSlayForever = iniReader.ReadBoolean("JA2 Gameplay Settings", "SLAY_FOREVER", FALSE);
|
||||
|
||||
// CHRISL: Setting to turn off the description and stack popup options from the sector inventory panel
|
||||
gGameExternalOptions.fSectorDesc = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_SECTOR_DESCRIPTION_WINDOW",TRUE);
|
||||
gGameExternalOptions.fSectorDesc = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_SECTOR_DESCRIPTION_WINDOW",TRUE);
|
||||
|
||||
//afp - use bullet tracers?
|
||||
gGameExternalOptions.gbBulletTracer = iniReader.ReadBoolean("JA2 Gameplay Settings","USE_BULLET_TRACERS",FALSE);
|
||||
gGameExternalOptions.gbBulletTracer = iniReader.ReadBoolean("JA2 Gameplay Settings","USE_BULLET_TRACERS",FALSE);
|
||||
|
||||
gGameExternalOptions.fRestrictFemaleEnemiesExceptElite = iniReader.ReadBoolean("JA2 Gameplay Settings","RESTRICT_FEMALE_ENEMIES_EXCEPT_ELITE",FALSE);
|
||||
gGameExternalOptions.fRestrictFemaleEnemiesExceptElite = iniReader.ReadBoolean("JA2 Gameplay Settings","RESTRICT_FEMALE_ENEMIES_EXCEPT_ELITE",FALSE);
|
||||
|
||||
// HEADROCK: Use Enhanced Item Description Box?
|
||||
gGameExternalOptions.fEnhancedDescriptionBox = iniReader.ReadInteger("JA2 Gameplay Settings","USE_ENHANCED_DESCRIPTION_BOX",0, 0, 2);
|
||||
gGameExternalOptions.fEnhancedDescriptionBox = iniReader.ReadInteger("JA2 Gameplay Settings","USE_ENHANCED_DESCRIPTION_BOX",0, 0, 2);
|
||||
|
||||
// WANNE: Always use prof.dat??
|
||||
gGameExternalOptions.fAlwaysUseProfDat = iniReader.ReadBoolean("JA2 Gameplay Settings", "ALWAYS_USE_PROF_DAT", FALSE);
|
||||
gGameExternalOptions.fAlwaysUseProfDat = iniReader.ReadBoolean("JA2 Gameplay Settings", "ALWAYS_USE_PROF_DAT", FALSE);
|
||||
|
||||
|
||||
// HEADROCK HAM B1: Set % of mine income, where 100% = normal
|
||||
gGameExternalOptions.iMineIncomePercentage = iniReader.ReadInteger("JA2 HAM Settings","MINE_INCOME_PERCENTAGE",0);
|
||||
gGameExternalOptions.iMineIncomePercentage = iniReader.ReadInteger("JA2 HAM Settings","MINE_INCOME_PERCENTAGE",0);
|
||||
// HEADROCK HAM B2.4: Set a threshold at 1% - otherwise game crashes on asserting mine income.
|
||||
// Can anyone have a look at circumventing the income check? I don't want to cause any damage...
|
||||
gGameExternalOptions.iMineIncomePercentage = __max(gGameExternalOptions.iMineIncomePercentage, 100);
|
||||
|
||||
// HEADROCK HAM B1: Set minimum and maximum CTH
|
||||
gGameExternalOptions.iMaximumCTH = iniReader.ReadInteger("JA2 HAM Settings","MAXIMUM_POSSIBLE_CTH",99);
|
||||
gGameExternalOptions.iMaximumCTH = iniReader.ReadInteger("JA2 HAM Settings","MAXIMUM_POSSIBLE_CTH",99);
|
||||
|
||||
gGameExternalOptions.iMinimumCTH = iniReader.ReadInteger("JA2 HAM Settings","MINIMUM_POSSIBLE_CTH",0);
|
||||
gGameExternalOptions.iMinimumCTH = iniReader.ReadInteger("JA2 HAM Settings","MINIMUM_POSSIBLE_CTH",0);
|
||||
|
||||
// HEADROCK HAM B1: Set minimum CTH at fraction between 0 and 1 ( MINCTH = 1/(100*divisor) ) Note Minimum above must be 0.
|
||||
gGameExternalOptions.iMinimumCTHDivisor = iniReader.ReadInteger("JA2 HAM Settings","MINIMUM_CTH_DIVISOR",100);
|
||||
gGameExternalOptions.iMinimumCTHDivisor = iniReader.ReadInteger("JA2 HAM Settings","MINIMUM_CTH_DIVISOR",100);
|
||||
|
||||
// HEADROCK HAM B1: Allow restricted militia to move through visited sectors?
|
||||
gGameExternalOptions.bUnrestrictVisited = iniReader.ReadBoolean("JA2 HAM Settings","ALLOW_RESTRICTED_MILITIA_THROUGH_VISITED_SECTORS",FALSE);
|
||||
gGameExternalOptions.bUnrestrictVisited = iniReader.ReadBoolean("JA2 HAM Settings","ALLOW_RESTRICTED_MILITIA_THROUGH_VISITED_SECTORS",FALSE);
|
||||
|
||||
gGameExternalOptions.bDynamicRestrictRoaming = iniReader.ReadBoolean("JA2 HAM Settings","ALLOW_DYNAMIC_RESTRICTED_ROAMING",TRUE);
|
||||
gGameExternalOptions.bDynamicRestrictRoaming = iniReader.ReadBoolean("JA2 HAM Settings","ALLOW_DYNAMIC_RESTRICTED_ROAMING",TRUE);
|
||||
|
||||
// HEADROCK HAM B2: Reset suppression counter. 0 = never (oldskool), 1 = Every turn, 2 = Every attack.
|
||||
gGameExternalOptions.iClearSuppression = iniReader.ReadInteger("JA2 HAM Settings","CLEAR_SUPPRESSION_COUNTER",1);
|
||||
gGameExternalOptions.iClearSuppression = iniReader.ReadInteger("JA2 HAM Settings","CLEAR_SUPPRESSION_COUNTER",1);
|
||||
|
||||
// HEADROCK HAM B2.1: This controls how effective suppression is, by increasing the number of ubSuppressionPoints accumulated by combatants (percentage);
|
||||
gGameExternalOptions.iSuppressionEffectiveness = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_EFFECTIVENESS",0);
|
||||
gGameExternalOptions.iSuppressionEffectiveness = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_EFFECTIVENESS",0);
|
||||
|
||||
// HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given turn (0=unlimited)
|
||||
gGameExternalOptions.fSuppressionAPLossPerTurn = iniReader.ReadBoolean("JA2 HAM Settings","LIMITED_SUPPRESSION_AP_LOSS_PER_TURN",TRUE);
|
||||
gGameExternalOptions.fSuppressionAPLossPerTurn = iniReader.ReadBoolean("JA2 HAM Settings","LIMITED_SUPPRESSION_AP_LOSS_PER_TURN",TRUE);
|
||||
|
||||
// HEADROCK HAM B2: MAXIMUM number of APs that can be lost to suppression in a given attack (0=unlimited)
|
||||
gGameExternalOptions.fSuppressionAPLossPerAttack = iniReader.ReadBoolean("JA2 HAM Settings","LIMITED_SUPPRESSION_AP_LOSS_PER_ATTACK",TRUE);
|
||||
gGameExternalOptions.fSuppressionAPLossPerAttack = iniReader.ReadBoolean("JA2 HAM Settings","LIMITED_SUPPRESSION_AP_LOSS_PER_ATTACK",TRUE);
|
||||
|
||||
gGameExternalOptions.iSuppressionToleranceMax = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_TOLERANCE_MAX", 18, 1, 24);
|
||||
gGameExternalOptions.iSuppressionToleranceMin = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_TOLERANCE_MIN", 1, 0, 24);
|
||||
|
||||
// HEADROCK HAM B2: Suppression Shock ON/OFF
|
||||
gGameExternalOptions.fSuppressionShock = iniReader.ReadBoolean("JA2 HAM Settings","SUPPRESSION_SHOCK",FALSE);
|
||||
gGameExternalOptions.fSuppressionShock = iniReader.ReadBoolean("JA2 HAM Settings","SUPPRESSION_SHOCK",FALSE);
|
||||
|
||||
// HEADROCK HAM B2: Suppression Shock effectiveness (percentage, 100 = "normal", 0 = deactivated. Range 0-65535)
|
||||
gGameExternalOptions.iSuppressionShockEffectiveness = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_SHOCK_EFFECTIVENESS",0);
|
||||
gGameExternalOptions.iSuppressionShockEffectiveness = iniReader.ReadInteger("JA2 HAM Settings","SUPPRESSION_SHOCK_EFFECTIVENESS",0);
|
||||
|
||||
// HEADROCK HAM B2.1: CTH penalty given by a "Cowering" target to any enemy shooter.
|
||||
gGameExternalOptions.iAimPenaltyPerTargetShock = iniReader.ReadInteger("JA2 HAM Settings","AIM_PENALTY_PER_TARGET_SHOCK",0);
|
||||
gGameExternalOptions.iAimPenaltyPerTargetShock = iniReader.ReadInteger("JA2 HAM Settings","AIM_PENALTY_PER_TARGET_SHOCK",0);
|
||||
|
||||
// HEADROCK HAM B2.3: A "cowering" soldier is twice as susceptible to suppression.
|
||||
gGameExternalOptions.iCowerEffectOnSuppression = iniReader.ReadInteger("JA2 HAM Settings","COWER_EFFECT_ON_SUPPRESSION",0);
|
||||
gGameExternalOptions.iCowerEffectOnSuppression = iniReader.ReadInteger("JA2 HAM Settings","COWER_EFFECT_ON_SUPPRESSION",0);
|
||||
|
||||
// HEADROCK HAM B2.5: Turn on Realistic Tracers. 0 = off (regular tracers). 1 = Fully realistic tracers. 2 = Tracer Bump + 1.13 Autofire Penalty Reduction
|
||||
gGameExternalOptions.iRealisticTracers = iniReader.ReadInteger("JA2 HAM Settings","REALISTIC_TRACERS",0);
|
||||
gGameExternalOptions.iRealisticTracers = iniReader.ReadInteger("JA2 HAM Settings","REALISTIC_TRACERS",0);
|
||||
|
||||
// HEADROCK HAM B2.5: Realistic tracers - one of every X bullets in a tracer magazines will be a tracer bullet. 0 = off (JA2 normal)
|
||||
gGameExternalOptions.iNumBulletsPerTracer = __max(iniReader.ReadInteger("JA2 HAM Settings","NUM_BULLETS_PER_TRACER",1),1);
|
||||
gGameExternalOptions.iNumBulletsPerTracer = __max(iniReader.ReadInteger("JA2 HAM Settings","NUM_BULLETS_PER_TRACER",1),1);
|
||||
|
||||
// HEADROCK HAM B2.5: Realistic tracers - CTH increased by this amount whenever a tracer is fired. 0 = off.
|
||||
gGameExternalOptions.iCTHBumpPerTracer = iniReader.ReadInteger("JA2 HAM Settings","CTH_BUMP_PER_TRACER",0);
|
||||
gGameExternalOptions.iCTHBumpPerTracer = iniReader.ReadInteger("JA2 HAM Settings","CTH_BUMP_PER_TRACER",0);
|
||||
|
||||
// HEADROCK HAM B2.6: Increased aiming costs?
|
||||
gGameExternalOptions.fIncreasedAimingCost = iniReader.ReadBoolean("JA2 HAM Settings","INCREASED_AIM_COST", FALSE);
|
||||
gGameExternalOptions.fIncreasedAimingCost = iniReader.ReadBoolean("JA2 HAM Settings","INCREASED_AIM_COST", FALSE);
|
||||
|
||||
// HEADROCK HAM B2.6: Dynamically determine Max-Aiming based also on weapon, bipod, etc?
|
||||
gGameExternalOptions.fDynamicAimingTime = iniReader.ReadBoolean("JA2 HAM Settings","DYNAMIC_AIM_LIMITS", FALSE);
|
||||
gGameExternalOptions.fDynamicAimingTime = iniReader.ReadBoolean("JA2 HAM Settings","DYNAMIC_AIM_LIMITS", FALSE);
|
||||
|
||||
// HEADROCK HAM B2.6: Controls how much effect target movement has on aiming
|
||||
//gGameExternalOptions.iMovementEffectOnAiming = iniReader.ReadFloat("JA2 HAM Settings","MOVEMENT_EFFECT_ON_AIMING", 1.5);
|
||||
gGameExternalOptions.iMovementEffectOnAiming = (float)iniReader.ReadDouble("JA2 HAM Settings","MOVEMENT_EFFECT_ON_AIMING", 1.5, 0.0, 255.0);
|
||||
//gGameExternalOptions.iMovementEffectOnAiming = iniReader.ReadFloat("JA2 HAM Settings","MOVEMENT_EFFECT_ON_AIMING", 1.5);
|
||||
gGameExternalOptions.iMovementEffectOnAiming = (float)iniReader.ReadDouble("JA2 HAM Settings","MOVEMENT_EFFECT_ON_AIMING", 1.5, 0.0, 255.0);
|
||||
|
||||
// HEADROCK HAM B2.6: Autofire Bullets/5AP modifier
|
||||
gGameExternalOptions.iAutofireBulletsPer5APModifier = iniReader.ReadInteger("JA2 HAM Settings","AUTOFIRE_BULLETS_PER_5AP_MODIFIER", 0);
|
||||
|
||||
// HEADROCK HAM B2.6/B1: Adjustable "luck" factor in Auto-Resolve
|
||||
//gGameExternalOptions.iAutoResolveLuckFactor = (float)(__max(iniReader.ReadFloat("JA2 HAM Settings","AUTORESOLVE_LUCK_FACTOR", 2.0),1.0));
|
||||
gGameExternalOptions.iAutoResolveLuckFactor = (float)(__max(iniReader.ReadDouble("JA2 HAM Settings","AUTORESOLVE_LUCK_FACTOR", 2.0, 0.0, 255.0),1.0));
|
||||
gGameExternalOptions.iAutoResolveLuckFactor = (float)(__max(iniReader.ReadDouble("JA2 HAM Settings","AUTORESOLVE_LUCK_FACTOR", 2.0, 0.0, 255.0),1.0));
|
||||
|
||||
// HEADROCK HAM B2.6: Adjustable maximum for Suppression Shock effect. This has the added effect of reducing overall susceptibility to shock and may render some enemies unshockable.
|
||||
gGameExternalOptions.iMaxSuppressionShock = iniReader.ReadInteger("JA2 HAM Settings","MAXIMUM_SUPPRESSION_SHOCK", 0);
|
||||
gGameExternalOptions.iMaxSuppressionShock = iniReader.ReadInteger("JA2 HAM Settings","MAXIMUM_SUPPRESSION_SHOCK", 0);
|
||||
|
||||
// HEADROCK HAM B2.6/2/1: Toggle new Burst/Auto CTH bars: 0=neither, 1=both, 2=Burst, 3=Auto
|
||||
gGameExternalOptions.iNewCTHBars = iniReader.ReadInteger("JA2 HAM Settings","NEW_BURST-AUTO_CTH_BARS", 0);
|
||||
gGameExternalOptions.iNewCTHBars = iniReader.ReadInteger("JA2 HAM Settings","NEW_BURST-AUTO_CTH_BARS", 0);
|
||||
|
||||
// HEADROCK HAM B2.6: Toggle whether AI checks for larger magazine when wanting to suppress at a distance
|
||||
gGameExternalOptions.fIncreaseAISuppressionFire = iniReader.ReadBoolean("JA2 HAM Settings","INCREASE_AI_WILLINGNESS_TO_SUPPRESS", FALSE);
|
||||
gGameExternalOptions.fIncreaseAISuppressionFire = iniReader.ReadBoolean("JA2 HAM Settings","INCREASE_AI_WILLINGNESS_TO_SUPPRESS", FALSE);
|
||||
|
||||
// HEADROCK HAM B2.7: Change the speed of skill progression. (defaults set to JA2 normal)
|
||||
gGameExternalOptions.ubHealthSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","HEALTH_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubHealthSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","HEALTH_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubStrengthSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","STRENGTH_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubDexteritySubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","DEXTERITY_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubAgilitySubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","AGILITY_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubWisdomSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","WISDOM_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubMarksmanshipSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MARKSMANSHIP_SUBPOINTS_TO_IMPROVE", 25));
|
||||
gGameExternalOptions.ubWisdomSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","WISDOM_SUBPOINTS_TO_IMPROVE", 50));
|
||||
gGameExternalOptions.ubMarksmanshipSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MARKSMANSHIP_SUBPOINTS_TO_IMPROVE", 25));
|
||||
gGameExternalOptions.ubMedicalSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MEDICAL_SUBPOINTS_TO_IMPROVE", 25));
|
||||
gGameExternalOptions.ubMechanicalSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MECHANICAL_SUBPOINTS_TO_IMPROVE", 25));
|
||||
gGameExternalOptions.ubExplosivesSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","EXPLOSIVES_SUBPOINTS_TO_IMPROVE", 25));
|
||||
gGameExternalOptions.ubLeadershipSubpointsToImprove = __max(1,iniReader.ReadInteger("JA2 HAM Settings","LEADERSHIP_SUBPOINTS_TO_IMPROVE", 25));
|
||||
gGameExternalOptions.ubLevelSubpointsToImprove = __max(1,__min(iniReader.ReadInteger("JA2 HAM Settings","LEVEL_SUBPOINTS_TO_IMPROVE", 350), 6500));
|
||||
gGameExternalOptions.ubLevelSubpointsToImprove = __max(1,__min(iniReader.ReadInteger("JA2 HAM Settings","LEVEL_SUBPOINTS_TO_IMPROVE", 350), 6500));
|
||||
|
||||
// HEADROCK HAM B2.7: When turned on, this will give a CTH approximation instead of an exact value, on CTH Bars and "F" key feedback.
|
||||
gGameExternalOptions.fApproximateCTH = iniReader.ReadBoolean("JA2 HAM Settings","APPROXIMATE_CTH", FALSE);
|
||||
gGameExternalOptions.fApproximateCTH = iniReader.ReadBoolean("JA2 HAM Settings","APPROXIMATE_CTH", FALSE);
|
||||
|
||||
// HEADROCK HAM B2.7: Augmented Roaming Militia code - turn this to TRUE to allow militia free travel through San Mona, Tixa, Orta, Omerta, and Estoni.
|
||||
gGameExternalOptions.fAllowMilitiaMoveThroughMinorCities = iniReader.ReadBoolean("JA2 HAM Settings","ALLOW_MILITIA_MOVE_THROUGH_MINOR_CITIES", FALSE);
|
||||
@@ -1064,32 +1108,32 @@ void LoadGameExternalOptions()
|
||||
gGameExternalOptions.fDiverseRoamingMilitiaGroups = iniReader.ReadBoolean("JA2 HAM Settings","DIVERSE_ROAMING_MILITIA_GROUPS", FALSE);
|
||||
|
||||
// HEADROCK HAM B2.8: This setting controls whether militia will try to join up into the largest groups they can, or average out the size of the groups to cover more territory.
|
||||
gGameExternalOptions.ubRoamingMilitiaSpreadsOutChance = iniReader.ReadInteger("JA2 HAM Settings","ROAMING_MILITIA_SPREADOUT_CHANCE", 0);
|
||||
gGameExternalOptions.ubRoamingMilitiaSpreadsOutChance = iniReader.ReadInteger("JA2 HAM Settings","ROAMING_MILITIA_SPREADOUT_CHANCE", 0);
|
||||
|
||||
// HEADROCK HAM B2.8: These are new cowering penalty divisors that help us determine how effective cowering is in different stances and when the shooter is targetting different bodyparts
|
||||
gGameExternalOptions.ubCoweringPenaltyDivisorProne = __max(1,iniReader.ReadInteger("JA2 HAM Settings","CTH_PENALTY_FOR_COWERING_PRONE_TARGET_DIVISOR", 1));
|
||||
gGameExternalOptions.ubCoweringPenaltyDivisorProne = __max(1,iniReader.ReadInteger("JA2 HAM Settings","CTH_PENALTY_FOR_COWERING_PRONE_TARGET_DIVISOR", 1));
|
||||
gGameExternalOptions.ubCoweringPenaltyDivisorCrouchedHead = __max(1,iniReader.ReadInteger("JA2 HAM Settings","CTH_PENALTY_FOR_COWERING_CROUCHED_TARGET_HEAD_DIVISOR", 3));
|
||||
gGameExternalOptions.ubCoweringPenaltyDivisorCrouchedTorso = __max(1,iniReader.ReadInteger("JA2 HAM Settings","CTH_PENALTY_FOR_COWERING_CROUCHED_TARGET_TORSO_DIVISOR", 4));
|
||||
gGameExternalOptions.ubCoweringPenaltyDivisorCrouchedLegs = __max(1,iniReader.ReadInteger("JA2 HAM Settings","CTH_PENALTY_FOR_COWERING_CROUCHED_TARGET_LEGS_DIVISOR", 5));
|
||||
|
||||
// HEADROCK HAM B2.8: This is the maximum range at which a target gives out the full CTH penalty for cowering. At lower range, it'll give proportionally less penalty.
|
||||
gGameExternalOptions.usMinRangeForFullCoweringPenalty = __max(10,iniReader.ReadInteger("JA2 HAM Settings","MIN_RANGE_FOR_FULL_COWERING_TARGET_PENALTY", 300));
|
||||
gGameExternalOptions.usMinRangeForFullCoweringPenalty = __max(10,iniReader.ReadInteger("JA2 HAM Settings","MIN_RANGE_FOR_FULL_COWERING_TARGET_PENALTY", 300));
|
||||
|
||||
// HEADROCK HAM B2.8: Absolute maximum CTH penalty from target/shooter cowering
|
||||
gGameExternalOptions.usMaxShooterCoweringPenalty = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MAX_SHOOTER_COWERING_PENALTY", 0));
|
||||
gGameExternalOptions.usMaxTargetCoweringPenalty = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MAX_TARGET_COWERING_PENALTY", 0));
|
||||
gGameExternalOptions.usMaxTargetCoweringPenalty = __max(1,iniReader.ReadInteger("JA2 HAM Settings","MAX_TARGET_COWERING_PENALTY", 0));
|
||||
|
||||
// HEADROCK HAM B2.8: If this is turned on, Militia will drop their equipment similar to enemies, IF killed by non-player character.
|
||||
gGameExternalOptions.ubMilitiaDropEquipment = iniReader.ReadInteger("JA2 HAM Settings","MILITIA_DROP_EQUIPMENT", 0);
|
||||
gGameExternalOptions.ubMilitiaDropEquipment = iniReader.ReadInteger("JA2 HAM Settings","MILITIA_DROP_EQUIPMENT", 0);
|
||||
|
||||
// HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainees will go to sleep when their trainer goes to sleep. 3 = Trainer will go to sleep if all trainees are asleep. 1 = Both. 0 = Neither.
|
||||
gGameExternalOptions.ubSmartTrainingSleep = iniReader.ReadInteger("JA2 HAM Settings","SMART_TRAINING-SLEEP_HANDLER", 0);
|
||||
gGameExternalOptions.ubSmartTrainingSleep = iniReader.ReadInteger("JA2 HAM Settings","SMART_TRAINING-SLEEP_HANDLER", 0);
|
||||
|
||||
// HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainees will wake up when their trainer wakes up. 3 = Trainer will wake up if all trainees wake up. 1 = Both. 0 = Neither.
|
||||
gGameExternalOptions.ubSmartTrainingWake = iniReader.ReadInteger("JA2 HAM Settings","SMART_TRAINING-WAKE_HANDLER", 0);
|
||||
gGameExternalOptions.ubSmartTrainingWake = iniReader.ReadInteger("JA2 HAM Settings","SMART_TRAINING-WAKE_HANDLER", 0);
|
||||
|
||||
// HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainers will rest if no trainees available. 3 = Trainees will rest if no trainers available (not recommended). 1 = Both. 0 = Neither.
|
||||
gGameExternalOptions.ubSmartTrainingRest = iniReader.ReadInteger("JA2 HAM Settings","SMART_TRAINING_REST", 0);
|
||||
gGameExternalOptions.ubSmartTrainingRest = iniReader.ReadInteger("JA2 HAM Settings","SMART_TRAINING_REST", 0);
|
||||
}
|
||||
|
||||
INT16 DynamicAdjustAPConstants(INT16 iniReadValue, INT16 iniDefaultValue, BOOLEAN reverse)
|
||||
|
||||
@@ -189,7 +189,6 @@ typedef struct
|
||||
INT32 iIMPStartingLevelCostMultiplier;
|
||||
INT32 iBonusPointsForDisability;
|
||||
INT32 iBonusPointsPerSkillNotTaken;
|
||||
|
||||
INT32 iMaxMilitiaPerSector;
|
||||
INT32 iTrainingSquadSize;
|
||||
INT32 iMilitiaTrainingCost;
|
||||
|
||||
+4
-4
@@ -13,12 +13,12 @@
|
||||
#ifdef JA2EDITOR
|
||||
|
||||
//MAP EDITOR BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2949" };
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2918" };
|
||||
|
||||
#elif defined JA2BETAVERSION
|
||||
|
||||
//BETA/TEST BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2949" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2918" };
|
||||
|
||||
#elif defined CRIPPLED_VERSION
|
||||
|
||||
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
|
||||
#else
|
||||
|
||||
//RELEASE BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.2949" };
|
||||
CHAR16 zVersionLabel[256] = { L"Multiplayer v1.1" };
|
||||
|
||||
#endif
|
||||
|
||||
CHAR8 czVersionNumber[16] = { "Build 09.06.04" }; //YY.MM.DD
|
||||
CHAR8 czVersionNumber[16] = { "Build 09.06.01" }; //YY.MM.DD
|
||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0};
|
||||
extern INT16 gubMaxActionPoints[28];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08
|
||||
extern BOOLEAN GetCDromDriveLetter( STR8 pString );
|
||||
|
||||
#include "PostalService.h"
|
||||
extern CPostalService gPostalService;
|
||||
|
||||
// The InitializeGame function is responsible for setting up all data and Gaming Engine
|
||||
// tasks which will run the game
|
||||
|
||||
@@ -119,6 +122,33 @@ static void AddLanguagePrefix(STR fileName, const STR language)
|
||||
memmove( fileComponent, language, strlen( language) );
|
||||
}
|
||||
|
||||
static void AddLanguagePrefix(STR fileName)
|
||||
{
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
AddLanguagePrefix( fileName, DUTCH_PREFIX);
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
AddLanguagePrefix( fileName, POLISH_PREFIX);
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
AddLanguagePrefix( fileName, FRENCH_PREFIX);
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
AddLanguagePrefix( fileName, ITALIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
AddLanguagePrefix( fileName, TAIWANESE_PREFIX);
|
||||
#endif
|
||||
#ifdef CHINESE
|
||||
AddLanguagePrefix( fileName, CHINESE_PREFIX);
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
{
|
||||
@@ -128,32 +158,27 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYMISCDROPSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInEnemyMiscDropsStats(gEnemyMiscDrops, fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInEnemyMiscDropsStats(gEnemyMiscDrops, fileName), ENEMYMISCDROPSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYEXPLOSIVEDROPSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInEnemyExplosiveDropsStats(gEnemyExplosiveDrops, fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInEnemyExplosiveDropsStats(gEnemyExplosiveDrops, fileName),ENEMYEXPLOSIVEDROPSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYWEAPONDROPSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInEnemyWeaponDropsStats(gEnemyWeaponDrops, fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInEnemyWeaponDropsStats(gEnemyWeaponDrops, fileName),ENEMYWEAPONDROPSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYAMMODROPSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInEnemyAmmoDropsStats(gEnemyAmmoDrops, fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInEnemyAmmoDropsStats(gEnemyAmmoDrops, fileName),ENEMYAMMODROPSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYARMOURDROPSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInEnemyArmourDropsStats(gEnemyArmourDrops, fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInEnemyArmourDropsStats(gEnemyArmourDrops, fileName),ENEMYARMOURDROPSFILENAME);
|
||||
// WANNE: Enemy drops - end
|
||||
|
||||
// WANNE: Sector Loadscreens [2007-05-18]
|
||||
@@ -163,8 +188,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInSectorLoadscreensStats(gSectorLoadscreens, fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInSectorLoadscreensStats(gSectorLoadscreens, fileName),SECTORLOADSCREENSFILENAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -176,8 +200,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, AMMOTYPESFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInAmmoTypeStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInAmmoTypeStats(fileName),AMMOTYPESFILENAME);
|
||||
|
||||
//Madd: Simple Localization
|
||||
//Read in the correct ammostring file for the given language
|
||||
@@ -213,8 +236,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
//CHRISL: If we fail to load, try loading just the default english
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, AMMOFILENAME);
|
||||
if(!ReadInAmmoStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(!ReadInAmmoStats(fileName),AMMOFILENAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,15 +244,13 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, BURSTSOUNDSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInBurstSoundArray(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInBurstSoundArray(fileName),BURSTSOUNDSFILENAME);
|
||||
// Lesh: end
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ITEMSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInItemStats(fileName,FALSE))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInItemStats(fileName,FALSE),ITEMSFILENAME);
|
||||
|
||||
//Madd: Simple localization
|
||||
// The idea here is that we can have a separate xml file that's named differently
|
||||
@@ -241,31 +261,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
// So for instance, the german file would be called German.Items.xml and would only contain
|
||||
// the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags
|
||||
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
AddLanguagePrefix( fileName, DUTCH_PREFIX);
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
AddLanguagePrefix( fileName, POLISH_PREFIX);
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
AddLanguagePrefix( fileName, FRENCH_PREFIX);
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
AddLanguagePrefix( fileName, ITALIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
AddLanguagePrefix( fileName, TAIWANESE_PREFIX);
|
||||
#endif
|
||||
#ifdef CHINESE
|
||||
AddLanguagePrefix( fileName, CHINESE_PREFIX);
|
||||
#endif
|
||||
|
||||
#ifndef ENGLISH
|
||||
AddLanguagePrefix(fileName);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
@@ -279,97 +277,63 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, SOUNDSFILENAME);
|
||||
if(!ReadInSoundArray(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInSoundArray(fileName),SOUNDSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, MAGAZINESFILENAME);
|
||||
if(!ReadInMagazineStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInMagazineStats(fileName),MAGAZINESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ATTACHMENTSFILENAME);
|
||||
if(!ReadInAttachmentStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInAttachmentStats(fileName),ATTACHMENTSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ATTACHMENTINFOFILENAME);
|
||||
if(!ReadInAttachmentInfoStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInAttachmentInfoStats(fileName),ATTACHMENTINFOFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, LAUNCHABLESFILENAME);
|
||||
if(!ReadInLaunchableStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInLaunchableStats(fileName),LAUNCHABLESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, COMPATIBLEFACEITEMSFILENAME);
|
||||
if(!ReadInCompatibleFaceItemStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInCompatibleFaceItemStats(fileName),COMPATIBLEFACEITEMSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, MERGESFILENAME);
|
||||
if(!ReadInMergeStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInMergeStats(fileName),MERGESFILENAME);
|
||||
|
||||
//if(!WriteMergeStats())
|
||||
// return FALSE;
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ATTACHMENTCOMBOMERGESFILENAME);
|
||||
if(!ReadInAttachmentComboMergeStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInAttachmentComboMergeStats(fileName),ATTACHMENTCOMBOMERGESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, EXPLOSIVESFILENAME);
|
||||
if(!ReadInExplosiveStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInExplosiveStats(fileName),EXPLOSIVESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ARMOURSFILENAME);
|
||||
if(!ReadInArmourStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInArmourStats(fileName),ARMOURSFILENAME);
|
||||
|
||||
// CHRISL:
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, LOADBEARINGEQUIPMENTFILENAME);
|
||||
if(!ReadInlbeStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInlbeStats(fileName),LOADBEARINGEQUIPMENTFILENAME);
|
||||
|
||||
// CHRISL:
|
||||
LBEPocketType.clear();
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, LBEPOCKETFILENAME);
|
||||
if(!ReadInLBEPocketStats(fileName,FALSE))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInLBEPocketStats(fileName,FALSE),LBEPOCKETFILENAME);
|
||||
|
||||
//CHRISL: Simple localization
|
||||
// Same setup as what Madd used for items.xml
|
||||
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
AddLanguagePrefix( fileName, DUTCH_PREFIX);
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
AddLanguagePrefix( fileName, POLISH_PREFIX);
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
AddLanguagePrefix( fileName, FRENCH_PREFIX);
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
AddLanguagePrefix( fileName, ITALIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
AddLanguagePrefix( fileName, TAIWANESE_PREFIX);
|
||||
#endif
|
||||
#ifdef CHINESE
|
||||
AddLanguagePrefix( fileName, CHINESE_PREFIX);
|
||||
#endif
|
||||
#ifndef ENGLISH
|
||||
AddLanguagePrefix(fileName);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
@@ -381,142 +345,111 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
// CHRISL:
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, MERCSTARTINGGEARFILENAME);
|
||||
if(!ReadInMercStartingGearStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInMercStartingGearStats(fileName),MERCSTARTINGGEARFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, WEAPONSFILENAME);
|
||||
if(!ReadInWeaponStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInWeaponStats(fileName),WEAPONSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, INCOMPATIBLEATTACHMENTSFILENAME);
|
||||
if(!ReadInIncompatibleAttachmentStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInIncompatibleAttachmentStats(fileName),INCOMPATIBLEATTACHMENTSFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYGUNCHOICESFILENAME);
|
||||
if(!ReadInExtendedArmyGunChoicesStats (fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInExtendedArmyGunChoicesStats (fileName),ENEMYGUNCHOICESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ENEMYITEMCHOICESFILENAME);
|
||||
if(!ReadInArmyItemChoicesStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInArmyItemChoicesStats(fileName),ENEMYITEMCHOICESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, IMPITEMCHOICESFILENAME);
|
||||
if(!ReadInIMPItemChoicesStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInIMPItemChoicesStats(fileName),IMPITEMCHOICESFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, TONYINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gTonyInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gTonyInventory,fileName),TONYINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, DEVININVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gDevinInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gDevinInventory,fileName),DEVININVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, FRANZINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gFranzInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gFranzInventory,fileName),FRANZINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, KEITHINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gKeithInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gKeithInventory,fileName),KEITHINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, SAMINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gSamInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gSamInventory,fileName),SAMINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, JAKEINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gJakeInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gJakeInventory,fileName),JAKEINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, HOWARDINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gHowardInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gHowardInventory,fileName),HOWARDINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, GABBYINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gGabbyInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gGabbyInventory,fileName),GABBYINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, FRANKINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gFrankInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gFrankInventory,fileName),FRANKINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ELGININVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gElginInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gElginInventory,fileName),ELGININVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, MANNYINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gMannyInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gMannyInventory,fileName),MANNYINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, HERVEINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gHerveInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gHerveInventory,fileName),HERVEINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, PETERINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gPeterInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gPeterInventory,fileName),PETERINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ALBERTOINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gAlbertoInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gAlbertoInventory,fileName),ALBERTOINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, CARLOINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gCarloInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gCarloInventory,fileName),CARLOINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, MICKEYINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gMickyInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gMickyInventory,fileName),MICKEYINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ARNIEINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gArnieInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gArnieInventory,fileName),ARNIEINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, PERKOINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gPerkoInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gPerkoInventory,fileName),PERKOINVENTORYFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, FREDOINVENTORYFILENAME);
|
||||
if(!ReadInInventoryStats(gFredoInventory,fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInInventoryStats(gFredoInventory,fileName),FREDOINVENTORYFILENAME);
|
||||
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, CITYTABLEFILENAME);
|
||||
if(!ReadInMapStructure(fileName, FALSE))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME);
|
||||
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
AddLanguagePrefix( fileName, DUTCH_PREFIX);
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
AddLanguagePrefix( fileName, POLISH_PREFIX);
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
AddLanguagePrefix( fileName, FRENCH_PREFIX);
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
AddLanguagePrefix( fileName, ITALIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
AddLanguagePrefix( fileName, TAIWANESE_PREFIX);
|
||||
#endif
|
||||
#ifdef CHINESE
|
||||
AddLanguagePrefix( fileName, CHINESE_PREFIX);
|
||||
#endif
|
||||
#ifndef ENGLISH
|
||||
AddLanguagePrefix(fileName);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
@@ -532,90 +465,57 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
// Lesh: load altsectors list
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ALTSECTORSFILENAME);
|
||||
if ( !ReadInAltSectors(fileName) )
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInAltSectors(fileName),ALTSECTORSFILENAME);
|
||||
|
||||
// Lesh: load samsites - must be after cities.xml
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, SAMSITESFILENAME);
|
||||
if ( !ReadInSAMInfo(fileName) )
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInSAMInfo(fileName),SAMSITESFILENAME);
|
||||
|
||||
// Lesh: army externalization
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, GARRISONFILENAME);
|
||||
if ( !ReadInGarrisonInfo(fileName) )
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInGarrisonInfo(fileName),GARRISONFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, PATROLFILENAME);
|
||||
if ( !ReadInPatrolInfo(fileName) )
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInPatrolInfo(fileName),PATROLFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, COMPOSITIONFILENAME);
|
||||
if ( !ReadInArmyCompositionInfo(fileName) )
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInArmyCompositionInfo(fileName),COMPOSITIONFILENAME);
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, EXPLOSIONDATAFILENAME);
|
||||
if(!ReadInExplosionDataStats(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInExplosionDataStats(fileName),EXPLOSIONDATAFILENAME);
|
||||
|
||||
// Kaiden: Read in Restricted Sectors for Mobile Militia
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, ROAMINGMILITIAFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInRoamingInfo(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInRoamingInfo(fileName),ROAMINGMILITIAFILENAME);
|
||||
|
||||
// Dealtar: Read in shipping destinations and delivery methods
|
||||
gPostalService.Clear();
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, SHIPPINGDESTINATIONSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInShippingDestinations(fileName, FALSE))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME);
|
||||
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef DUTCH
|
||||
AddLanguagePrefix( fileName, DUTCH_PREFIX);
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
AddLanguagePrefix( fileName, POLISH_PREFIX);
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
AddLanguagePrefix( fileName, FRENCH_PREFIX);
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
AddLanguagePrefix( fileName, ITALIAN_PREFIX);
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
AddLanguagePrefix( fileName, TAIWANESE_PREFIX);
|
||||
#endif
|
||||
#ifdef CHINESE
|
||||
AddLanguagePrefix( fileName, CHINESE_PREFIX);
|
||||
#endif
|
||||
#ifndef ENGLISH
|
||||
AddLanguagePrefix(fileName);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInShippingDestinations(fileName, TRUE))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInShippingDestinations(fileName, TRUE),SHIPPINGDESTINATIONSFILENAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
strcpy(fileName, directoryName);
|
||||
strcat(fileName, DELIVERYMETHODSFILENAME);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInDeliveryMethods(fileName))
|
||||
return FALSE;
|
||||
THROWIFFALSE(ReadInDeliveryMethods(fileName),DELIVERYMETHODSFILENAME);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -632,10 +532,11 @@ UINT32 InitializeJA2(void)
|
||||
gfWorldLoaded = FALSE;
|
||||
|
||||
//Load external game mechanic data
|
||||
if ( !LoadExternalGameplayData(TABLEDATA_DIRECTORY))
|
||||
{
|
||||
return( ERROR_SCREEN );
|
||||
}
|
||||
//if ( !LoadExternalGameplayData(TABLEDATA_DIRECTORY))
|
||||
//{
|
||||
// return( ERROR_SCREEN );
|
||||
//}
|
||||
TRYCATCH_RETHROW(LoadExternalGameplayData(TABLEDATA_DIRECTORY),L"Loading external data failed");
|
||||
|
||||
// Load external text
|
||||
LoadAllExternalText();
|
||||
|
||||
+13
-1
@@ -51,6 +51,8 @@
|
||||
#include "fresh_header.h"
|
||||
#include "Encrypted File.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
//
|
||||
//****** Defines ******
|
||||
//
|
||||
@@ -1252,7 +1254,17 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID)
|
||||
|
||||
pItem = &Item[ usItem ];
|
||||
GetVideoObject( &hVObject, GetInterfaceGraphicForItem( pItem ) );
|
||||
pTrav = &(hVObject->pETRLEObject[ pItem->ubGraphicNum ] );
|
||||
if(pItem->ubGraphicNum < hVObject->usNumberOfObjects)
|
||||
{
|
||||
pTrav = &(hVObject->pETRLEObject[ pItem->ubGraphicNum ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"Number of images in VObject [" << hVObject->usNumberOfObjects
|
||||
<< L"] is smaller than the requested index [" << (int)pItem->ubGraphicNum << L"]";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
}
|
||||
|
||||
usHeight = (UINT32)pTrav->usHeight;
|
||||
usWidth = (UINT32)pTrav->usWidth;
|
||||
|
||||
@@ -186,7 +186,6 @@ extern MOUSE_REGION *gSelectedScrollAreaDropDownRegion;
|
||||
extern void BobbyRDeliveryCallback(RefToCShipmentManipulator ShipmentManipulator);
|
||||
//End Dealtar's Airport Externalization.
|
||||
|
||||
|
||||
//Bobby's Sign menu mouse regions
|
||||
MOUSE_REGION gSelectedBobbiesSignMenuRegion[ BOBBIES_NUMBER_SIGNS ];
|
||||
void SelectBobbiesSignMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
|
||||
@@ -254,8 +253,6 @@ BOOLEAN EnterBobbyR()
|
||||
//gDestinationTable.resize(gPostalService.LookupDestinationList().size());
|
||||
}
|
||||
//End Dealtar's Airport Externalization.
|
||||
|
||||
|
||||
// an array of mouse regions for the bobbies signs. Top Left corner, bottom right corner
|
||||
UINT16 usMouseRegionPosArray[] = {BOBBIES_USED_SIGN_X, BOBBIES_USED_SIGN_Y, BOBBIES_USED_SIGN_X+BOBBIES_USED_SIGN_WIDTH, BOBBIES_USED_SIGN_Y+BOBBIES_USED_SIGN_HEIGHT,
|
||||
BOBBIES_MISC_SIGN_X, BOBBIES_MISC_SIGN_Y, BOBBIES_MISC_SIGN_X+BOBBIES_MISC_SIGN_WIDTH, BOBBIES_MISC_SIGN_Y+BOBBIES_MISC_SIGN_HEIGHT,
|
||||
|
||||
@@ -342,6 +342,7 @@ void BobbyRDeliveryCallback(RefToCShipmentManipulator ShipmentManipulator)
|
||||
{
|
||||
// ScreenMsg(FONT_MCOLOR_RED, MSG_DEBUG, L"Shipment from Bobby Ray has arrived at %s!", ShipmentManipulator.GetDestination().wstrName.c_str());
|
||||
gusCurShipmentDestinationID = ShipmentManipulator.GetDestination().usID;
|
||||
|
||||
// WANNE - MP: Do not send email notification from Bobby Ray in a multiplayer game
|
||||
if (!is_networked)
|
||||
AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
|
||||
@@ -1143,7 +1144,6 @@ void DisplayShippingCosts( BOOLEAN fCalledFromOrderPage, INT32 iSubTotal, UINT16
|
||||
default:
|
||||
usStandardCost = 0;
|
||||
}
|
||||
|
||||
iShippingCost = (INT32)( ( gpNewBobbyrShipments[ iOrderNum ].uiPackageWeight / (FLOAT)10 ) * usStandardCost + .5 );
|
||||
* Dealtar's Code: */
|
||||
UINT32 uiPackageWeight=0;
|
||||
@@ -1621,7 +1621,6 @@ void DrawSelectedCity( UINT8 ubCityNumber )
|
||||
*/
|
||||
if( gubCityAtTopOfList+guiNumOfDisplayedCities > (UINT8)gPostalService.LookupDestinationList().size() )
|
||||
gubCityAtTopOfList = gPostalService.LookupDestinationList().size() - guiNumOfDisplayedCities - 1;
|
||||
|
||||
|
||||
|
||||
//Display the list of cities
|
||||
@@ -1659,7 +1658,6 @@ void DrawSelectedCity( UINT8 ubCityNumber )
|
||||
DrawTextToScreen( (STR16)gDestinationTable[0]->wstrName.c_str(), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, (UINT16)(usPosY+5), 0, BOBBYR_DROPDOWN_FONT, BOBBYR_FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
else
|
||||
DrawTextToScreen( (STR16)gDestinationTable[ubCityNumber]->wstrName.c_str(), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, (UINT16)(usPosY+5), 0, BOBBYR_DROPDOWN_FONT, BOBBYR_FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
|
||||
SetFontShadow(DEFAULT_SHADOW);
|
||||
|
||||
@@ -2028,7 +2026,6 @@ UINT32 CalcCostFromWeightOfPackage( UINT8 ubTypeOfService )
|
||||
}
|
||||
*/
|
||||
usStandardCost = gPostalService.GetDestinationFee(ubTypeOfService, gDestinationTable[gbSelectedCity]->usID);
|
||||
|
||||
|
||||
//Get the actual weight ( either in lbs or metric )
|
||||
/// usStandardCost = (UINT16) GetWeightBasedOnMetricOption( usStandardCost );
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "text.h"
|
||||
#include "GameSettings.h"
|
||||
#include "IMP Disability Trait.h" // Added this one - SANDRO
|
||||
|
||||
#endif
|
||||
|
||||
#define STARTING_LEVEL_BOX_POS_X ( 51 )
|
||||
|
||||
@@ -4491,9 +4491,6 @@
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PostalService.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sirtech.cpp">
|
||||
<FileConfiguration
|
||||
@@ -4644,12 +4641,6 @@
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_DeliveryMethods.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_ShippingDestinations.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
@@ -4798,9 +4789,6 @@
|
||||
<File
|
||||
RelativePath="personnel.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PostalService.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sirtech.h">
|
||||
</File>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// WANNE - MP: Used for multiplayer
|
||||
#include "connect.h"
|
||||
#include "Strategic Event Handler.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/************************************************************************************/
|
||||
@@ -85,6 +86,7 @@ OBJECTTYPE CPostalService::tempObject;
|
||||
CPostalService::CPostalService()
|
||||
{
|
||||
}
|
||||
|
||||
void CPostalService::Clear()
|
||||
{
|
||||
_Shipments.clear();
|
||||
@@ -95,6 +97,7 @@ void CPostalService::Clear()
|
||||
_DeliveryMethods.clear();
|
||||
}
|
||||
|
||||
|
||||
UINT16 CPostalService::CreateNewShipment(UINT16 usDestinationID, UINT8 ubDeliveryMethodIndex, INT16 sSenderID)
|
||||
{
|
||||
if( usDestinationID > _UsedDestinationIDList.size() ||
|
||||
@@ -212,7 +215,7 @@ BOOLEAN CPostalService::SendShipment(UINT16 usShipmentID)
|
||||
}
|
||||
|
||||
SHIPMENT(sli).ShipmentStatus = SHIPMENT_INTRANSIT;
|
||||
|
||||
|
||||
if (is_networked)
|
||||
{
|
||||
if (is_client)
|
||||
@@ -548,6 +551,7 @@ BOOLEAN CPostalService::DeliverShipmentForMultiplayer(UINT16 usShipmentID)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN CPostalService::RegisterDeliveryCallback(INT16 sSenderID, PtrToDeliveryCallbackFunc DeliveryCallbackFunc)
|
||||
{
|
||||
if(sSenderID < - 1 || !DeliveryCallbackFunc)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "PostalService.h"
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
//static EmailPtr pEmailList;
|
||||
|
||||
+7
-4
@@ -424,7 +424,7 @@ void GameInitFinances()
|
||||
if( (FileExists( FINANCES_DATA_FILE ) ) )
|
||||
{
|
||||
FileClearAttributes( FINANCES_DATA_FILE );
|
||||
FileDelete( FINANCES_DATA_FILE );
|
||||
FileDelete( FINANCES_DATA_FILE );
|
||||
}
|
||||
GetBalanceFromDisk( );
|
||||
}
|
||||
@@ -1612,6 +1612,9 @@ void GetBalanceFromDisk( void )
|
||||
HWFILE hFileHandle;
|
||||
INT32 iBytesRead=0;
|
||||
|
||||
if(!FileExists(FINANCES_DATA_FILE))
|
||||
return;
|
||||
|
||||
// open file
|
||||
hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE );
|
||||
|
||||
@@ -1620,7 +1623,7 @@ void GetBalanceFromDisk( void )
|
||||
{
|
||||
LaptopSaveInfo.iCurrentBalance = 0;
|
||||
// close file
|
||||
FileClose( hFileHandle );
|
||||
FileClose( hFileHandle );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1708,8 +1711,8 @@ UINT32 ReadInLastElementOfFinanceListAndReturnIdNumber( void )
|
||||
// make sure file is more than balance size + length of 1 record - 1 byte
|
||||
if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) )
|
||||
{
|
||||
FileClose( hFileHandle );
|
||||
return 0;
|
||||
FileClose( hFileHandle );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// size is?
|
||||
|
||||
@@ -487,8 +487,8 @@ void ExitFloristOrderForm()
|
||||
RemoveButton( guiFlowerOrderGalleryButton );
|
||||
|
||||
//Store the text fields
|
||||
Get16BitStringFromField( 1, gsSentimentTextField );
|
||||
Get16BitStringFromField( 2, gsNameTextField );
|
||||
Get16BitStringFromField( 1, gsSentimentTextField, 75 );
|
||||
Get16BitStringFromField( 2, gsNameTextField, 35 );
|
||||
gbCurrentlySelectedCard = -1;
|
||||
|
||||
|
||||
@@ -1039,12 +1039,12 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode )
|
||||
//if its the personel sentiment field
|
||||
if( ubTextFieldID == 1 )
|
||||
{
|
||||
Get16BitStringFromField( ubTextFieldID, gsSentimentTextField );
|
||||
Get16BitStringFromField( ubTextFieldID, gsSentimentTextField, 75 );
|
||||
}
|
||||
else if( ubTextFieldID == 2 )
|
||||
{
|
||||
//else its the name field
|
||||
Get16BitStringFromField( ubTextFieldID, gsNameTextField );
|
||||
Get16BitStringFromField( ubTextFieldID, gsNameTextField, 35 );
|
||||
}
|
||||
|
||||
SetActiveField(0);
|
||||
@@ -1074,7 +1074,7 @@ BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode )
|
||||
|
||||
//disable the text entry fields
|
||||
// DisableAllTextFields();
|
||||
Get16BitStringFromField( 1, gsSentimentTextField );
|
||||
Get16BitStringFromField( 1, gsSentimentTextField, 75 );
|
||||
KillTextInputMode();
|
||||
|
||||
//disable the clear order and accept order buttons, (their rendering interferes with the drop down graphics)
|
||||
@@ -1267,12 +1267,12 @@ void HandleFloristOrderKeyBoardInput()
|
||||
//if its the personel sentiment field
|
||||
if( ubTextFieldID == 1 )
|
||||
{
|
||||
Get16BitStringFromField( ubTextFieldID, gsSentimentTextField );
|
||||
Get16BitStringFromField( ubTextFieldID, gsSentimentTextField, 75 );
|
||||
}
|
||||
else if( ubTextFieldID == 2 )
|
||||
{
|
||||
//else its the name field
|
||||
Get16BitStringFromField( ubTextFieldID, gsNameTextField );
|
||||
Get16BitStringFromField( ubTextFieldID, gsNameTextField, 35 );
|
||||
}
|
||||
|
||||
SetActiveField(0);
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
#include "LaptopSave.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "connect.h"
|
||||
|
||||
#define TOP_X LAPTOP_SCREEN_UL_X
|
||||
#define TOP_Y LAPTOP_SCREEN_UL_Y
|
||||
@@ -226,8 +226,8 @@ void GameInitHistory()
|
||||
FileDelete( HISTORY_DATA_FILE );
|
||||
}
|
||||
|
||||
AddHistoryToPlayersLog(HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO, 0, GetWorldTotalMin( ), -1, -1);
|
||||
|
||||
if (!is_networked)
|
||||
AddHistoryToPlayersLog(HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO, 0, GetWorldTotalMin( ), -1, -1);
|
||||
}
|
||||
|
||||
void EnterHistory()
|
||||
|
||||
@@ -578,7 +578,7 @@ void EnterPersonnel( void )
|
||||
InitVariables();
|
||||
|
||||
// Clear out the current team list
|
||||
for (unsigned idx=0; idx < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
for (unsigned idx=0; idx < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
currentTeamList[idx] = -1;
|
||||
}
|
||||
|
||||
|
||||
+62
-18
@@ -756,27 +756,71 @@ UINT32 MPChatScreenHandle( )
|
||||
|
||||
// carter, need key shortcuts for clearing up message boxes
|
||||
// Check for esc
|
||||
bool bHandled;
|
||||
while (DequeueEvent(&InputEvent) == TRUE)
|
||||
{
|
||||
if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN )
|
||||
bHandled = false;
|
||||
if(InputEvent.usEvent == KEY_DOWN )
|
||||
{
|
||||
if( ( InputEvent.usParam == ESC ) )
|
||||
{
|
||||
if( ( InputEvent.usParam == ESC ) || ( InputEvent.usParam == 'n') )
|
||||
{
|
||||
// Exit messagebox
|
||||
gChatBox.bHandled = MSG_BOX_RETURN_NO;
|
||||
memset(gszChatBoxInputString,0,sizeof(CHAR16)*255);
|
||||
}
|
||||
|
||||
if( InputEvent.usParam == ENTER )
|
||||
{
|
||||
// retrieve the string from the text box
|
||||
Get16BitStringFromField( 0, gszChatBoxInputString ); // these indexes are based on the order created
|
||||
// Exit messagebox
|
||||
gChatBox.bHandled = MSG_BOX_RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
// Exit messagebox
|
||||
gChatBox.bHandled = MSG_BOX_RETURN_NO;
|
||||
memset(gszChatBoxInputString,0,sizeof(CHAR16)*255);
|
||||
bHandled = true;
|
||||
}
|
||||
|
||||
if( InputEvent.usParam == ENTER )
|
||||
{
|
||||
// retrieve the string from the text box
|
||||
Get16BitStringFromField( 0, gszChatBoxInputString, 255 ); // these indexes are based on the order created
|
||||
// Exit messagebox
|
||||
gChatBox.bHandled = MSG_BOX_RETURN_OK;
|
||||
bHandled = true;
|
||||
}
|
||||
|
||||
// OJW - 20090403 - add better key control
|
||||
UINT8 ubDesiredMessageIndex;
|
||||
UINT8 ubNumMessages;
|
||||
|
||||
ubNumMessages = GetRangeOfChatLogMessages();
|
||||
|
||||
if ( ubNumMessages > MAX_CHATLOG_MESSAGES )
|
||||
{
|
||||
if (InputEvent.usParam == PGUP)
|
||||
{
|
||||
//move up a page
|
||||
ChatScreenMsgScrollUp( MAX_CHATLOG_MESSAGES );
|
||||
bHandled = true;
|
||||
}
|
||||
|
||||
if (InputEvent.usParam == PGDN)
|
||||
{
|
||||
// move down a page
|
||||
ChatScreenMsgScrollDown( MAX_CHATLOG_MESSAGES );
|
||||
bHandled = true;
|
||||
}
|
||||
|
||||
if (InputEvent.usParam == HOME)
|
||||
{
|
||||
// move to the beginning
|
||||
ChangeCurrentChatScreenMessageIndex( 0 );
|
||||
bHandled = true;
|
||||
}
|
||||
|
||||
if (InputEvent.usParam == END)
|
||||
{
|
||||
// move to end
|
||||
ubDesiredMessageIndex = ubNumMessages - MAX_CHATLOG_MESSAGES;
|
||||
ChangeCurrentChatScreenMessageIndex( ubDesiredMessageIndex );
|
||||
bHandled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send to text box
|
||||
if (!bHandled)
|
||||
HandleTextInput( &InputEvent );
|
||||
}
|
||||
|
||||
if ( gChatBox.bHandled )
|
||||
@@ -839,7 +883,7 @@ void OKChatBoxCallback(GUI_BUTTON *btn, INT32 reason )
|
||||
// OK, exit
|
||||
gChatBox.bHandled = MSG_BOX_RETURN_OK;
|
||||
// retrieve the string from the text box
|
||||
Get16BitStringFromField( 0, gszChatBoxInputString ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 0, gszChatBoxInputString, 255 ); // these indexes are based on the order created
|
||||
}
|
||||
else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
|
||||
{
|
||||
|
||||
@@ -12,6 +12,8 @@ extern BOOLEAN gbChatSendToAll;
|
||||
extern MESSAGE_BOX_STRUCT gChatBox;
|
||||
extern BOOLEAN gfInChatBox;
|
||||
|
||||
#define CHAT_FONT_COLOR 208 // WHITE
|
||||
|
||||
////////////////////////////////
|
||||
// ubStyle: Determines the look of graphics including buttons
|
||||
// zString: 16-bit string
|
||||
|
||||
@@ -0,0 +1,526 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "JA2 All.h"
|
||||
#include "Intro.h"
|
||||
#else
|
||||
#include "Types.h"
|
||||
#include "MPConnectScreen.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Utilities.h"
|
||||
#include "wCheck.h"
|
||||
#include "Font Control.h"
|
||||
#include "WordWrap.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "Input.h"
|
||||
#include "Options Screen.h"
|
||||
#include "English.h"
|
||||
#include "Sysutil.h"
|
||||
#include "Fade Screen.h"
|
||||
#include "Cursor Control.h"
|
||||
#include "Music Control.h"
|
||||
#include "cursors.h"
|
||||
#include "Intro.h"
|
||||
#include "Text.h"
|
||||
#include "Text Input.h"
|
||||
#include "_Ja25EnglishText.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "Loading Screen.h"
|
||||
#include "Animated ProgressBar.h"
|
||||
#include "mainmenuscreen.h"
|
||||
#endif
|
||||
|
||||
#include "gameloop.h"
|
||||
#include "Game Init.h"
|
||||
#include "connect.h"
|
||||
#include "network.h" // for client name
|
||||
#include "saveloadscreen.h"
|
||||
#include "message.h"
|
||||
#include "init.h"
|
||||
#include "xml.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Defines
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
#define MPC_TITLE_FONT FONT14ARIAL//FONT16ARIAL
|
||||
#define MPC_TITLE_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
#define MPC_SUBHEADING_FONT FONT12ARIAL//FONT16ARIAL
|
||||
#define MPC_SUBHEADING_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
//buttons
|
||||
#define MPC_BTN_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2)
|
||||
#define MPC_BTN_CANCEL_Y iScreenHeightOffset + SCREEN_HEIGHT - 50
|
||||
|
||||
//main title
|
||||
#define MPC_MAIN_TITLE_X 0
|
||||
#define MPC_MAIN_TITLE_Y iScreenHeightOffset + 10
|
||||
#define MPC_MAIN_TITLE_WIDTH SCREEN_WIDTH
|
||||
|
||||
//subtitle
|
||||
#define MPC_SUBHEADING_X 0
|
||||
#define MPC_SUBHEADING_Y MPC_MAIN_TITLE_Y + 30
|
||||
#define MPC_SUBHEADING_WIDTH SCREEN_WIDTH
|
||||
|
||||
//help
|
||||
#define MPC_HELP_X 0
|
||||
#define MPC_HELP_Y MPC_SUBHEADING_Y + 30
|
||||
#define MPC_HELP_WIDTH SCREEN_WIDTH
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
BOOLEAN gfMPCScreenEntry = TRUE;
|
||||
BOOLEAN gfMPCScreenExit = FALSE;
|
||||
BOOLEAN gfReRenderMPCScreen=TRUE;
|
||||
BOOLEAN gfMPCButtonsAllocated = FALSE;
|
||||
BOOLEAN gfMPConnectScreenCanContinue = FALSE;
|
||||
|
||||
//enum for different states of screen
|
||||
enum
|
||||
{
|
||||
MPC_NOTHING,
|
||||
MPC_CANCEL,
|
||||
MPC_CONTINUE,
|
||||
};
|
||||
|
||||
UINT8 gubMPCScreenHandler=MPC_NOTHING; // State changer for HandleMPCNScreen()
|
||||
|
||||
UINT32 gubMPCExitScreen = MP_CONNECT_SCREEN; // The screen that is in control next iteration of the game_loop
|
||||
|
||||
UINT8 loadscreenID = 0;
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Screen Controls
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Cancel Button
|
||||
void BtnMPCCancelCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPCCancelButton;
|
||||
INT32 giMPCCancelBtnImage;
|
||||
|
||||
UINT32 guiMPCMainBackGroundImage;
|
||||
|
||||
// Message Box handle
|
||||
INT8 giMPCMessageBox = -1;
|
||||
|
||||
// connect screen message
|
||||
CHAR16 gszConnectHeadingMsg[512];
|
||||
CHAR16 gszConnectSubMsg[512];
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Local Function Prototypes
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
extern void ClearMainMenu();
|
||||
|
||||
BOOLEAN EnterMPCScreen();
|
||||
BOOLEAN ExitMPCScreen();
|
||||
void HandleMPCScreen();
|
||||
BOOLEAN RenderMPCScreen();
|
||||
|
||||
void GetMPCScreenUserInput();
|
||||
void DoneFadeOutForExitMPCScreen( void );
|
||||
void DoneFadeInForExitMPCScreen( void );
|
||||
void CheckForContinue();
|
||||
|
||||
|
||||
UINT32 MPConnectScreenInit( void )
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
UINT32 MPConnectScreenHandle( void )
|
||||
{
|
||||
StartFrameBufferRender();
|
||||
|
||||
RestoreBackgroundRects( );
|
||||
|
||||
if( gfMPCScreenEntry )
|
||||
{
|
||||
// PauseGame();
|
||||
|
||||
EnterMPCScreen();
|
||||
gfMPCScreenEntry = FALSE;
|
||||
gfMPCScreenExit = FALSE;
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
// add scrolling string log
|
||||
ScrollString( );
|
||||
|
||||
|
||||
GetMPCScreenUserInput();
|
||||
|
||||
// connect to the server
|
||||
NetworkAutoStart();
|
||||
|
||||
// Check if we need to leave this screen
|
||||
CheckForContinue();
|
||||
|
||||
HandleMPCScreen();
|
||||
|
||||
// draw chat texts
|
||||
ExecuteVideoOverlays( );
|
||||
|
||||
SaveBackgroundRects();
|
||||
//InvalidateScreen();
|
||||
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
|
||||
// handle fades in and out
|
||||
if ( HandleFadeOutCallback( ) )
|
||||
{
|
||||
ClearMainMenu();
|
||||
return( gubMPCExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeOut( gubMPCExitScreen ) )
|
||||
{
|
||||
return( gubMPCExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleFadeInCallback( ) )
|
||||
{
|
||||
// Re-render the scene!
|
||||
RenderMPCScreen();
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeIn( gubMPCExitScreen ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if( gfMPCScreenExit ) // we are exiting this screen
|
||||
{
|
||||
ExitMPCScreen(); // perform destruction
|
||||
}
|
||||
|
||||
return( gubMPCExitScreen );
|
||||
} // end MPScoreScreenHandle()
|
||||
|
||||
UINT32 MPConnectScreenShutdown( void )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
BOOLEAN EnterMPCScreen()
|
||||
{
|
||||
// make sure only chat messages show up on connect screen
|
||||
ClearTacticalMessageQueue( );
|
||||
SetTacticalMessageFilter( MSG_CHAT );
|
||||
|
||||
gfMPConnectScreenCanContinue = FALSE;
|
||||
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
if( gfMPCButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
|
||||
|
||||
// load the Main trade screen backgroiund image
|
||||
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
|
||||
if (iResolution == 0)
|
||||
{
|
||||
FilenameForBPP("LOADSCREENS\\LS_DayOmerta.sti",VObjectDesc.ImageFile);
|
||||
}
|
||||
else if (iResolution == 1)
|
||||
{
|
||||
FilenameForBPP("LOADSCREENS\\LS_DayOmerta_800x600.sti",VObjectDesc.ImageFile);
|
||||
}
|
||||
else if (iResolution == 2)
|
||||
{
|
||||
FilenameForBPP("LOADSCREENS\\LS_DayOmerta_1024x768.sti",VObjectDesc.ImageFile);
|
||||
}
|
||||
CHECKF(AddVideoObject(&VObjectDesc, &guiMPCMainBackGroundImage ));
|
||||
|
||||
|
||||
CreateLoadingScreenProgressBar();
|
||||
// default to red connecting color
|
||||
SetProgressBarColor(0,150,0,0);
|
||||
SetRelativeStartAndEndPercentage(0,0,100,L"");
|
||||
|
||||
//Cancel button
|
||||
/*giMPCCancelBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 );
|
||||
guiMPCCancelButton = CreateIconAndTextButton( giMPCCancelBtnImage, gzMPCScreenText[MPC_CANCEL_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPC_BTN_CANCEL_X, MPC_BTN_CANCEL_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPCCancelCallback);
|
||||
|
||||
SpecifyButtonSoundScheme( guiMPCCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
SpecifyDisabledButtonStyle( guiMPCCancelButton, DISABLED_STYLE_NONE );*/
|
||||
|
||||
//Reset the exit screen - screen the main game loop will call next iteration
|
||||
gubMPCExitScreen = MP_CONNECT_SCREEN;
|
||||
|
||||
//REnder the screen once so we can blt ot to ths save buffer
|
||||
RenderMPCScreen();
|
||||
|
||||
BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gfMPCButtonsAllocated = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
} // End of EnterMPSScreen()
|
||||
|
||||
|
||||
BOOLEAN ExitMPCScreen()
|
||||
{
|
||||
RemoveTacticalMessageFilter();
|
||||
|
||||
if( !gfMPCButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
//Delete the main options screen background
|
||||
DeleteVideoObjectFromIndex( guiMPCMainBackGroundImage );
|
||||
RemoveProgressBar(0);
|
||||
|
||||
//RemoveButton( guiMPCCancelButton );
|
||||
//UnloadButtonImage( giMPCCancelBtnImage );
|
||||
|
||||
// exit text input mode in this screen and clean up text boxes
|
||||
//KillAllTextInputModes();
|
||||
SetTextInputCursor( CURSOR_IBEAM );
|
||||
|
||||
gfMPCButtonsAllocated = FALSE;
|
||||
|
||||
//If we are starting the game stop playing the music
|
||||
if( gubMPCScreenHandler == MPC_CONTINUE )
|
||||
SetMusicMode( MUSIC_NONE );
|
||||
|
||||
gfMPCScreenExit = FALSE;
|
||||
gfMPCScreenEntry = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
} // End of ExitMPJScreen()
|
||||
|
||||
|
||||
void HandleMPCScreen()
|
||||
{
|
||||
if( gubMPCScreenHandler != MPC_NOTHING )
|
||||
{
|
||||
switch( gubMPCScreenHandler )
|
||||
{
|
||||
case MPC_CANCEL:
|
||||
gubMPCExitScreen = MP_JOIN_SCREEN;
|
||||
gfMPCScreenExit = TRUE;
|
||||
|
||||
// disconnect the client
|
||||
client_disconnect();
|
||||
break;
|
||||
|
||||
case MPC_CONTINUE:
|
||||
{
|
||||
//if we are already fading out, get out of here
|
||||
if( gFadeOutDoneCallback != DoneFadeOutForExitMPCScreen )
|
||||
{
|
||||
//Disable the ok button
|
||||
DisableButton( guiMPCCancelButton );
|
||||
|
||||
gFadeOutDoneCallback = DoneFadeOutForExitMPCScreen;
|
||||
|
||||
FadeOutNextFrame( );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gubMPCScreenHandler = MPC_NOTHING;
|
||||
}
|
||||
|
||||
if( gfReRenderMPCScreen )
|
||||
{
|
||||
RenderMPCScreen();
|
||||
gfReRenderMPCScreen = FALSE;
|
||||
}
|
||||
|
||||
} // end of HandleMPCScreen
|
||||
|
||||
|
||||
BOOLEAN RenderMPCScreen()
|
||||
{
|
||||
HVOBJECT hPixHandle;
|
||||
|
||||
//Get the main background screen graphic and blt it
|
||||
GetVideoObject(&hPixHandle, guiMPCMainBackGroundImage );
|
||||
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,0,0, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
//DisplayLoadScreenWithID( loadscreenID );
|
||||
|
||||
//Shade the background
|
||||
//ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 );
|
||||
|
||||
UINT8 iProgress = 0;
|
||||
|
||||
if (is_connecting)
|
||||
{
|
||||
iProgress = (UINT8)(100 * (float)((MAX_CONNECT_RETRIES-(float)giNumTries)/MAX_CONNECT_RETRIES));
|
||||
SetProgressBarColor(0,150,0,0);
|
||||
|
||||
SetConnectScreenHeadingW(gzMPCScreenText[ MPC_CONNECTING_TEXT ]);
|
||||
}
|
||||
else if (is_connected)
|
||||
{
|
||||
if (!recieved_settings && !recieved_transfer_settings)
|
||||
{
|
||||
//Display the title
|
||||
SetConnectScreenHeadingW( gzMPCScreenText[ MPC_GETSETTINGS_TEXT ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (serverSyncClientsDirectory==1)
|
||||
{
|
||||
SetConnectScreenHeadingW( gzMPCScreenText[ MPC_DOWNLOADING_TEXT ]);
|
||||
SetProgressBarColor(0,0,0,150);
|
||||
iProgress = client_progress[CLIENT_NUM-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
SetConnectScreenHeadingW( gzMPCScreenText[ MPC_READY_TEXT ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Display the title
|
||||
DrawTextToScreen( gszConnectHeadingMsg, MPC_MAIN_TITLE_X, MPC_MAIN_TITLE_Y, MPC_MAIN_TITLE_WIDTH, MPC_TITLE_FONT, MPC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
InvalidateRegion(MPC_MAIN_TITLE_X,MPC_MAIN_TITLE_Y,MPC_MAIN_TITLE_WIDTH,MPC_MAIN_TITLE_Y+20);
|
||||
//Display the subheading
|
||||
DrawTextToScreen( gszConnectSubMsg, MPC_SUBHEADING_X, MPC_SUBHEADING_Y, MPC_SUBHEADING_WIDTH, MPC_SUBHEADING_FONT, MPC_SUBHEADING_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
InvalidateRegion(MPC_SUBHEADING_X,MPC_SUBHEADING_Y,MPC_MAIN_TITLE_WIDTH,MPC_SUBHEADING_Y+20);
|
||||
//Display the help text
|
||||
DrawTextToScreen( (is_connected && recieved_settings ? gzMPCScreenText[ MPC_HELP1_TEXT ] : gzMPCScreenText[MPC_HELP2_TEXT] ), MPC_HELP_X, MPC_HELP_Y, MPC_HELP_WIDTH, MPC_SUBHEADING_FONT, MPC_SUBHEADING_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
InvalidateRegion(MPC_HELP_X,MPC_HELP_Y,MPC_HELP_WIDTH,MPC_HELP_Y+20);
|
||||
|
||||
SetProgressBarRenderBuffer(0,FRAME_BUFFER);
|
||||
RenderProgressBar(0,iProgress);
|
||||
|
||||
return( TRUE );
|
||||
} // end of RenderMPCScreen()
|
||||
|
||||
|
||||
|
||||
void GetMPCScreenUserInput()
|
||||
{
|
||||
InputAtom Event;
|
||||
// POINT MousePos;
|
||||
|
||||
// GetCursorPos(&MousePos);
|
||||
|
||||
while( DequeueEvent( &Event ) )
|
||||
{
|
||||
// check if this event is swallowed by text input, otherwise process key
|
||||
if( Event.usEvent == KEY_DOWN )
|
||||
{
|
||||
switch( Event.usParam )
|
||||
{
|
||||
|
||||
case ESC:
|
||||
//Exit out of the screen
|
||||
gubMPCScreenHandler = MPC_CANCEL;
|
||||
break;
|
||||
case 'y':
|
||||
if (is_connected && recieved_settings)
|
||||
OpenChatMsgBox();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end of GetMPCScreenUserInput()
|
||||
|
||||
void DoneFadeOutForExitMPCScreen( void )
|
||||
{
|
||||
// ------------------------------------------
|
||||
// Now Initialize the client again with all the files from the "_MULTIPLAYER" profile!!!
|
||||
LoadExternalGameplayData(TABLEDATA_DIRECTORY);
|
||||
InitDependingGameStyleOptions();
|
||||
InitNewGame(false);
|
||||
|
||||
// Overwrite some client settings with values from the server (cash, ...)
|
||||
reapplySETTINGS();
|
||||
// ------------------------------------------
|
||||
|
||||
gubMPCExitScreen = MAP_SCREEN;
|
||||
ExitMPCScreen(); // cleanup please, if we called a fadeout then we didnt do it above
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void DoneFadeInForExitMPCScreen( void )
|
||||
{
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void BtnMPCCancelCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
gubMPCScreenHandler = MPC_CANCEL;
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SetConnectScreenHeadingW( STR16 cmsg )
|
||||
{
|
||||
wcscpy(gszConnectHeadingMsg,cmsg);
|
||||
gfReRenderMPCScreen=TRUE;
|
||||
}
|
||||
|
||||
void SetConnectScreenHeadingA( const char* cmsg )
|
||||
{
|
||||
CHAR16 converted[512];
|
||||
MultiByteToWideChar( CP_UTF8, 0, cmsg, -1, (LPWSTR)converted, 512);
|
||||
SetConnectScreenHeadingW( converted );
|
||||
}
|
||||
|
||||
void SetConnectScreenSubMessageW( STR16 cmsg )
|
||||
{
|
||||
wcscpy(gszConnectSubMsg,cmsg);
|
||||
gfReRenderMPCScreen=TRUE;
|
||||
}
|
||||
|
||||
void SetConnectScreenSubMessageA( const char* cmsg )
|
||||
{
|
||||
CHAR16 converted[512];
|
||||
MultiByteToWideChar( CP_UTF8, 0, cmsg, -1, (LPWSTR)converted, 512);
|
||||
SetConnectScreenSubMessageW( converted );
|
||||
}
|
||||
|
||||
void CheckForContinue()
|
||||
{
|
||||
if (is_connected && is_client && recieved_settings)
|
||||
{
|
||||
if (serverSyncClientsDirectory == 1)
|
||||
{
|
||||
if (fClientReceivedAllFiles)
|
||||
gubMPCScreenHandler = MPC_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gubMPCScreenHandler = MPC_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef _MP_CONNECT_SCREEN_H_
|
||||
#define _MP_CONNECT_SCREEN_H_
|
||||
|
||||
|
||||
UINT32 MPConnectScreenInit( void );
|
||||
UINT32 MPConnectScreenHandle( void );
|
||||
UINT32 MPConnectScreenShutdown( void );
|
||||
|
||||
void SetConnectScreenHeadingW( STR16 cmsg );
|
||||
void SetConnectScreenHeadingA( const char* cmsg );
|
||||
void SetConnectScreenSubMessageW( STR16 cmsg );
|
||||
void SetConnectScreenSubMessageA( const char* cmsg );
|
||||
|
||||
#endif
|
||||
+376
-86
@@ -30,6 +30,14 @@
|
||||
#include "network.h" // for client name
|
||||
#include "saveloadscreen.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_init.h"
|
||||
#include "VFS/PropertyContainer.h"
|
||||
#include "VFS/iteratedir.h"
|
||||
#include "MPJoinScreen.h"
|
||||
#include "MainMenuScreen.h"
|
||||
#include "Init.h"
|
||||
#include "xml.h"
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
@@ -79,6 +87,10 @@
|
||||
#define MPH_TXT_TIMER_Y MPH_TXT_DMG_Y + MPH_TXT_DMG_HEIGHT + 13
|
||||
#define MPH_TXT_TIMER_WIDTH 60
|
||||
#define MPH_TXT_TIMER_HEIGHT 17
|
||||
#define MPH_TXT_FILE_TRANSFER_DIR_X iScreenWidthOffset + 100
|
||||
#define MPH_TXT_FILE_TRANSFER_DIR_Y MPH_TXT_TIMER_Y + MPH_TXT_TIMER_HEIGHT + 13
|
||||
#define MPH_TXT_FILE_TRANSFER_DIR_WIDTH 200
|
||||
#define MPH_TXT_FILE_TRANSFER_DIR_HEIGHT 17
|
||||
|
||||
|
||||
|
||||
@@ -116,6 +128,10 @@
|
||||
#define MPH_LABEL_TIMER_Y MPH_TXT_TIMER_Y + 3
|
||||
#define MPH_LABEL_TIMER_WIDTH 80
|
||||
#define MPH_LABEL_TIMER_HEIGHT 17
|
||||
#define MPH_LABEL_FILE_TRANSFER_DIR_X MPH_TXT_FILE_TRANSFER_DIR_X - 80
|
||||
#define MPH_LABEL_FILE_TRANSFER_DIR_Y MPH_TXT_FILE_TRANSFER_DIR_Y + 3
|
||||
#define MPH_LABEL_FILE_TRANSFER_DIR_WIDTH 80
|
||||
#define MPH_LABEL_FILE_TRANSFER_DIR_HEIGHT 17
|
||||
|
||||
//radio box locations
|
||||
#define MPH_GAP_BN_SETTINGS 35
|
||||
@@ -131,8 +147,12 @@
|
||||
#define MPH_GAMETYPE_SETTINGS_Y iScreenHeightOffset + 75
|
||||
#define MPH_GAMETYPE_SETTINGS_WIDTH MPH_OFFSET_TO_TOGGLE_BOX - MPH_OFFSET_TO_TEXT
|
||||
|
||||
#define MPH_OVERRIDEMAXAI_X MPH_DIF_SETTINGS_X
|
||||
#define MPH_OVERRIDEMAXAI_Y MPH_TXT_SVRNAME_Y
|
||||
#define MPH_OVERRIDEMAXAI_WIDTH MPH_OFFSET_TO_TOGGLE_BOX
|
||||
|
||||
#define MPH_RNDMERC_X MPH_DIF_SETTINGS_X
|
||||
#define MPH_RNDMERC_Y MPH_TXT_MAXPLAYERS_Y//iScreenHeightOffset+214
|
||||
#define MPH_RNDMERC_Y MPH_OVERRIDEMAXAI_Y + MPH_GAP_BN_SETTINGS - 5
|
||||
#define MPH_RNDMERC_WIDTH MPH_OFFSET_TO_TOGGLE_BOX
|
||||
|
||||
#define MPH_SAMEMERC_X MPH_DIF_SETTINGS_X
|
||||
@@ -159,14 +179,16 @@
|
||||
#define MPH_USENIV_Y MPH_CIVS_Y + MPH_GAP_BN_SETTINGS - 5
|
||||
#define MPH_USENIV_WIDTH MPH_OFFSET_TO_TOGGLE_BOX
|
||||
|
||||
#define MPH_SEND_FILES_X MPH_DIF_SETTINGS_X
|
||||
#define MPH_SEND_FILES_Y MPH_USENIV_Y + MPH_GAP_BN_SETTINGS - 5
|
||||
#define MPH_SEND_FILES_WIDTH MPH_OFFSET_TO_TOGGLE_BOX
|
||||
|
||||
//Difficulty settings
|
||||
enum
|
||||
{
|
||||
MPH_DIFF_EASY,
|
||||
MPH_DIFF_MED,
|
||||
MPH_DIFF_HARD,
|
||||
MPH_DIFF_INSANE,
|
||||
NUM_DIFF_SETTINGS,
|
||||
MPH_NUM_DIFF_SETTINGS,
|
||||
};
|
||||
|
||||
|
||||
@@ -200,17 +222,21 @@ UINT32 guiMPHMainBackGroundImage;
|
||||
CHAR16 gzServerNameField[ 30 ] = {0} ;
|
||||
CHAR16 gzMaxPlayersField[ 2 ] = {0} ;
|
||||
CHAR16 gzSquadSizeField[ 2 ] = {0} ;
|
||||
CHAR16 gzTimeOfDayField[ 5 ] = {0};
|
||||
CHAR16 gzTimeOfDayField[ 6 ] = {0};
|
||||
CHAR16 gzStartingBalanceField[ 10 ] = {0};
|
||||
INT16 giMPHTimeHours = 0;
|
||||
INT16 giMPHTimeMins = 0;
|
||||
CHAR16 gzDmgMultiplierField[ 5 ] = {0};
|
||||
CHAR16 gzTimerField[ 5 ] = {0};
|
||||
CHAR16 gzTimerField[ 6 ] = {0};
|
||||
CHAR16 gzFileTransferDirectory[ 100 ] = {0} ;
|
||||
CHAR16 gzKitBag[ 100 ] = {0};
|
||||
|
||||
UINT8 guiMPHGameType = MP_TYPE_DEATHMATCH; // default value
|
||||
UINT8 guiMPHDifficultLevel = DIF_LEVEL_HARD; // Expert
|
||||
|
||||
INT32 giMPHMessageBox = -1; // message box handle
|
||||
|
||||
INT giMPHOverrideMaxAI = 0;
|
||||
INT giMPHRandomMercs = 0;
|
||||
INT giMPHSameMercs = 0;
|
||||
INT giMPHReportMercs = 0;
|
||||
@@ -218,6 +244,7 @@ INT giMPHBobbyRays = 0;
|
||||
INT giMPHRandomSpawn = 0;
|
||||
INT giMPHEnableCivilians = 0;
|
||||
INT giMPHUseNIV = 0;
|
||||
INT giMPHSendFiles = 0;
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
@@ -237,13 +264,17 @@ UINT32 guiMPHCancelButton;
|
||||
INT32 giMPHCancelBtnImage;
|
||||
|
||||
//checkbox to toggle the Diff level
|
||||
UINT32 guiMPHDifficultySettingsToggles[ NUM_DIFF_SETTINGS ];
|
||||
UINT32 guiMPHDifficultySettingsToggles[ MPH_NUM_DIFF_SETTINGS ];
|
||||
void BtnMPHDifficultyTogglesCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
|
||||
//checkbox to toggle Game Type
|
||||
UINT32 guiMPHGameTypeToggles[ NUM_MP_GAMETYPE ];
|
||||
void BtnMPHGameTypeTogglesCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
|
||||
//checkbox for override max ai
|
||||
UINT32 guiMPHOverrideMaxAIToggle;
|
||||
void BtnMPHOverrideMaxAICallback(GUI_BUTTON *btn,INT32 reason);
|
||||
|
||||
//checkbox for merc options
|
||||
UINT32 guiMPHRandomMercsToggle;
|
||||
void BtnMPHRandomMercCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
@@ -272,6 +303,10 @@ void BtnMPHCivsCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPHUseNIVToggle;
|
||||
void BtnMPHUseNIVCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
|
||||
//checkbox for send files
|
||||
UINT32 guiMPHSendFiles;
|
||||
void BtnMPHSendFilesCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
@@ -303,10 +338,11 @@ void DoneFadeInForExitMPHScreen( void );
|
||||
|
||||
void SaveMPSettings()
|
||||
{
|
||||
Get16BitStringFromField( 0, gzServerNameField ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 1, gzMaxPlayersField );
|
||||
Get16BitStringFromField( 2, gzSquadSizeField );
|
||||
|
||||
Get16BitStringFromField( 0, gzServerNameField, 30 ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 1, gzMaxPlayersField, 2 );
|
||||
Get16BitStringFromField( 2, gzSquadSizeField, 2 );
|
||||
Get16BitStringFromField( 7, gzFileTransferDirectory, 100 );
|
||||
#ifndef USE_VFS
|
||||
// save settings to JA2_mp.ini
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_NAME", gzServerNameField, L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"MAX_CLIENTS", gzMaxPlayersField, L"..\\Ja2_mp.ini" );
|
||||
@@ -314,6 +350,9 @@ void SaveMPSettings()
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"STARTING_BALANCE", gzStartingBalanceField, L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"DAMAGE_MULTIPLIER", gzDmgMultiplierField, L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"TIMED_TURN_SECS_PER_TICK", gzTimerField, L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"FILE_TRANSFER_DIRECTORY", gzFileTransferDirectory , L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"KIT_BAG", gzKitBag , L"..\\Ja2_mp.ini" );
|
||||
|
||||
|
||||
|
||||
guiMPHGameType = GetMPHGameTypeButtonSetting();
|
||||
@@ -327,6 +366,10 @@ void SaveMPSettings()
|
||||
|
||||
CHAR16 tmpVal[2];
|
||||
|
||||
giMPHOverrideMaxAI = ( ButtonList[ guiMPHOverrideMaxAIToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHOverrideMaxAI,tmpVal,10);
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"OVERRIDE_MAX_AI", tmpVal, L"..\\Ja2_mp.ini" );
|
||||
|
||||
giMPHRandomMercs = ( ButtonList[ guiMPHRandomMercsToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHRandomMercs,tmpVal,10);
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"RANDOM_MERCS", tmpVal, L"..\\Ja2_mp.ini" );
|
||||
@@ -355,22 +398,89 @@ void SaveMPSettings()
|
||||
_itow(giMPHUseNIV,tmpVal,10);
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"ALLOW_CUSTOM_NIV", tmpVal, L"..\\Ja2_mp.ini" );
|
||||
|
||||
giMPHSendFiles = ( ButtonList[ guiMPHSendFiles ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHSendFiles,tmpVal,10);
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"SYNC_CLIENTS_MP_DIR", tmpVal, L"..\\Ja2_mp.ini" );
|
||||
guiMPHDifficultLevel = GetMPHCurrentDifficultyButtonSetting();
|
||||
CHAR16 tmpDiffStr[2];
|
||||
_itow(guiMPHDifficultLevel,tmpDiffStr,10);
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"DIFFICULT_LEVEL", tmpDiffStr, L"..\\Ja2_mp.ini" );
|
||||
#else
|
||||
CPropertyContainer props;
|
||||
props.InitFromIniFile("Ja2_mp.ini");
|
||||
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"SERVER_NAME", gzServerNameField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"MAX_CLIENTS", gzMaxPlayersField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"MAX_MERCS", gzSquadSizeField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"STARTING_BALANCE", gzStartingBalanceField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"DAMAGE_MULTIPLIER", gzDmgMultiplierField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"TIMED_TURN_SECS_PER_TICK", gzTimerField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"FILE_TRANSFER_DIRECTORY", gzFileTransferDirectory);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"KIT_BAG", gzKitBag);
|
||||
|
||||
|
||||
guiMPHGameType = GetMPHGameTypeButtonSetting();
|
||||
CHAR16 tmpGTStr[2];
|
||||
_itow(guiMPHGameType,tmpGTStr,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"GAME_MODE", tmpGTStr);
|
||||
|
||||
CHAR16 tmpTimeStr[6];
|
||||
swprintf(tmpTimeStr,L"%i.%i",giMPHTimeHours,giMPHTimeMins);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"TIME", tmpTimeStr);
|
||||
|
||||
CHAR16 tmpVal[2];
|
||||
|
||||
giMPHOverrideMaxAI = ( ButtonList[ guiMPHOverrideMaxAIToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHOverrideMaxAI,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"OVERRIDE_MAX_AI", tmpVal);
|
||||
|
||||
giMPHRandomMercs = ( ButtonList[ guiMPHRandomMercsToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHRandomMercs,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"RANDOM_MERCS", tmpVal);
|
||||
|
||||
giMPHSameMercs = ( ButtonList[ guiMPHSameMercToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHSameMercs,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"SAME_MERC", tmpVal);
|
||||
|
||||
giMPHBobbyRays = ( ButtonList[ guiMPHBobbyRayToggle ]->uiFlags & BUTTON_CLICKED_ON ? 0 : 1 ); // This setting is reversed
|
||||
_itow(giMPHBobbyRays,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"DISABLE_BOBBY_RAYS", tmpVal);
|
||||
|
||||
giMPHReportMercs = ( ButtonList[ guiMPHReportMercToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHReportMercs,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"REPORT_NAME", tmpVal);
|
||||
|
||||
giMPHRandomSpawn = ( ButtonList[ guiMPHRandomSpawnToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHRandomSpawn,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"RANDOM_EDGES", tmpVal);
|
||||
|
||||
giMPHEnableCivilians = ( ButtonList[ guiMPHCivsToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHEnableCivilians,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"CIV_ENABLED", tmpVal);
|
||||
|
||||
giMPHUseNIV = ( ButtonList[ guiMPHUseNIVToggle ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHUseNIV,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"ALLOW_CUSTOM_NIV", tmpVal);
|
||||
|
||||
giMPHSendFiles = ( ButtonList[ guiMPHSendFiles ]->uiFlags & BUTTON_CLICKED_ON ? 1 : 0 );
|
||||
_itow(giMPHSendFiles,tmpVal,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"SYNC_CLIENTS_MP_DIR", tmpVal);
|
||||
|
||||
guiMPHDifficultLevel = GetMPHCurrentDifficultyButtonSetting();
|
||||
CHAR16 tmpDiffStr[2];
|
||||
_itow(guiMPHDifficultLevel,tmpDiffStr,10);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"DIFFICULT_LEVEL", tmpDiffStr);
|
||||
props.WriteToIniFile(L"Ja2_mp.ini",true); // This writes to the Profiles/UserProfile/ja2_mp.ini
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*if ( ButtonList[ guiMPHRandomSpawnToggle ]->uiFlags & BUTTON_CLICKED_ON )
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"RANDOM_EDGES", L"1", L"..\\Ja2_mp.ini" );
|
||||
else
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"RANDOM_EDGES", L"0", L"..\\Ja2_mp.ini" );*/
|
||||
|
||||
// save game difficulty setting
|
||||
gGameOptions.ubDifficultyLevel = GetMPHCurrentDifficultyButtonSetting();
|
||||
}
|
||||
|
||||
bool ValidateMPSettings()
|
||||
{
|
||||
// Check a Server name is entered
|
||||
Get16BitStringFromField( 0, gzServerNameField ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 0, gzServerNameField, 30 ); // these indexes are based on the order created
|
||||
if (wcscmp(gzServerNameField,L"")<=0)
|
||||
{
|
||||
DoMPHMessageBox( MSG_BOX_BASIC_STYLE, gzMPHScreenText[MPH_SERVERNAME_INVALID], MP_HOST_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
@@ -378,7 +488,7 @@ bool ValidateMPSettings()
|
||||
}
|
||||
|
||||
// Verify the Max Players
|
||||
Get16BitStringFromField( 1, gzMaxPlayersField );
|
||||
Get16BitStringFromField( 1, gzMaxPlayersField, 2 );
|
||||
UINT8 numPlayers = _wtoi(gzMaxPlayersField);
|
||||
if (numPlayers < 2 || numPlayers > 4)
|
||||
{
|
||||
@@ -387,46 +497,61 @@ bool ValidateMPSettings()
|
||||
}
|
||||
|
||||
// Verify the Squad Size
|
||||
Get16BitStringFromField( 2, gzSquadSizeField );
|
||||
Get16BitStringFromField( 2, gzSquadSizeField, 2 );
|
||||
UINT8 squadSize = _wtoi(gzSquadSizeField);
|
||||
if (squadSize < 1 || squadSize > 6)
|
||||
if (squadSize < 1 || squadSize > 5)
|
||||
{
|
||||
DoMPHMessageBox( MSG_BOX_BASIC_STYLE, gzMPHScreenText[MPH_SQUADSIZE_INVALID], MP_HOST_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
// verify the Time of Day
|
||||
Get16BitStringFromField( 3, gzTimeOfDayField );
|
||||
Get16BitStringFromField( 3, gzTimeOfDayField, 6 );
|
||||
wchar_t* tok;
|
||||
bool bTimeOK = true;
|
||||
int hours = 0;
|
||||
int mins = 0;
|
||||
|
||||
// strtok is destructive, make a copy to work on
|
||||
CHAR16 tmpTODStr[5];
|
||||
CHAR16 tmpTODStr[6];
|
||||
memcpy(tmpTODStr,gzTimeOfDayField,sizeof(CHAR16)*5);
|
||||
|
||||
tok = wcstok(tmpTODStr,L":");
|
||||
if (tok != NULL)
|
||||
{
|
||||
hours = _wtoi(tok);
|
||||
// check for invalid conversion, ie alpha chars
|
||||
// wtoi returns 0 if it cant convert, but we need this value
|
||||
// therefore if tok <> 0 then it was a bad convert.
|
||||
if (hours == 0 && wcscmp(tok,L"0") != 0)
|
||||
// Special case, because _wtoi() returns 0 if invalid number!
|
||||
if (wcscmp(tok, L"00") == 0)
|
||||
{
|
||||
// force error
|
||||
bTimeOK = false;
|
||||
hours = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
hours = _wtoi(tok);
|
||||
// check for invalid conversion, ie alpha chars
|
||||
// wtoi returns 0 if it cant convert, but we need this value
|
||||
// therefore if tok <> 0 then it was a bad convert.
|
||||
if (hours == 0 && wcscmp(tok,L"0") != 0)
|
||||
{
|
||||
// force error
|
||||
bTimeOK = false;
|
||||
}
|
||||
}
|
||||
|
||||
tok = wcstok(NULL,L".");
|
||||
if (tok != NULL)
|
||||
{
|
||||
mins = _wtoi(tok);
|
||||
if (mins == 0 && wcscmp(tok,L"0") != 0)
|
||||
if (wcsnlen(tok, 50) >= 2 && tok[0] == '0' && tok[1] == '0')
|
||||
{
|
||||
// force error
|
||||
bTimeOK = false;
|
||||
mins = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mins = _wtoi(tok);
|
||||
if (mins == 0 && wcscmp(tok,L"0") != 0)
|
||||
{
|
||||
// force error
|
||||
bTimeOK = false;
|
||||
}
|
||||
}
|
||||
|
||||
// fix for single digits
|
||||
@@ -459,7 +584,7 @@ bool ValidateMPSettings()
|
||||
|
||||
|
||||
// verify the Starting Balance
|
||||
Get16BitStringFromField( 4, gzStartingBalanceField );
|
||||
Get16BitStringFromField( 4, gzStartingBalanceField, 10 );
|
||||
UINT32 sBalance = _wtoi(gzStartingBalanceField);
|
||||
if (sBalance < 1)
|
||||
{
|
||||
@@ -467,7 +592,7 @@ bool ValidateMPSettings()
|
||||
return false;
|
||||
}
|
||||
|
||||
Get16BitStringFromField( 5, gzDmgMultiplierField );
|
||||
Get16BitStringFromField( 5, gzDmgMultiplierField, 5 );
|
||||
double fDmg = _wtof(gzDmgMultiplierField);
|
||||
if (fDmg <= 0.0f || fDmg >= 5.0f)
|
||||
{
|
||||
@@ -475,7 +600,7 @@ bool ValidateMPSettings()
|
||||
return false;
|
||||
}
|
||||
|
||||
Get16BitStringFromField( 6, gzTimerField );
|
||||
Get16BitStringFromField( 6, gzTimerField, 6 );
|
||||
UINT32 iTimer = _wtoi(gzTimerField);
|
||||
if (iTimer < 1 || iTimer > 200)
|
||||
{
|
||||
@@ -483,39 +608,105 @@ bool ValidateMPSettings()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify the File Transfer Directory
|
||||
Get16BitStringFromField( 7, gzFileTransferDirectory, 100 );
|
||||
if (wcscmp(gzFileTransferDirectory,L"")<=0)
|
||||
{
|
||||
DoMPHMessageBox( MSG_BOX_BASIC_STYLE, gzMPHScreenText[MPH_FILE_TRANSFER_DIR_INVALID], MP_HOST_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef USE_VFS
|
||||
vfs::Path sUserDir(gzFileTransferDirectory);
|
||||
if(!os::CreateRealDirecory(sUserDir,true))
|
||||
{
|
||||
DoMPHMessageBox( MSG_BOX_BASIC_STYLE, gzMPHScreenText[MPH_FILE_TRANSFER_DIR_NOT_EXIST], MP_HOST_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
//if (!bSkipSyncDir)
|
||||
//{
|
||||
#ifndef USE_VFS
|
||||
// Check if sync folder exists
|
||||
STRING512 syncDir;
|
||||
STRING512 executableDir;
|
||||
|
||||
GetExecutableDirectory(executableDir);
|
||||
sprintf(syncDir, "%s\\%S", executableDir, gzFileTransferDirectory);
|
||||
|
||||
if (!DirectoryExists(syncDir))
|
||||
{
|
||||
DoMPHMessageBox( MSG_BOX_BASIC_STYLE, gzMPHScreenText[MPH_FILE_TRANSFER_DIR_NOT_EXIST], MP_HOST_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
UINT32 MPHostScreenInit( void )
|
||||
{
|
||||
// this is wrong as ScreenInit is called at game start, but the settigs can change anytime
|
||||
// has be called in ScreenEnter for example
|
||||
std::vector<CHAR16> szTime(6,0);
|
||||
#ifndef USE_VFS
|
||||
// read settings from JA2_mp.ini
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_NAME", L"Mr Server", gzServerNameField, 30, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"MAX_CLIENTS", L"", gzMaxPlayersField, 2, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"MAX_MERCS", L"", gzSquadSizeField, 2 , L"..\\Ja2_mp.ini" );
|
||||
guiMPHGameType = GetPrivateProfileIntW( L"Ja2_mp Settings",L"GAME_MODE", MP_TYPE_DEATHMATCH, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"STARTING_BALANCE", L"9:30", gzStartingBalanceField, 10 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_NAME", L"Server Name", gzServerNameField, 30, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"MAX_CLIENTS", L"4", gzMaxPlayersField, 4, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"MAX_MERCS", L"5", gzSquadSizeField, 5 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"STARTING_BALANCE", L"25000", gzStartingBalanceField, 10 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"DAMAGE_MULTIPLIER", L"0.7", gzDmgMultiplierField, 5 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"TIMED_TURN_SECS_PER_TICK", L"100", gzTimerField, 5 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"TIMED_TURN_SECS_PER_TICK", L"25", gzTimerField, 5 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"FILE_TRANSFER_DIRECTORY", L"MULTIPLAYER/Servers/My Server", gzFileTransferDirectory, 100, L"..\\Ja2_mp.ini" );
|
||||
GetStringProperty( L"Ja2_mp Settings", L"KIT_BAG", L"[201,214,243]", kbag, 100, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"TIME", L"13.50", &szTime[0], 5 , L"..\\Ja2_mp.ini" );
|
||||
|
||||
giMPHOverrideMaxAI = GetPrivateProfileIntW( L"Ja2_mp Settings",L"OVERRIDE_MAX_AI", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHRandomMercs = GetPrivateProfileIntW( L"Ja2_mp Settings",L"RANDOM_MERCS", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHSameMercs = GetPrivateProfileIntW( L"Ja2_mp Settings",L"SAME_MERC", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHReportMercs = GetPrivateProfileIntW( L"Ja2_mp Settings",L"REPORT_NAME", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHSameMercs = GetPrivateProfileIntW( L"Ja2_mp Settings",L"SAME_MERC", 1, L"..\\Ja2_mp.ini" );
|
||||
giMPHReportMercs = GetPrivateProfileIntW( L"Ja2_mp Settings",L"REPORT_NAME", 1, L"..\\Ja2_mp.ini" );
|
||||
giMPHBobbyRays = GetPrivateProfileIntW( L"Ja2_mp Settings",L"DISABLE_BOBBY_RAYS", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHRandomSpawn = GetPrivateProfileIntW( L"Ja2_mp Settings",L"RANDOM_EDGES", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHEnableCivilians = GetPrivateProfileIntW( L"Ja2_mp Settings",L"CIV_ENABLED", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHUseNIV = GetPrivateProfileIntW( L"Ja2_mp Settings",L"ALLOW_CUSTOM_NIV", 0, L"..\\Ja2_mp.ini" );
|
||||
giMPHSendFiles = GetPrivateProfileIntW( L"Ja2_mp Settings",L"SYNC_CLIENTS_MP_DIR", 1, L"..\\Ja2_mp.ini" );
|
||||
guiMPHGameType = GetPrivateProfileIntW( L"Ja2_mp Settings",L"GAME_MODE", MP_TYPE_DEATHMATCH, L"..\\Ja2_mp.ini" );
|
||||
giMPHDifficultLevel = GetPrivateProfileIntW( L"Ja2_mp Settings",L"DIFFICULT_LEVEL", 2, L"..\\Ja2_mp.ini" );
|
||||
#else
|
||||
// read settings from JA2_mp.ini
|
||||
CPropertyContainer props;
|
||||
props.InitFromIniFile("Ja2_mp.ini");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"SERVER_NAME", gzServerNameField, 30, L"Server Name");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"MAX_CLIENTS", gzMaxPlayersField, 4, L"4");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"MAX_MERCS", gzSquadSizeField, 5, L"5");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"STARTING_BALANCE", gzStartingBalanceField, 10, L"25000");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"DAMAGE_MULTIPLIER", gzDmgMultiplierField, 5, L"0.7");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"TIMED_TURN_SECS_PER_TICK", gzTimerField, 5, L"25");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"FILE_TRANSFER_DIRECTORY", gzFileTransferDirectory, 100, L"MULTIPLAYER/Servers/My Server");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"KIT_BAG", gzKitBag, 100, L"[201,214,243]");
|
||||
props.GetStringProperty(L"Ja2_mp Settings", L"TIME", &szTime[0], 6, L"13.50");
|
||||
|
||||
|
||||
// read in time
|
||||
CHAR16 szTime[5];
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"TIME", L"13.50", szTime, 5 , L"..\\Ja2_mp.ini" );
|
||||
giMPHOverrideMaxAI = props.GetIntProperty( L"Ja2_mp Settings",L"OVERRIDE_MAX_AI", 0);
|
||||
giMPHRandomMercs = props.GetIntProperty( L"Ja2_mp Settings",L"RANDOM_MERCS", 0);
|
||||
giMPHSameMercs = props.GetIntProperty( L"Ja2_mp Settings",L"SAME_MERC", 1);
|
||||
giMPHReportMercs = props.GetIntProperty( L"Ja2_mp Settings",L"REPORT_NAME", 1);
|
||||
giMPHBobbyRays = props.GetIntProperty( L"Ja2_mp Settings",L"DISABLE_BOBBY_RAYS", 0);
|
||||
giMPHRandomSpawn = props.GetIntProperty( L"Ja2_mp Settings",L"RANDOM_EDGES", 0);
|
||||
giMPHEnableCivilians = props.GetIntProperty( L"Ja2_mp Settings",L"CIV_ENABLED", 0);
|
||||
giMPHUseNIV = props.GetIntProperty( L"Ja2_mp Settings",L"ALLOW_CUSTOM_NIV", 0);
|
||||
giMPHSendFiles = props.GetIntProperty( L"Ja2_mp Settings",L"SYNC_CLIENTS_MP_DIR", 1);
|
||||
guiMPHGameType = (UINT8)props.GetIntProperty( L"Ja2_mp Settings",L"GAME_MODE", MP_TYPE_DEATHMATCH);
|
||||
guiMPHDifficultLevel = (UINT8)props.GetIntProperty( L"Ja2_mp Settings",L"DIFFICULT_LEVEL", 3); // Expert
|
||||
#endif
|
||||
|
||||
wchar_t* tok;
|
||||
bool bTimeOK = true;
|
||||
int hours = 0;
|
||||
int mins = 0;
|
||||
|
||||
tok = wcstok(szTime,L".");
|
||||
tok = wcstok(&szTime[0],L".");
|
||||
|
||||
if (tok != NULL)
|
||||
{
|
||||
@@ -575,6 +766,9 @@ UINT32 MPHostScreenHandle( void )
|
||||
{
|
||||
// PauseGame();
|
||||
|
||||
// need to reload ja2_mp.ini
|
||||
MPHostScreenInit();
|
||||
|
||||
EnterMPHScreen();
|
||||
gfMPHScreenEntry = FALSE;
|
||||
gfMPHScreenExit = FALSE;
|
||||
@@ -774,6 +968,16 @@ BOOLEAN EnterMPHScreen()
|
||||
5,
|
||||
INPUTTYPE_ASCII );//23
|
||||
|
||||
//Add File transfer directory textbox
|
||||
AddTextInputField( MPH_TXT_FILE_TRANSFER_DIR_X,
|
||||
MPH_TXT_FILE_TRANSFER_DIR_Y,
|
||||
MPH_TXT_FILE_TRANSFER_DIR_WIDTH,
|
||||
MPH_TXT_FILE_TRANSFER_DIR_HEIGHT,
|
||||
MSYS_PRIORITY_HIGH+2,
|
||||
gzFileTransferDirectory,
|
||||
100,
|
||||
INPUTTYPE_ASCII );
|
||||
|
||||
|
||||
SetActiveField( 0 ); // Playername textbox has focus
|
||||
|
||||
@@ -783,7 +987,7 @@ BOOLEAN EnterMPHScreen()
|
||||
//
|
||||
usPosY = MPH_DIF_SETTINGS_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y;
|
||||
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<MPH_NUM_DIFF_SETTINGS; cnt++)
|
||||
{
|
||||
// create each checkbox
|
||||
guiMPHDifficultySettingsToggles[ cnt ] = CreateCheckBoxButton( MPH_DIF_SETTINGS_X+MPH_OFFSET_TO_TOGGLE_BOX, usPosY,
|
||||
@@ -795,22 +999,12 @@ BOOLEAN EnterMPHScreen()
|
||||
}
|
||||
|
||||
// Set default selection
|
||||
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ MPH_DIFF_EASY ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ MPH_DIFF_MED ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
|
||||
if( guiMPHDifficultLevel == DIF_LEVEL_HARD )
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ MPH_DIFF_HARD ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
|
||||
else if( guiMPHDifficultLevel == DIF_LEVEL_INSANE )
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ MPH_DIFF_INSANE ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
else
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ MPH_DIFF_MED ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ MPH_DIFF_HARD ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
|
||||
//
|
||||
@@ -831,6 +1025,12 @@ BOOLEAN EnterMPHScreen()
|
||||
// set default selection
|
||||
ButtonList[ guiMPHGameTypeToggles[ guiMPHGameType ] ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
// Override Max AI
|
||||
guiMPHOverrideMaxAIToggle = CreateCheckBoxButton( MPH_OVERRIDEMAXAI_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_OVERRIDEMAXAI_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y,
|
||||
"INTERFACE\\OptionsCheck.sti", MSYS_PRIORITY_HIGH+10,
|
||||
BtnMPHOverrideMaxAICallback );
|
||||
if ( giMPHOverrideMaxAI )
|
||||
ButtonList[ guiMPHOverrideMaxAIToggle ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
// Random Mercs
|
||||
guiMPHRandomMercsToggle = CreateCheckBoxButton( MPH_RNDMERC_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_RNDMERC_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y,
|
||||
@@ -884,6 +1084,14 @@ BOOLEAN EnterMPHScreen()
|
||||
ButtonList[ guiMPHUseNIVToggle ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
|
||||
// checkbox for send files to clients
|
||||
guiMPHSendFiles = CreateCheckBoxButton( MPH_SEND_FILES_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_SEND_FILES_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y,
|
||||
"INTERFACE\\OptionsCheck.sti", MSYS_PRIORITY_HIGH+10,
|
||||
BtnMPHSendFilesCallback );
|
||||
|
||||
if (giMPHSendFiles)
|
||||
ButtonList[ guiMPHSendFiles ]->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
|
||||
|
||||
//Reset the exit screen - screen the main game loop will call next iteration
|
||||
@@ -919,13 +1127,14 @@ BOOLEAN ExitMPHScreen()
|
||||
UnloadButtonImage( giMPHStartBtnImage );
|
||||
|
||||
//Check box to toggle Difficulty settings
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<MPH_NUM_DIFF_SETTINGS; cnt++)
|
||||
RemoveButton( guiMPHDifficultySettingsToggles[ cnt ] );
|
||||
|
||||
//Check box to toggle Game Types
|
||||
for( cnt=0; cnt<NUM_MP_GAMETYPE; cnt++)
|
||||
RemoveButton( guiMPHGameTypeToggles[ cnt ] );
|
||||
|
||||
RemoveButton( guiMPHOverrideMaxAIToggle );
|
||||
RemoveButton( guiMPHRandomMercsToggle );
|
||||
RemoveButton( guiMPHSameMercToggle );
|
||||
RemoveButton( guiMPHReportMercToggle );
|
||||
@@ -933,6 +1142,7 @@ BOOLEAN ExitMPHScreen()
|
||||
RemoveButton( guiMPHRandomSpawnToggle );
|
||||
RemoveButton( guiMPHCivsToggle );
|
||||
RemoveButton( guiMPHUseNIVToggle );
|
||||
RemoveButton( guiMPHSendFiles );
|
||||
|
||||
// exit text input mode in this screen and clean up text boxes
|
||||
KillAllTextInputModes();
|
||||
@@ -1026,25 +1236,20 @@ BOOLEAN RenderMPHScreen()
|
||||
// Starting Cash text label
|
||||
DisplayWrappedString( MPH_LABEL_CASH_X, MPH_LABEL_CASH_Y, MPH_LABEL_CASH_WIDTH, 2, MPH_LABEL_TEXT_FONT, MPH_LABEL_TEXT_COLOR, gzMPHScreenText[ MPH_BALANCE_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Starting Cash text label
|
||||
// Damage multiplier text label
|
||||
DisplayWrappedString( MPH_LABEL_DMG_X, MPH_LABEL_DMG_Y, MPH_LABEL_DMG_WIDTH, 2, MPH_LABEL_TEXT_FONT, MPH_LABEL_TEXT_COLOR, gzMPHScreenText[ MPH_DMG_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Starting Cash text label
|
||||
// Turn timer text label
|
||||
DisplayWrappedString( MPH_LABEL_TIMER_X, MPH_LABEL_TIMER_Y, MPH_LABEL_TIMER_WIDTH, 2, MPH_LABEL_TEXT_FONT, MPH_LABEL_TEXT_COLOR, gzMPHScreenText[ MPH_TIMER_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// File transfer directory (source directory for server, target directory for client)
|
||||
DisplayWrappedString( MPH_LABEL_FILE_TRANSFER_DIR_X, MPH_LABEL_FILE_TRANSFER_DIR_Y, MPH_LABEL_FILE_TRANSFER_DIR_WIDTH, 2, MPH_LABEL_TEXT_FONT, MPH_LABEL_TEXT_COLOR, gzMPHScreenText[ MPH_FILE_TRANSFER_DIR_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
//Display the Dif Settings Title Text
|
||||
DisplayWrappedString( MPH_DIF_SETTINGS_X, (UINT16)(MPH_DIF_SETTINGS_Y-MPH_GAP_BN_SETTINGS), MPH_DIF_SETTINGS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Novice
|
||||
usPosY = MPH_DIF_SETTINGS_Y+2;
|
||||
DisplayWrappedString( (UINT16)(MPH_DIF_SETTINGS_X+MPH_OFFSET_TO_TEXT), usPosY, MPH_DIF_SETTINGS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_EASY_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Intermediate
|
||||
usPosY += MPH_GAP_BN_SETTINGS-5;
|
||||
DisplayWrappedString( (UINT16)(MPH_DIF_SETTINGS_X+MPH_OFFSET_TO_TEXT), usPosY, MPH_DIF_SETTINGS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_MEDIUM_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Hard
|
||||
usPosY += MPH_GAP_BN_SETTINGS-5;
|
||||
usPosY = MPH_DIF_SETTINGS_Y+2;
|
||||
DisplayWrappedString( (UINT16)(MPH_DIF_SETTINGS_X+MPH_OFFSET_TO_TEXT), usPosY, MPH_DIF_SETTINGS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_HARD_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Insane
|
||||
@@ -1067,6 +1272,9 @@ BOOLEAN RenderMPHScreen()
|
||||
usPosY += MPH_GAP_BN_SETTINGS-5;
|
||||
DisplayWrappedString( (UINT16)(MPH_GAMETYPE_SETTINGS_X+MPH_OFFSET_TO_TEXT), usPosY, MPH_GAMETYPE_SETTINGS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_COOP_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Override Max AI
|
||||
DisplayWrappedString( (UINT16)MPH_OVERRIDEMAXAI_X, MPH_OVERRIDEMAXAI_Y, MPH_OVERRIDEMAXAI_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_OVERRIDEMAXAI_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Random Mercs
|
||||
DisplayWrappedString( (UINT16)MPH_RNDMERC_X, MPH_RNDMERC_Y, MPH_RNDMERC_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_RANDOMMERCS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
@@ -1086,8 +1294,10 @@ BOOLEAN RenderMPHScreen()
|
||||
DisplayWrappedString( (UINT16)MPH_CIVS_X, MPH_CIVS_Y, MPH_CIVS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_ENABLECIV_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Use NIV
|
||||
DisplayWrappedString( (UINT16)MPH_USENIV_X, MPH_USENIV_Y, MPH_CIVS_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_USENIV_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DisplayWrappedString( (UINT16)MPH_USENIV_X, MPH_USENIV_Y, MPH_USENIV_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_USENIV_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Send Files
|
||||
DisplayWrappedString( (UINT16)MPH_SEND_FILES_X, MPH_SEND_FILES_Y, MPH_SEND_FILES_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzMPHScreenText[ MPH_SYNC_CLIENT_MP_DIR ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
return( TRUE );
|
||||
} // end of RenderMPHScreen()
|
||||
@@ -1117,7 +1327,27 @@ void GetMPHScreenUserInput()
|
||||
case ENTER:
|
||||
if (ValidateMPSettings())
|
||||
{
|
||||
SaveMPSettings();
|
||||
SaveMPSettings(); // Update Profiles/UserProfile/ja2_mp.ini
|
||||
#ifdef USE_VFS
|
||||
// "gzFileTransferDirectory" is the new multiplayer profile root
|
||||
vfs::CProfileStack *PS = GetVFS()->GetProfileStack();
|
||||
|
||||
// remove Multiplayer profile if it exists
|
||||
vfs::CVirtualProfile *pProf = PS->GetProfile("_MULTIPLAYER");
|
||||
if( pProf && (pProf == PS->TopProfile()) )
|
||||
{
|
||||
THROWIFFALSE(PS->PopProfile(), "Could not remove old \"_MULTIPLAYER\" profile");
|
||||
// careful, pProf is not valid anymore
|
||||
}
|
||||
// create and initialize a new Multiplayer profile
|
||||
pProf = new vfs::CVirtualProfile("_MULTIPLAYER",true);
|
||||
PS->PushProfile(pProf);
|
||||
if(!InitWriteProfile(*pProf, vfs::Path(gzFileTransferDirectory)))
|
||||
{
|
||||
THROWIFFALSE(PS->PopProfile(), L"Could not remove \"_MULTIPLAYER\" profile");
|
||||
THROWEXCEPTION(L"Directory exists, but Multiplayer profile could not be iniitalized");
|
||||
}
|
||||
#endif
|
||||
gubMPHScreenHandler = MPH_START;
|
||||
}
|
||||
break;
|
||||
@@ -1142,8 +1372,35 @@ void BtnMPHStartCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
|
||||
if (ValidateMPSettings())
|
||||
{
|
||||
SaveMPSettings();
|
||||
gubMPHScreenHandler = MPH_START;
|
||||
SaveMPSettings(); // Update the Profiles/UserProfile/ja2_mp.ini
|
||||
#ifdef USE_VFS
|
||||
// "gzFileTransferDirectory" is the new multiplayer profile root
|
||||
vfs::CProfileStack *PS = GetVFS()->GetProfileStack();
|
||||
|
||||
// remove Multiplayer profile if it exists
|
||||
vfs::CVirtualProfile *pProf = PS->GetProfile("_MULTIPLAYER");
|
||||
if( pProf && (pProf == PS->TopProfile()) )
|
||||
{
|
||||
THROWIFFALSE(PS->PopProfile(), "Could not remove old \"_MULTIPLAYER\" profile");
|
||||
// careful, pProf is not valid anymore
|
||||
}
|
||||
// create and initialize a new Multiplayer profile
|
||||
pProf = new vfs::CVirtualProfile("_MULTIPLAYER",true);
|
||||
PS->PushProfile(pProf);
|
||||
if(!InitWriteProfile(*pProf, vfs::Path(gzFileTransferDirectory)))
|
||||
{
|
||||
THROWIFFALSE(PS->PopProfile(), L"Could not remove \"_MULTIPLAYER\" profile");
|
||||
THROWEXCEPTION(L"Directory exists, but Multiplayer profile could not be iniitalized");
|
||||
}
|
||||
#endif
|
||||
|
||||
// The difficult level has to be set there. This is the only value so far, because it is used for initialization!
|
||||
gGameOptions.ubDifficultyLevel = GetMPHCurrentDifficultyButtonSetting();
|
||||
|
||||
// WANNE - MP: Reinit TableData folder and INIs
|
||||
LoadExternalGameplayData(TABLEDATA_DIRECTORY);
|
||||
InitDependingGameStyleOptions();
|
||||
}
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
@@ -1177,7 +1434,7 @@ void BtnMPHDifficultyTogglesCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
{
|
||||
UINT8 cnt;
|
||||
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<MPH_NUM_DIFF_SETTINGS; cnt++)
|
||||
{
|
||||
ButtonList[ guiMPHDifficultySettingsToggles[ cnt ] ]->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||
}
|
||||
@@ -1191,7 +1448,7 @@ void BtnMPHDifficultyTogglesCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
BOOLEAN fAnyChecked=FALSE;
|
||||
|
||||
//if none of the other boxes are checked, do not uncheck this box
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<MPH_NUM_DIFF_SETTINGS; cnt++)
|
||||
{
|
||||
|
||||
if( ButtonList[ guiMPHDifficultySettingsToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON )
|
||||
@@ -1253,7 +1510,7 @@ void RestoreMPHButtonBackGrounds()
|
||||
|
||||
usPosY = MPH_DIF_SETTINGS_Y-MPH_OFFSET_TO_TOGGLE_BOX_Y;
|
||||
//Check box to toggle Difficulty settings
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<MPH_NUM_DIFF_SETTINGS; cnt++)
|
||||
{
|
||||
RestoreExternBackgroundRect( MPH_DIF_SETTINGS_X+MPH_OFFSET_TO_TOGGLE_BOX, usPosY, 34, 29 );
|
||||
usPosY += MPH_GAP_BN_SETTINGS-5;
|
||||
@@ -1267,6 +1524,7 @@ void RestoreMPHButtonBackGrounds()
|
||||
usPosY += MPH_GAP_BN_SETTINGS-5;
|
||||
}
|
||||
|
||||
RestoreExternBackgroundRect( MPH_OVERRIDEMAXAI_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_OVERRIDEMAXAI_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
RestoreExternBackgroundRect( MPH_RNDMERC_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_RNDMERC_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
RestoreExternBackgroundRect( MPH_SAMEMERC_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_SAMEMERC_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
RestoreExternBackgroundRect( MPH_REPORTMERC_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_REPORTMERC_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
@@ -1274,6 +1532,7 @@ void RestoreMPHButtonBackGrounds()
|
||||
RestoreExternBackgroundRect( MPH_RNDSPAWN_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_RNDSPAWN_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
RestoreExternBackgroundRect( MPH_CIVS_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_CIVS_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
RestoreExternBackgroundRect( MPH_USENIV_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_USENIV_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
RestoreExternBackgroundRect( MPH_SEND_FILES_X+MPH_OFFSET_TO_TOGGLE_BOX, MPH_SEND_FILES_Y - MPH_OFFSET_TO_TOGGLE_BOX_Y, 34, 29 );
|
||||
|
||||
}
|
||||
|
||||
@@ -1281,11 +1540,11 @@ UINT8 GetMPHCurrentDifficultyButtonSetting()
|
||||
{
|
||||
UINT8 cnt;
|
||||
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<MPH_NUM_DIFF_SETTINGS; cnt++)
|
||||
{
|
||||
if( ButtonList[ guiMPHDifficultySettingsToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON )
|
||||
{
|
||||
return( cnt );
|
||||
return( cnt + 3 ); // removed two difficulty options from MPH
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,7 +1555,7 @@ UINT8 GetMPHGameTypeButtonSetting()
|
||||
{
|
||||
UINT8 cnt;
|
||||
|
||||
for( cnt=0; cnt<NUM_DIFF_SETTINGS; cnt++)
|
||||
for( cnt=0; cnt<NUM_MP_GAMETYPE; cnt++)
|
||||
{
|
||||
if( ButtonList[ guiMPHGameTypeToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON )
|
||||
{
|
||||
@@ -1393,6 +1652,21 @@ void DoneFadeInForExitMPHScreen( void )
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void BtnMPHOverrideMaxAICallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
MSYS_GetBtnUserData( btn, 0 );
|
||||
|
||||
if( btn->uiFlags & BUTTON_CLICKED_ON )
|
||||
{
|
||||
ButtonList[ guiMPHOverrideMaxAIToggle ]->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||
|
||||
//enable the current button
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BtnMPHRandomMercCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
@@ -1490,6 +1764,22 @@ void BtnMPHUseNIVCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
}
|
||||
}
|
||||
|
||||
void BtnMPHSendFilesCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
MSYS_GetBtnUserData( btn, 0 );
|
||||
|
||||
if( btn->uiFlags & BUTTON_CLICKED_ON )
|
||||
{
|
||||
ButtonList[ guiMPHSendFiles ]->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||
|
||||
//enable the current button
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BtnMPHCivsCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
|
||||
+178
-109
@@ -29,7 +29,14 @@
|
||||
#include "connect.h"
|
||||
#include "network.h" // for client name
|
||||
#include "saveloadscreen.h"
|
||||
#include "game init.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_init.h"
|
||||
#include "VFS/PropertyContainer.h"
|
||||
#include "VFS/iteratedir.h"
|
||||
|
||||
#include "Random.h"
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
@@ -113,9 +120,52 @@ UINT32 gubMPJExitScreen = MP_JOIN_SCREEN; // The screen that is in control next
|
||||
UINT32 guiMPJMainBackGroundImage;
|
||||
|
||||
// Wide-char strings that will hold the variables until they are transferred to the CHAR ascii fields
|
||||
CHAR16 gzPlayerHandleField[ 30 ] = {0} ;
|
||||
CHAR16 gzServerIPField[ 15 ] = {0} ;
|
||||
CHAR16 gzServerPortField[ 5 ] = {0} ;
|
||||
CHAR16 gzPlayerHandleField[ 10+1 ] = {0} ;
|
||||
CHAR16 gzServerIPField[ 15+1 ] = {0} ;
|
||||
CHAR16 gzServerPortField[ 5+1 ] = {0} ;
|
||||
|
||||
// client sets this when joining
|
||||
extern CHAR16 gzFileTransferDirectory[100];
|
||||
|
||||
#ifdef USE_VFS
|
||||
utf8string const& CUniqueServerId::GetServerId(vfs::Path dir, CPropertyContainer* props)
|
||||
{
|
||||
if(!props)
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
utf8string key = L"\"" + dir().c_wcs() + L"\"";
|
||||
utf8string id = props->GetStringProperty(L"SERVER",key);
|
||||
if(id.empty())
|
||||
{
|
||||
std::vector<wchar_t> _rand(30,0);
|
||||
int pos = 0;
|
||||
for(int block = 0; block < 5; ++block)
|
||||
{
|
||||
for(int i=0; i<5; ++i)
|
||||
{
|
||||
int r = Random(36);
|
||||
if(r < 10)
|
||||
{
|
||||
r += L'0';
|
||||
}
|
||||
else
|
||||
{
|
||||
r += L'A' - 10;
|
||||
}
|
||||
_rand[pos++] = r;
|
||||
}
|
||||
_rand[pos++] = L'-';
|
||||
}
|
||||
id.r_wcs().assign(&_rand[0],29);
|
||||
}
|
||||
_id = id;
|
||||
props->SetStringProperty(L"SERVER",key,_id);
|
||||
return _id;
|
||||
}
|
||||
|
||||
CUniqueServerId s_ServerId;
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
@@ -155,7 +205,6 @@ BOOLEAN ExitMPJScreen();
|
||||
void HandleMPJScreen();
|
||||
BOOLEAN RenderMPJScreen();
|
||||
void GetMPJScreenUserInput();
|
||||
void SaveJoinSettings();
|
||||
bool ValidateJoinSettings(bool bSkipServerAddress);
|
||||
BOOLEAN DoMPJMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
void DoneFadeOutForExitMPJScreen( void );
|
||||
@@ -164,85 +213,137 @@ void DoneFadeInForExitMPJScreen( void );
|
||||
|
||||
UINT32 MPJoinScreenInit( void )
|
||||
{
|
||||
// WANNE - MP: Read the values from Profiles/UserProfile/ja2_mp.ini
|
||||
#ifndef USE_VFS
|
||||
// read settings from JA2 ini
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_IP", L"", gzServerIPField, 15, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_PORT", L"", gzServerPortField, 5, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"CLIENT_NAME", L"Fresh Meat", gzPlayerHandleField, 30 , L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_IP", L"127.0.0.1", gzServerIPField, 16, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_PORT", L"60005", gzServerPortField, 6, L"..\\Ja2_mp.ini" );
|
||||
GetPrivateProfileStringW( L"Ja2_mp Settings",L"CLIENT_NAME", L"Player Name", gzPlayerHandleField, 12 , L"..\\Ja2_mp.ini" );
|
||||
#else
|
||||
CPropertyContainer props;
|
||||
props.InitFromIniFile( L"Ja2_mp.ini");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"SERVER_IP", gzServerIPField, 16, "127.0.0.1");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"SERVER_PORT", gzServerPortField, 6, "60005");
|
||||
props.GetStringProperty( L"Ja2_mp Settings", L"CLIENT_NAME", gzPlayerHandleField, 12, L"Player Name");
|
||||
#endif
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
void SaveJoinSettings()
|
||||
void SaveJoinSettings(bool ReSaving)
|
||||
{
|
||||
Get16BitStringFromField( 0, gzPlayerHandleField ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 1, gzServerIPField );
|
||||
Get16BitStringFromField( 2, gzServerPortField );
|
||||
|
||||
if (!ReSaving)
|
||||
{
|
||||
Get16BitStringFromField( 0, gzPlayerHandleField, 12 ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 1, gzServerIPField, 16 );
|
||||
Get16BitStringFromField( 2, gzServerPortField, 6 );
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
// save settings to JA2_mp.ini
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_IP", gzServerIPField, L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"SERVER_PORT", gzServerPortField, L"..\\Ja2_mp.ini" );
|
||||
WritePrivateProfileStringW( L"Ja2_mp Settings",L"CLIENT_NAME", gzPlayerHandleField , L"..\\Ja2_mp.ini" );
|
||||
#else
|
||||
CPropertyContainer props;
|
||||
props.InitFromIniFile("Ja2_mp.ini");
|
||||
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"SERVER_IP", gzServerIPField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"SERVER_PORT", gzServerPortField);
|
||||
props.SetStringProperty(L"Ja2_mp Settings",L"CLIENT_NAME", gzPlayerHandleField);
|
||||
|
||||
s_ServerId.GetServerId(vfs::Path(gzFileTransferDirectory), &props);
|
||||
|
||||
props.WriteToIniFile(L"ja2_mp.ini",true);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ValidateJoinSettings(bool bSkipServerAddress)
|
||||
bool ValidateJoinSettings(bool bSkipServerAddress, bool bSkipSyncDir)
|
||||
{
|
||||
// Check a Server name is entered
|
||||
Get16BitStringFromField( 0, gzPlayerHandleField ); // these indexes are based on the order created
|
||||
// Check a Player name is entered
|
||||
Get16BitStringFromField( 0, gzPlayerHandleField, 12 ); // these indexes are based on the order created
|
||||
if (wcscmp(gzPlayerHandleField,L"")<=0)
|
||||
{
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_HANDLE_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
// dont check server address if we are going to HOST
|
||||
if (bSkipServerAddress)
|
||||
return true;
|
||||
|
||||
// Verify the IP Address
|
||||
Get16BitStringFromField( 1, gzServerIPField );
|
||||
|
||||
// loop through octets and check
|
||||
int numOctets = 0;
|
||||
wchar_t* tok;
|
||||
tok = wcstok(gzServerIPField,L".");
|
||||
while (tok != NULL)
|
||||
if (!bSkipServerAddress)
|
||||
{
|
||||
numOctets++;
|
||||
INT32 oct = _wtoi(tok);
|
||||
// check for invalid conversion, ie alpha chars
|
||||
// wtoi returns 0 if it cant convert, but we need this value
|
||||
// therefore if tok <> 0 then it was a bad convert.
|
||||
if (oct == 0 && wcscmp(tok,L"0") != 0)
|
||||
// Verify the IP Address
|
||||
Get16BitStringFromField( 1, gzServerIPField, 16 );
|
||||
|
||||
// loop through octets and check
|
||||
int numOctets = 0;
|
||||
wchar_t* tok;
|
||||
tok = wcstok(gzServerIPField,L".");
|
||||
while (tok != NULL)
|
||||
{
|
||||
// force error
|
||||
numOctets=0;
|
||||
break;
|
||||
numOctets++;
|
||||
INT32 oct = _wtoi(tok);
|
||||
// check for invalid conversion, ie alpha chars
|
||||
// wtoi returns 0 if it cant convert, but we need this value
|
||||
// therefore if tok <> 0 then it was a bad convert.
|
||||
if (oct == 0 && wcscmp(tok,L"0") != 0)
|
||||
{
|
||||
// force error
|
||||
numOctets=0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (oct < 0 || oct > 254) // dont allow broadcast nums
|
||||
{
|
||||
// bad octet, error
|
||||
numOctets=0;
|
||||
break;
|
||||
}
|
||||
|
||||
// get next octet
|
||||
tok = wcstok(NULL,L".");
|
||||
}
|
||||
|
||||
if (oct < 0 || oct > 254) // dont allow broadcast nums
|
||||
if (numOctets != 4)
|
||||
{
|
||||
// bad octet, error
|
||||
numOctets=0;
|
||||
break;
|
||||
// not a valid ip address
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_SERVERIP_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify the Server Port
|
||||
Get16BitStringFromField( 2, gzServerPortField, 6 );
|
||||
INT32 svrPort = _wtoi(gzServerPortField);
|
||||
if (svrPort < 1 || svrPort > 65535)
|
||||
{
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_SERVERPORT_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bSkipSyncDir)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
// Create MULTIPLAYER / SERVERS if it dosent exist
|
||||
STRING512 syncDir;
|
||||
STRING512 executableDir;
|
||||
|
||||
GetExecutableDirectory(executableDir);
|
||||
sprintf(syncDir, "%s\\multiplayer", executableDir);
|
||||
|
||||
if (!DirectoryExists(syncDir))
|
||||
{
|
||||
CreateDirectoryA(syncDir, NULL);
|
||||
}
|
||||
|
||||
// get next octet
|
||||
tok = wcstok(NULL,L".");
|
||||
}
|
||||
|
||||
if (numOctets != 4)
|
||||
{
|
||||
// not a valid ip address
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_SERVERIP_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify the Server Port
|
||||
Get16BitStringFromField( 2, gzServerPortField );
|
||||
INT32 svrPort = _wtoi(gzServerPortField);
|
||||
if (svrPort < 1 || svrPort > 65535)
|
||||
{
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_SERVERPORT_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
sprintf(syncDir, "%s\\multiplayer\\servers", executableDir);
|
||||
if (!DirectoryExists(syncDir))
|
||||
{
|
||||
CreateDirectoryA(syncDir, NULL);
|
||||
}
|
||||
#else
|
||||
if(os::CreateRealDirecory(vfs::Path(L"Multiplayer")))
|
||||
{
|
||||
os::CreateRealDirecory(vfs::Path(L"Multiplayer/Servers"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -402,7 +503,7 @@ BOOLEAN EnterMPJScreen()
|
||||
MPJ_TXT_HANDLE_HEIGHT,
|
||||
MSYS_PRIORITY_HIGH+2,
|
||||
gzPlayerHandleField,
|
||||
30,
|
||||
11,
|
||||
INPUTTYPE_ASCII );//23
|
||||
|
||||
//Add Server IP textbox
|
||||
@@ -577,10 +678,14 @@ void GetMPJScreenUserInput()
|
||||
break;
|
||||
|
||||
case ENTER:
|
||||
if (ValidateJoinSettings(false))
|
||||
if (ValidateJoinSettings(false, false))
|
||||
{
|
||||
SaveJoinSettings();
|
||||
SaveJoinSettings(false);
|
||||
gubMPJScreenHandler = MPJ_JOIN;
|
||||
|
||||
// force client to use "MULTIPLAYER/SERVERS" path
|
||||
memset(gzFileTransferDirectory,0,100*sizeof(CHAR16));
|
||||
wcscpy(gzFileTransferDirectory,L"multiplayer/servers");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -602,11 +707,14 @@ void BtnMPJoinCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
if (ValidateJoinSettings(false))
|
||||
if (ValidateJoinSettings(false, false))
|
||||
{
|
||||
SaveJoinSettings();
|
||||
SaveJoinSettings(false);
|
||||
gubMPJScreenHandler = MPJ_JOIN;
|
||||
//gubMPJScreenHandler = MPJ_JOIN;
|
||||
|
||||
// force client to use "MULTIPLAYER/SERVERS" path
|
||||
memset(gzFileTransferDirectory,0,100*sizeof(CHAR16));
|
||||
wcscpy(gzFileTransferDirectory,L"multiplayer/servers");
|
||||
}
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
@@ -624,9 +732,9 @@ void BtnMPJHostCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
if (ValidateJoinSettings(true))
|
||||
if (ValidateJoinSettings(true, false))
|
||||
{
|
||||
SaveJoinSettings();
|
||||
SaveJoinSettings(false);
|
||||
gubMPJScreenHandler = MPJ_HOST;
|
||||
}
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
@@ -673,58 +781,19 @@ void DoneFadeOutForExitMPJScreen( void )
|
||||
auto_retry = true;
|
||||
giNumTries = 5;
|
||||
|
||||
// loop through and get the status of all the buttons
|
||||
// Madd
|
||||
/*gGameOptions.fGunNut = GetCurrentGunButtonSetting();
|
||||
gGameOptions.ubGameStyle = GetCurrentGameStyleButtonSetting();
|
||||
gGameOptions.ubDifficultyLevel = GetCurrentDifficultyButtonSetting() + 1;*/
|
||||
// JA2Gold: no more timed turns setting
|
||||
//gGameOptions.fTurnTimeLimit = GetCurrentTimedTurnsButtonSetting();//hayden : re-enabled
|
||||
// set up and initialise a new game on the client
|
||||
InitNewGame(false);
|
||||
SetPendingNewScreen( MP_CONNECT_SCREEN );
|
||||
|
||||
if (is_networked)
|
||||
gGameOptions.fTurnTimeLimit = TRUE;
|
||||
else
|
||||
gGameOptions.fTurnTimeLimit = FALSE;
|
||||
|
||||
// JA2Gold: iron man
|
||||
//gGameOptions.fIronManMode = GetCurrentGameSaveButtonSetting();
|
||||
|
||||
// Bobby Rays - why would we want anything less than the best
|
||||
gGameOptions.ubBobbyRay = BR_AWESOME;
|
||||
|
||||
|
||||
// CHRISL:
|
||||
/*if(IsNIVModeValid() == TRUE){
|
||||
switch ( GetCurrentINVOptionButtonSetting() )
|
||||
{
|
||||
case GIO_INV_OLD:
|
||||
gGameOptions.ubInventorySystem = INVENTORY_OLD;
|
||||
break;
|
||||
case GIO_INV_NEW:
|
||||
gGameOptions.ubInventorySystem = INVENTORY_NEW;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
// gubGIOExitScreen = INIT_SCREEN;
|
||||
gubMPJExitScreen = INTRO_SCREEN;
|
||||
|
||||
//set the fact that we should do the intro videos
|
||||
// gbIntroScreenMode = INTRO_BEGINING;
|
||||
#ifdef JA2TESTVERSION
|
||||
if( gfKeyState[ ALT ] )
|
||||
{
|
||||
if( gfKeyState[ CTRL ] )
|
||||
{
|
||||
gMercProfiles[ MIGUEL ].bMercStatus = MERC_IS_DEAD;
|
||||
gMercProfiles[ SKYRIDER ].bMercStatus = MERC_IS_DEAD;
|
||||
}
|
||||
|
||||
SetIntroType( INTRO_ENDING );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
SetIntroType( INTRO_BEGINING );
|
||||
gubMPJExitScreen = MP_CONNECT_SCREEN;
|
||||
|
||||
ExitMPJScreen(); // cleanup please, if we called a fadeout then we didnt do it above
|
||||
|
||||
|
||||
+19
-1
@@ -1,12 +1,30 @@
|
||||
#ifndef _MP_JOIN_SCREEN_H_
|
||||
#define _MP_JOIN_SCREEN_H_
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
#ifdef USE_VFS
|
||||
|
||||
class CPropertyContainer;
|
||||
|
||||
class CUniqueServerId
|
||||
{
|
||||
public:
|
||||
utf8string const& GetServerId(vfs::Path dir, CPropertyContainer* props = NULL);
|
||||
private:
|
||||
utf8string _id;
|
||||
};
|
||||
|
||||
extern CUniqueServerId s_ServerId;
|
||||
|
||||
#endif
|
||||
|
||||
UINT32 MPJoinScreenInit( void );
|
||||
UINT32 MPJoinScreenHandle( void );
|
||||
UINT32 MPJoinScreenShutdown( void );
|
||||
|
||||
void SaveJoinSettings(bool ReSaving);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+31
-10
@@ -93,6 +93,7 @@ BOOLEAN gfMPSScreenEntry = TRUE;
|
||||
BOOLEAN gfMPSScreenExit = FALSE;
|
||||
BOOLEAN gfReRenderMPSScreen=TRUE;
|
||||
BOOLEAN gfMPSButtonsAllocated = FALSE;
|
||||
BOOLEAN gfMPSScoreScreenCanContinue = FALSE;
|
||||
|
||||
//enum for different states of screen
|
||||
enum
|
||||
@@ -222,6 +223,8 @@ UINT32 MPScoreScreenShutdown( void )
|
||||
|
||||
BOOLEAN EnterMPSScreen()
|
||||
{
|
||||
gfMPSScoreScreenCanContinue = FALSE;
|
||||
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
if( gfMPSButtonsAllocated )
|
||||
@@ -326,6 +329,14 @@ void HandleMPSScreen()
|
||||
switch( gubMPSScreenHandler )
|
||||
{
|
||||
case MPS_CANCEL:
|
||||
// TODO.RW: Exit game, disconnect
|
||||
|
||||
if (is_server)
|
||||
server_disconnect();
|
||||
|
||||
if (is_client)
|
||||
client_disconnect();
|
||||
|
||||
gubMPSExitScreen = MAINMENU_SCREEN;
|
||||
gfMPSScreenExit = TRUE;
|
||||
break;
|
||||
@@ -357,6 +368,16 @@ void HandleMPSScreen()
|
||||
gubMPSScreenHandler = MPS_NOTHING;
|
||||
}
|
||||
|
||||
// disable the continue button
|
||||
if (!is_server)
|
||||
{
|
||||
if (gfMPSScoreScreenCanContinue)
|
||||
ShowButton( guiMPSContinueButton );
|
||||
else
|
||||
HideButton( guiMPSContinueButton );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( gfReRenderMPSScreen )
|
||||
{
|
||||
@@ -492,6 +513,14 @@ BOOLEAN RenderMPSScreen()
|
||||
DisplayWrappedString( MPS_LABEL_ACCURACY_X, usPosY, MPS_LABEL_ACCURACY_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerAccuracy, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
}
|
||||
|
||||
// OJW - 20090403
|
||||
// Draw Please wait for server message
|
||||
if (!is_server)
|
||||
{
|
||||
if (!gfMPSScoreScreenCanContinue)
|
||||
DisplayWrappedString( MPS_BTN_CONTINUE_X, MPS_BTN_CONTINUE_Y, 100, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, gzMPSScreenText[MPS_WAITSERVER_TEXT], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
}
|
||||
|
||||
/*
|
||||
// Player name text label
|
||||
DisplayWrappedString( MPJ_LABEL_HANDLE_X, MPJ_LABEL_HANDLE_Y, MPJ_LABEL_HANDLE_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_HANDLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
@@ -507,12 +536,9 @@ BOOLEAN RenderMPSScreen()
|
||||
|
||||
|
||||
|
||||
void GetMPSScreenUserInput()
|
||||
void GetMPSScreenUserInput()
|
||||
{
|
||||
InputAtom Event;
|
||||
// POINT MousePos;
|
||||
|
||||
// GetCursorPos(&MousePos);
|
||||
|
||||
while( DequeueEvent( &Event ) )
|
||||
{
|
||||
@@ -527,12 +553,7 @@ void GetMPSScreenUserInput()
|
||||
gubMPSScreenHandler = MPS_CANCEL;
|
||||
break;
|
||||
|
||||
case ENTER:
|
||||
/*if (ValidateJoinSettings(false))
|
||||
{
|
||||
SaveJoinSettings();
|
||||
gubMPSScreenHandler = MPS_JOIN;
|
||||
}*/
|
||||
case ENTER:
|
||||
gubMPSScreenHandler = MPS_CONTINUE;
|
||||
break;
|
||||
}
|
||||
|
||||
+34
-21
@@ -38,6 +38,8 @@
|
||||
#include "mercs.h"
|
||||
#include "gamesettings.h"
|
||||
#include "connect.h"
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_profile.h"
|
||||
|
||||
#define MAINMENU_TEXT_FILE "LoadScreens\\MainMenu.edt"
|
||||
#define MAINMENU_RECORD_SIZE 80 * 2
|
||||
@@ -99,6 +101,8 @@ BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate );
|
||||
void RenderMainMenu();
|
||||
void RestoreButtonBackGrounds();
|
||||
|
||||
extern void InitSightRange(); //lal
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -281,16 +285,25 @@ BOOLEAN InitMainMenu( )
|
||||
|
||||
// gfDoHelpScreen = 0;
|
||||
|
||||
if(is_networked)
|
||||
{
|
||||
is_networked = FALSE;
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
if(is_networked)
|
||||
{
|
||||
is_networked = FALSE;
|
||||
#ifdef USE_VFS
|
||||
// remove Multiplayer profile if it exists
|
||||
vfs::CProfileStack *PS = GetVFS()->GetProfileStack();
|
||||
vfs::CVirtualProfile *pProf = PS->GetProfile("_MULTIPLAYER");
|
||||
if( pProf && (pProf == PS->TopProfile()) )
|
||||
{
|
||||
THROWIFFALSE(PS->PopProfile(), "Leaving Multiplayer mode : Could not remove \"_MULTIPLAYER\" profile");
|
||||
}
|
||||
#endif
|
||||
|
||||
//if something didnt work, dont even know how to make error code...//hayden
|
||||
}
|
||||
}
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
//if something didnt work, dont even know how to make error code...//hayden
|
||||
}
|
||||
}
|
||||
|
||||
//Check to see whatr saved game files exist
|
||||
InitSaveGameArray();
|
||||
@@ -385,22 +398,27 @@ void ExitMainMenu( )
|
||||
|
||||
// WANNE - MP: This method initializes variables that should be initialized
|
||||
// differently for single and multiplayer
|
||||
void InitDependingGameStyleOptions(BOOLEAN isNetworked)
|
||||
void InitDependingGameStyleOptions()
|
||||
{
|
||||
// Load the ja2_options.ini
|
||||
FreeGameExternalOptions();
|
||||
|
||||
// Load APBPConstants.ini
|
||||
LoadGameAPBPConstants();
|
||||
// Load ja2_options.ini
|
||||
LoadGameExternalOptions();
|
||||
InitSightRange(); //lal
|
||||
|
||||
ReStartingGame();
|
||||
InitGameOptions();
|
||||
|
||||
if (isNetworked)
|
||||
if (is_networked)
|
||||
{
|
||||
NUMBER_OF_MERCS = 28;
|
||||
LAST_MERC_ID = 27;
|
||||
}
|
||||
else
|
||||
{
|
||||
InitGameOptions();
|
||||
|
||||
NUMBER_OF_MERCS = 15;
|
||||
LAST_MERC_ID = 14;
|
||||
}
|
||||
@@ -428,6 +446,7 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
if(is_networked)
|
||||
{
|
||||
is_networked = FALSE;
|
||||
giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
@@ -442,6 +461,7 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
else if (gbHandledMainMenu == NEW_MP_GAME)
|
||||
{
|
||||
is_networked = TRUE;
|
||||
giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = 7;
|
||||
|
||||
// Snap: Re-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
@@ -470,15 +490,8 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
if( gfKeyState[ ALT ] )
|
||||
gfLoadGameUponEntry = TRUE;
|
||||
}
|
||||
//else if ( gbHandledMainMenu == LOAD_MP_GAME )
|
||||
//{
|
||||
// is_networked = TRUE;
|
||||
|
||||
// if (gfKeyState[ ALT ] )
|
||||
// gfLoadGameUponEntry = TRUE;
|
||||
//}
|
||||
|
||||
InitDependingGameStyleOptions(is_networked);
|
||||
InitDependingGameStyleOptions();
|
||||
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
}
|
||||
|
||||
@@ -1206,7 +1206,7 @@ UINT32 MessageBoxScreenHandle( )
|
||||
else if( gMsgBox.usFlags & MSG_BOX_FLAG_INPUTBOX )
|
||||
{
|
||||
// retrieve the string from the text box
|
||||
Get16BitStringFromField( 0, gszMsgBoxInputString ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 0, gszMsgBoxInputString, 255 ); // these indexes are based on the order created
|
||||
// Exit messagebox
|
||||
gMsgBox.bHandled = MSG_BOX_RETURN_OK;
|
||||
}
|
||||
|
||||
+1005
-258
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,11 @@ extern bool is_server;
|
||||
extern bool is_networked;
|
||||
extern bool is_host; // OJW - added 20081129
|
||||
|
||||
// OJW - 20040922
|
||||
extern bool recieved_settings;
|
||||
extern bool recieved_transfer_settings;
|
||||
extern INT16 serverSyncClientsDirectory;
|
||||
|
||||
extern int PLAYER_TEAM_TIMER_SEC_PER_TICKS;
|
||||
|
||||
//extern char CLIENT_NUM[30];
|
||||
@@ -39,6 +44,14 @@ extern int RANDOM_MERCS;
|
||||
//OJW - 20090317
|
||||
extern bool is_game_started;
|
||||
|
||||
//OJW - 20090403
|
||||
extern int OVERRIDE_MAX_AI;
|
||||
|
||||
//OJW - 20090405
|
||||
extern STRING512 gCurrentTransferFilename;
|
||||
extern INT32 gCurrentTransferBytes;
|
||||
extern INT32 gTotalTransferBytes;
|
||||
|
||||
extern UINT16 crate_usMapPos;
|
||||
|
||||
//extern int INTERRUPTS;
|
||||
@@ -98,6 +111,8 @@ void send_interrupt(SOLDIERTYPE *pSoldier);
|
||||
|
||||
void OpenChatMsgBox(void);
|
||||
|
||||
void reapplySETTINGS();
|
||||
|
||||
BOOLEAN CheckConditionsForBattle( GROUP *pGroup ); // this comes from strategic movement.cpp
|
||||
|
||||
extern char client_names[4][30];
|
||||
@@ -108,10 +123,13 @@ extern char client_names[4][30];
|
||||
extern int client_ready[4];
|
||||
extern int client_teams[4];
|
||||
extern int client_edges[4];
|
||||
extern int client_downloading[4];
|
||||
extern int client_progress[4];
|
||||
|
||||
extern char SERVER_NAME[30];
|
||||
|
||||
//OJW - 20081224
|
||||
#define MAX_CONNECT_RETRIES 5
|
||||
extern bool auto_retry;
|
||||
extern int giNumTries;
|
||||
|
||||
@@ -146,3 +164,11 @@ typedef struct
|
||||
extern player_stats gMPPlayerStats[5];
|
||||
|
||||
extern void game_over( void );
|
||||
|
||||
// OJW - 20090422
|
||||
extern BOOLEAN fClientReceivedAllFiles;
|
||||
|
||||
// OJW - 20090507
|
||||
// Add basic version checking, will only work from now on
|
||||
// note: this cannot be longer than char[30]
|
||||
#define MPVERSION "1.13MP-v1.1"
|
||||
+22
-1
@@ -6,6 +6,10 @@ extern char CLIENT_NAME[30];
|
||||
extern char SERVER_NAME[30];
|
||||
extern bool Sawarded;
|
||||
|
||||
//extern char *fileToSend;
|
||||
extern unsigned int setID;
|
||||
//extern char *fileToSendCopy;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -13,6 +17,7 @@ typedef struct
|
||||
char client_name[30];
|
||||
int team;
|
||||
int cl_edge;
|
||||
char client_version[30];
|
||||
}client_info;
|
||||
|
||||
typedef struct
|
||||
@@ -61,9 +66,18 @@ typedef struct
|
||||
int RANDOM_SPAWN;
|
||||
int RANDOM_MERCS;
|
||||
int random_mercs[7];
|
||||
char server_version[30];
|
||||
} settings_struct;
|
||||
|
||||
|
||||
// WANNE: FILE TRANSFER
|
||||
typedef struct
|
||||
{
|
||||
STRING512 fileTransferDirectory;
|
||||
//char fileTransferDirectory[600]; // The file transfer directory path from the server
|
||||
int syncClientsDirectory; // Does the server want to sync files to the clients
|
||||
char serverName[30]; // The name of the server. This is used on the client side as a folder inside the client transfer directory
|
||||
long totalTransferBytes;
|
||||
} filetransfersettings_struct;
|
||||
|
||||
// added 080101 by OJW
|
||||
typedef struct
|
||||
@@ -85,6 +99,13 @@ typedef struct
|
||||
UINT8 newteam;
|
||||
} teamchange_struct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 client_num;
|
||||
UINT8 progress;
|
||||
UINT8 downloading;
|
||||
} progress_struct;
|
||||
|
||||
//typedef struct
|
||||
//{
|
||||
// int clnum;
|
||||
|
||||
+602
-194
File diff suppressed because it is too large
Load Diff
@@ -108,7 +108,7 @@ bool ovh_ready;
|
||||
|
||||
void test_func2 (void)//now bound to "0"
|
||||
{
|
||||
ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"test_func2 - function testing ground:" );
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, L"test_func2 - function testing ground:" );
|
||||
|
||||
|
||||
SOLDIERTYPE * pSoldier=MercPtrs[ 0 ];
|
||||
@@ -174,19 +174,19 @@ pSoldier->EVENT_InternalSetSoldierPosition( sCellX, sCellY ,FALSE, FALSE, FALSE
|
||||
|
||||
//UIHandleLUIEndLock( NULL );
|
||||
//if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"combat turn based" );
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, L"combat turn based" );
|
||||
//else
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"not" );
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, L"not" );
|
||||
|
||||
|
||||
//SOLDIERTYPE * pSoldier=MercPtrs[ 0 ];
|
||||
//
|
||||
// if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags &( ANIM_FIREREADY | ANIM_FIRE ) ) )
|
||||
// {
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"Ready" );
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, L"Ready" );
|
||||
// }
|
||||
// else
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"Not" );
|
||||
// ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, L"Not" );
|
||||
|
||||
////fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
////guiPendingOverrideEvent = LU_ENDUILOCK;
|
||||
@@ -343,7 +343,7 @@ pSoldier->EVENT_InternalSetSoldierPosition( sCellX, sCellY ,FALSE, FALSE, FALSE
|
||||
sprintf(szDefault, "%s","hello");
|
||||
|
||||
|
||||
ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"%S has connected.",szDefault );*/
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, L"%S has connected.",szDefault );*/
|
||||
|
||||
//manual overide
|
||||
//manual_overide();
|
||||
@@ -363,11 +363,11 @@ pSoldier->EVENT_InternalSetSoldierPosition( sCellX, sCellY ,FALSE, FALSE, FALSE
|
||||
// iBullet = CreateBullet( 0, 0, 0,11 );
|
||||
// if (iBullet == -1)
|
||||
// {
|
||||
// ScreenMsg( FONT_YELLOW, MSG_CHAT, L"Failed to create bullet");
|
||||
// ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"Failed to create bullet");
|
||||
// }
|
||||
// pBullet = GetBulletPtr( iBullet );
|
||||
|
||||
// //ScreenMsg( FONT_YELLOW, MSG_CHAT, L"Created Bullet");
|
||||
// //ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"Created Bullet");
|
||||
|
||||
// pBullet->fCheckForRoof=0;
|
||||
// pBullet->qIncrX=-917769;
|
||||
|
||||
@@ -59,6 +59,7 @@ Screens GameScreens[MAX_SCREENS] =
|
||||
{ MPHostScreenInit, MPHostScreenHandle, MPHostScreenShutdown },
|
||||
{ MPScoreScreenInit, MPScoreScreenHandle, MPScoreScreenShutdown }, // OJW - 20081222
|
||||
{ MPChatScreenInit, MPChatScreenHandle, MPChatScreenShutdown }, // OJW - 20090314
|
||||
{ MPConnectScreenInit, MPConnectScreenHandle, MPConnectScreenShutdown }, // OJW - 20090422
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
{ AIViewerScreenInit, AIViewerScreenHandle, AIViewerScreenShutdown },
|
||||
|
||||
+16
-4
@@ -121,6 +121,8 @@
|
||||
#include "Mercs.h"
|
||||
#include "INIReader.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
//rain
|
||||
#include "Rain.h"
|
||||
//end rain
|
||||
@@ -142,7 +144,6 @@ extern void ResetJA2ClockGlobalTimers( void );
|
||||
|
||||
extern void BeginLoadScreen( void );
|
||||
extern void EndLoadScreen();
|
||||
|
||||
extern CPostalService gPostalService;
|
||||
|
||||
//Global variable used
|
||||
@@ -1920,6 +1921,7 @@ BOOLEAN Inventory::Save( HWFILE hFile, bool fSavingMap )
|
||||
// The save directory now resides in the data directory (default or custom)
|
||||
BOOLEAN InitSaveDir()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
// Look for a custom data dir first
|
||||
std::string dataDir = gCustomDataCat.GetRootDir();
|
||||
if( dataDir.empty() || FileGetAttributes( (STR) dataDir.c_str() ) == 0xFFFFFFFF ) {
|
||||
@@ -1945,7 +1947,16 @@ BOOLEAN InitSaveDir()
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
if(is_networked)
|
||||
{
|
||||
sprintf( gSaveDir, "%s", utf8string::as_utf8(pMessageStrings[ MSG_MPSAVEDIRECTORY ] + 3).c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( gSaveDir, "%s", utf8string::as_utf8(pMessageStrings[ MSG_SAVEDIRECTORY ] + 3).c_str() );
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -6635,7 +6646,8 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p
|
||||
//loop through all the mercs on the players team to find the one that is not moving
|
||||
for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++)
|
||||
{
|
||||
if( pSoldier->bActive )
|
||||
// test for !NULL (if initilization fails and MercPtrs contains 'NULL's)
|
||||
if( pSoldier && pSoldier->bActive )
|
||||
{
|
||||
if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->flags.fBetweenSectors)
|
||||
{
|
||||
@@ -6659,7 +6671,7 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p
|
||||
//loop through all the mercs and find one that is moving
|
||||
for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++)
|
||||
{
|
||||
if( pSoldier->bActive )
|
||||
if( pSoldier && pSoldier->bActive )
|
||||
{
|
||||
//we found an alive, merc that is not moving
|
||||
*psSectorX = pSoldier->sSectorX;
|
||||
|
||||
+5
-6
@@ -204,8 +204,6 @@ extern BOOLEAN gfDisplaySaveGamesNowInvalidatedMsg;
|
||||
|
||||
//Dealtar's Airport Externalization
|
||||
extern CPostalService gPostalService;
|
||||
|
||||
|
||||
//
|
||||
//Buttons
|
||||
//
|
||||
@@ -1032,7 +1030,7 @@ void GetSaveLoadScreenUserInput()
|
||||
bActiveTextField = (INT8)GetActiveFieldID();
|
||||
if( bActiveTextField && bActiveTextField != -1 )
|
||||
{
|
||||
Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField);
|
||||
Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField, 128 );
|
||||
SetActiveField(0);
|
||||
|
||||
DestroySaveLoadTextInputBoxes();
|
||||
@@ -1081,7 +1079,7 @@ void SaveLoadGameNumber( INT8 bSaveGameID )
|
||||
bActiveTextField = (INT8)GetActiveFieldID();
|
||||
if( bActiveTextField && bActiveTextField != -1 )
|
||||
{
|
||||
Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField );
|
||||
Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField, 128 );
|
||||
}
|
||||
|
||||
//if there is save game in the slot, ask for confirmation before overwriting
|
||||
@@ -1504,7 +1502,8 @@ BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader )
|
||||
//make sure the entry is valid
|
||||
if( bEntry < 0 || bEntry > NUM_SAVE_GAMES )
|
||||
{
|
||||
memset( &pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) );
|
||||
//memset( &pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) );
|
||||
memset( pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) );
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -1761,7 +1760,7 @@ void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
bActiveTextField = (INT8)GetActiveFieldID();
|
||||
if( bActiveTextField && bActiveTextField != -1 )
|
||||
{
|
||||
Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField);
|
||||
Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField, 128 );
|
||||
SetActiveField(0);
|
||||
|
||||
DestroySaveLoadTextInputBoxes();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "TopicOps.h"
|
||||
#include "TopicIDs.h"
|
||||
|
||||
#include "VFS/vfs_types.h"
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -55,7 +57,7 @@ inline void _Null() { }
|
||||
//
|
||||
// Uncomment the follow to turn on more aggressive assertions
|
||||
//
|
||||
#define USE_AGGRESSIVE_ASSERTIONS
|
||||
//#define USE_AGGRESSIVE_ASSERTIONS
|
||||
|
||||
#ifdef FORCE_ASSERTS_ON
|
||||
|
||||
@@ -215,6 +217,10 @@ extern void _DebugMessage(const char *pSourceFile, unsigned uiLineNum, const cha
|
||||
#define DebugAttackBusy(x)
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs_debug.h"
|
||||
|
||||
void _ExceptionMessage( CBasicException &ex );
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -500,3 +500,22 @@ STR8 String(const STR8 String, ...)
|
||||
return gbTmpDebugString[usIndex];
|
||||
|
||||
}
|
||||
|
||||
void _ExceptionMessage( CBasicException &ex )
|
||||
{
|
||||
g_ExceptionList.clear();
|
||||
CBasicException::CALLSTACK::iterator it = ex.m_CallStack.begin();
|
||||
for(; it!=ex.m_CallStack.end(); ++it)
|
||||
{
|
||||
SExceptionData exd;
|
||||
exd.message = (*it).message;
|
||||
exd.function = (*it).function;
|
||||
exd.file = (*it).file;
|
||||
exd.line = (*it).line;
|
||||
g_ExceptionList.push_back(exd);
|
||||
}
|
||||
_FailMessage("",0,"");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <direct.h>
|
||||
|
||||
|
||||
#include "windows.h"
|
||||
#include "FileMan.h"
|
||||
@@ -45,6 +46,30 @@
|
||||
#include "LibraryDataBase.h"
|
||||
#include "io.h"
|
||||
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
#ifdef USE_VFS
|
||||
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
#include <map>
|
||||
|
||||
struct SOperation
|
||||
{
|
||||
enum EOperation
|
||||
{
|
||||
UNKNOWN, READ, WRITE,
|
||||
};
|
||||
EOperation op;
|
||||
SOperation() : op(UNKNOWN) {};
|
||||
};
|
||||
|
||||
typedef std::map<vfs::IBaseFile*, SOperation> tFILEMAP;
|
||||
static tFILEMAP s_mapFiles;
|
||||
|
||||
#endif
|
||||
//**************************************************************************
|
||||
//
|
||||
@@ -230,6 +255,9 @@ void FileDebug( BOOLEAN f )
|
||||
//**************************************************************************
|
||||
BOOLEAN FileExists( STR strFilename )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
return GetVFS()->FileExists(vfs::Path(strFilename));
|
||||
#else
|
||||
// First check to see if it's in a library (most files should be there)
|
||||
if ( gFileDataBase.fInitialized &&
|
||||
CheckIfFileExistInLibrary( strFilename ) ) return TRUE;
|
||||
@@ -246,6 +274,7 @@ BOOLEAN FileExists( STR strFilename )
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -272,6 +301,9 @@ BOOLEAN FileExists( STR strFilename )
|
||||
//**************************************************************************
|
||||
extern BOOLEAN FileExistsNoDB( STR strFilename )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
return GetVFS()->FileExists(vfs::Path(strFilename));
|
||||
#else
|
||||
// First check if it's in the custom Data directory
|
||||
if ( gCustomDataCat.FindFile(strFilename) ) return TRUE;
|
||||
|
||||
@@ -284,6 +316,7 @@ extern BOOLEAN FileExistsNoDB( STR strFilename )
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -308,12 +341,16 @@ extern BOOLEAN FileExistsNoDB( STR strFilename )
|
||||
//**************************************************************************
|
||||
BOOLEAN FileDelete( STR strFilename )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
return GetVFS()->RemoveFileFromFS(vfs::Path(strFilename));
|
||||
#else
|
||||
// Snap: delete the file from the default Data catalogue (if it is there)
|
||||
// Since the path can be either relative or absolute, try both methods
|
||||
gDefaultDataCat.RemoveFile(strFilename, true);
|
||||
gDefaultDataCat.RemoveFile(strFilename, false);
|
||||
|
||||
return( DeleteFile( (LPCSTR) strFilename ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -343,6 +380,41 @@ BOOLEAN FileDelete( STR strFilename )
|
||||
//**************************************************************************
|
||||
HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::Path path(strFilename);
|
||||
vfs::IBaseFile *pFile = NULL;
|
||||
try
|
||||
{
|
||||
if(uiOptions & FILE_ACCESS_WRITE)
|
||||
{
|
||||
// 'vfs::CVirtualFile::SF_TOP' should be enough, but if for some strange reason
|
||||
// file creation fails, we will stop at a writeable profile
|
||||
// and won't unintentionally mess up a file from another profile
|
||||
vfs::COpenWriteFile open_w( path, true, false, vfs::CVirtualFile::SF_STOP_ON_WRITEABLE_PROFILE);
|
||||
pFile = &open_w.file();
|
||||
open_w.release();
|
||||
s_mapFiles[pFile].op = SOperation::WRITE;
|
||||
return (HWFILE)pFile;
|
||||
}
|
||||
else if(uiOptions & FILE_ACCESS_READ)
|
||||
{
|
||||
vfs::COpenReadFile open_r(path, vfs::CVirtualFile::SF_TOP);
|
||||
pFile = &open_r.file();
|
||||
open_r.release();
|
||||
s_mapFiles[pFile].op = SOperation::READ;
|
||||
return (HWFILE)pFile;
|
||||
}
|
||||
}
|
||||
// sometimes a file is supposed to opened that does not exist (not tested with FileExists())
|
||||
// this operation can fail with an exception that the calling code doesn't catch
|
||||
// instead we catch it (any exception, not just CBasicException) here and return 0
|
||||
catch(CBasicException& ex) { LogException(ex); }
|
||||
catch(...)
|
||||
{
|
||||
LogException( CBasicException("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__) );
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
HWFILE hFile;
|
||||
HANDLE hRealFile;
|
||||
DWORD dwAccess;
|
||||
@@ -483,6 +555,7 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
return(0);
|
||||
|
||||
return(hFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -507,6 +580,14 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
|
||||
void FileClose( HWFILE hFile )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile)
|
||||
{
|
||||
pFile->Close();
|
||||
s_mapFiles.erase(pFile);
|
||||
}
|
||||
#else
|
||||
INT16 sLibraryID;
|
||||
UINT32 uiFileNum;
|
||||
|
||||
@@ -535,6 +616,7 @@ void FileClose( HWFILE hFile )
|
||||
if( gFileDataBase.fInitialized )
|
||||
CloseLibraryFile( sLibraryID, uiFileNum );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -573,6 +655,36 @@ void FileClose( HWFILE hFile )
|
||||
|
||||
BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
#ifdef JA2TESTVERSION
|
||||
UINT32 uiStartTime = GetJA2Clock();
|
||||
#endif
|
||||
bool bSuccess = false;
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile && (s_mapFiles[pFile].op == SOperation::READ))
|
||||
{
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
|
||||
if(pRF)
|
||||
{
|
||||
UINT32 uiBytesRead;
|
||||
bSuccess = pRF->Read((vfs::Byte*)pDest, uiBytesToRead, uiBytesRead);
|
||||
if(uiBytesToRead != uiBytesRead)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(puiBytesRead)
|
||||
{
|
||||
*puiBytesRead = uiBytesRead;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef JA2TESTVERSION
|
||||
//Add the time that we spent in this function to the total.
|
||||
uiTotalFileReadTime += GetJA2Clock() - uiStartTime;
|
||||
uiTotalFileReadCalls++;
|
||||
#endif
|
||||
return bSuccess;
|
||||
#else
|
||||
HANDLE hRealFile;
|
||||
DWORD dwNumBytesToRead, dwNumBytesRead;
|
||||
BOOLEAN fRet = FALSE;
|
||||
@@ -640,6 +752,7 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
|
||||
#endif
|
||||
|
||||
return(fRet);
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -671,6 +784,29 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
|
||||
|
||||
BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile && (s_mapFiles[pFile].op == SOperation::WRITE))
|
||||
{
|
||||
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
|
||||
if(pWF)
|
||||
{
|
||||
UINT32 uiBytesWritten;
|
||||
bool bSuccess = pWF->Write((vfs::Byte*)pDest, uiBytesToWrite, uiBytesWritten);
|
||||
|
||||
if (uiBytesToWrite != uiBytesWritten)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ( puiBytesWritten )
|
||||
{
|
||||
*puiBytesWritten = uiBytesWritten;
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
HANDLE hRealFile;
|
||||
DWORD dwNumBytesToWrite, dwNumBytesWritten;
|
||||
BOOLEAN fRet;
|
||||
@@ -705,6 +841,7 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy
|
||||
}
|
||||
|
||||
return(fRet);
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -730,6 +867,27 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy
|
||||
|
||||
BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::tReadableFile *pFile = GetVFS()->GetRFile(vfs::Path(strFilename));
|
||||
if(pFile)
|
||||
{
|
||||
UINT32 uiNumBytesRead;
|
||||
bool bSuccess = pFile->Read((vfs::Byte*)pDest,uiBytesToRead, uiNumBytesRead);
|
||||
pFile->Close();
|
||||
|
||||
if (uiBytesToRead != uiNumBytesRead)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ( puiBytesRead )
|
||||
{
|
||||
*puiBytesRead = uiNumBytesRead;
|
||||
}
|
||||
CHECKF( uiNumBytesRead == uiBytesToRead );
|
||||
return bSuccess;
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
HWFILE hFile;
|
||||
UINT32 uiNumBytesRead;
|
||||
BOOLEAN fRet;
|
||||
@@ -752,6 +910,7 @@ BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiB
|
||||
fRet = FALSE;
|
||||
|
||||
return(fRet);
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -784,6 +943,19 @@ BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiB
|
||||
|
||||
BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
CHAR8 strToSend[160]; /* itemdescription of item 0 will NOT fit if only 80 Chars per Line!, Sergeant_Kolja, 2007-06-10 */
|
||||
va_list argptr;
|
||||
BOOLEAN fRetVal = FALSE;
|
||||
|
||||
va_start(argptr, strFormatted);
|
||||
_vsnprintf( strToSend, DIM(strToSend), strFormatted, argptr ); /* made StringLen Save, Sergeant_Kolja, 2007-06-10 */
|
||||
strToSend[ DIM(strToSend)-1 ] = 0;
|
||||
va_end(argptr);
|
||||
|
||||
fRetVal = FileWrite( hFile, strToSend, strlen(strToSend), NULL );
|
||||
return( fRetVal );
|
||||
#else
|
||||
CHAR8 strToSend[160]; /* itemdescription of item 0 will NOT fit if only 80 Chars per Line!, Sergeant_Kolja, 2007-06-10 */
|
||||
va_list argptr;
|
||||
BOOLEAN fRetVal = FALSE;
|
||||
@@ -810,6 +982,7 @@ BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
|
||||
}
|
||||
|
||||
return( fRetVal );
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -839,6 +1012,53 @@ BOOLEAN _cdecl FilePrintf( HWFILE hFile, STR8 strFormatted, ... )
|
||||
|
||||
BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
INT32 iDistance = (INT32)uiDistance;
|
||||
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile)
|
||||
{
|
||||
vfs::IBaseFile::ESeekDir eSD;
|
||||
if ( uiHow == FILE_SEEK_FROM_START )
|
||||
{
|
||||
eSD = vfs::IBaseFile::SD_BEGIN;
|
||||
}
|
||||
else if ( uiHow == FILE_SEEK_FROM_END )
|
||||
{
|
||||
eSD = vfs::IBaseFile::SD_END;
|
||||
if( iDistance > 0 )
|
||||
{
|
||||
iDistance = -(iDistance);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eSD = vfs::IBaseFile::SD_CURRENT;
|
||||
}
|
||||
|
||||
if(s_mapFiles[pFile].op == SOperation::WRITE)
|
||||
{
|
||||
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
|
||||
if(pWF)
|
||||
{
|
||||
return pWF->SetWriteLocation(iDistance, eSD);
|
||||
}
|
||||
}
|
||||
else if(s_mapFiles[pFile].op == SOperation::READ)
|
||||
{
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
|
||||
if(pRF)
|
||||
{
|
||||
return pRF->SetReadLocation(iDistance, eSD);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
THROWEXCEPTION(L"unknown operation");
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
HANDLE hRealFile;
|
||||
LONG lDistanceToMove;
|
||||
DWORD dwMoveMethod;
|
||||
@@ -881,6 +1101,7 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -908,6 +1129,30 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
|
||||
|
||||
INT32 FileGetPos( HWFILE hFile )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile)
|
||||
{
|
||||
if(pFile->IsWriteable())
|
||||
{
|
||||
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
|
||||
if(pWF)
|
||||
{
|
||||
return pWF->GetWriteLocation();
|
||||
}
|
||||
}
|
||||
else if(pFile->IsReadable())
|
||||
{
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
|
||||
if(pRF)
|
||||
{
|
||||
return pRF->GetReadLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BAD_INDEX;
|
||||
#else
|
||||
HANDLE hRealFile;
|
||||
UINT32 uiPositionInFile=0;
|
||||
|
||||
@@ -944,6 +1189,7 @@ INT32 FileGetPos( HWFILE hFile )
|
||||
}
|
||||
|
||||
return(BAD_INDEX);
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -971,6 +1217,14 @@ INT32 FileGetPos( HWFILE hFile )
|
||||
|
||||
UINT32 FileGetSize( HWFILE hFile )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile)
|
||||
{
|
||||
return pFile->GetFileSize();
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
HANDLE hRealHandle;
|
||||
UINT32 uiFileSize = 0xFFFFFFFF;
|
||||
|
||||
@@ -999,6 +1253,7 @@ UINT32 FileGetSize( HWFILE hFile )
|
||||
return(0);
|
||||
else
|
||||
return( uiFileSize );
|
||||
#endif
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@@ -1250,6 +1505,10 @@ void BuildFileDirectory( void )
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// GetFilesInDirectory
|
||||
@@ -1356,7 +1615,11 @@ BOOLEAN DirectoryExists( STRING512 pcDirectory )
|
||||
|
||||
BOOLEAN MakeFileManDirectory( STRING512 pcDirectory )
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
return CreateDirectory( pcDirectory, NULL );
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1366,6 +1629,10 @@ BOOLEAN MakeFileManDirectory( STRING512 pcDirectory )
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
// ignore 'recursive' flag, just delete every file in that subtree (but leave the directories)
|
||||
return GetVFS()->RemoveDirectoryFromFS(pcDirectory);
|
||||
#else
|
||||
WIN32_FIND_DATA sFindData;
|
||||
HANDLE SearchHandle;
|
||||
const CHAR8 *pFileSpec = "*.*";
|
||||
@@ -1442,6 +1709,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
|
||||
}
|
||||
|
||||
return fRetval;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1451,6 +1719,10 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
BOOLEAN EraseDirectory( STRING512 pcDirectory)
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
// ignore 'recursive' flag, just delete every file in that subtree (but leave the directories)
|
||||
return GetVFS()->RemoveDirectoryFromFS(pcDirectory);
|
||||
#else
|
||||
WIN32_FIND_DATA sFindData;
|
||||
HANDLE SearchHandle;
|
||||
const CHAR8 *pFileSpec = "*.*";
|
||||
@@ -1502,6 +1774,7 @@ BOOLEAN EraseDirectory( STRING512 pcDirectory)
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1530,8 +1803,31 @@ BOOLEAN GetExecutableDirectory( STRING512 pcDirectory )
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
#ifdef USE_VFS
|
||||
static vfs::CVirtualFileSystem::Iterator file_iter;
|
||||
#endif
|
||||
BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
CHECKF( pSpec != NULL );
|
||||
CHECKF( pGFStruct != NULL );
|
||||
|
||||
file_iter = GetVFS()->begin(pSpec);
|
||||
if(!file_iter.end())
|
||||
{
|
||||
//vfs::Path const& path = file_iter.value()->GetFullPath();
|
||||
vfs::Path const& path = file_iter.value()->GetFileName();
|
||||
std::string s = path().utf8();
|
||||
utf8string::size_t size = s.length();
|
||||
size = std::min<unsigned int>(size,260-1);
|
||||
sprintf( pGFStruct->zFileName, s.c_str());
|
||||
pGFStruct->zFileName[size] = 0;
|
||||
|
||||
// don't care for the rest of variables in pGFStruct
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
INT32 x,iWhich=0;
|
||||
BOOLEAN fFound;
|
||||
|
||||
@@ -1562,10 +1858,31 @@ BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct )
|
||||
W32toSGPFileFind( pGFStruct, &Win32FindInfo[iWhich] );
|
||||
|
||||
return(TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
if(!file_iter.end())
|
||||
{
|
||||
file_iter.next();
|
||||
}
|
||||
if(!file_iter.end())
|
||||
{
|
||||
//vfs::Path const& path = file_iter.value()->GetFullPath();
|
||||
vfs::Path const& path = file_iter.value()->GetFileName();
|
||||
std::string s = path().utf8();
|
||||
utf8string::size_t size = s.length();
|
||||
size = std::min<unsigned int>(size,260-1);
|
||||
sprintf( pGFStruct->zFileName, s.c_str());
|
||||
pGFStruct->zFileName[size] = 0;
|
||||
|
||||
// don't care for the rest of variables in pGFStruct
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
CHECKF( pGFStruct != NULL );
|
||||
|
||||
if ( FindNextFile(hFindInfoHandle[pGFStruct->iFindHandle], &Win32FindInfo[pGFStruct->iFindHandle]) )
|
||||
@@ -1574,10 +1891,14 @@ BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct )
|
||||
return(TRUE);
|
||||
}
|
||||
return(FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetFileClose( GETFILESTRUCT *pGFStruct )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
file_iter = vfs::CVirtualFileSystem::Iterator();
|
||||
#else
|
||||
if ( pGFStruct == NULL )
|
||||
return;
|
||||
|
||||
@@ -1586,6 +1907,7 @@ void GetFileClose( GETFILESTRUCT *pGFStruct )
|
||||
fFindInfoInUse[pGFStruct->iFindHandle] = FALSE;
|
||||
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
void W32toSGPFileFind( GETFILESTRUCT *pGFStruct, WIN32_FIND_DATA *pW32Struct )
|
||||
@@ -1802,13 +2124,45 @@ UINT32 FileGetAttributes( STR strFilename )
|
||||
|
||||
BOOLEAN FileClearAttributes( STR strFilename )
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
return SetFileAttributes( (LPCSTR) strFilename, FILE_ATTRIBUTE_NORMAL );
|
||||
#else
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//returns true if at end of file, else false
|
||||
BOOLEAN FileCheckEndOfFile( HWFILE hFile )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
UINT32 uiCurrentLocation, uiMaxLocation;
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if(pFile)
|
||||
{
|
||||
if(pFile->IsWriteable())
|
||||
{
|
||||
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
|
||||
if(pWF)
|
||||
{
|
||||
uiCurrentLocation = pWF->GetWriteLocation();
|
||||
uiMaxLocation = pWF->GetFileSize();
|
||||
return uiCurrentLocation < uiMaxLocation;
|
||||
}
|
||||
}
|
||||
else if(pFile->IsReadable())
|
||||
{
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
|
||||
if(pRF)
|
||||
{
|
||||
uiCurrentLocation = pRF->GetReadLocation();
|
||||
uiMaxLocation = pRF->GetFileSize();
|
||||
return uiCurrentLocation < uiMaxLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
INT16 sLibraryID;
|
||||
UINT32 uiFileNum;
|
||||
HANDLE hRealFile;
|
||||
@@ -1873,6 +2227,7 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile )
|
||||
|
||||
//we are not and the end of a file
|
||||
return( 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1944,6 +2299,14 @@ INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFi
|
||||
|
||||
UINT32 FileSize(STR strFilename)
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::IBaseFile *pFile = GetVFS()->GetFile(vfs::Path(strFilename));
|
||||
if(pFile)
|
||||
{
|
||||
return pFile->GetFileSize();
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
HWFILE hFile;
|
||||
UINT32 uiSize;
|
||||
|
||||
@@ -1954,6 +2317,7 @@ UINT32 uiSize;
|
||||
FileClose(hFile);
|
||||
|
||||
return(uiSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "FileCat.h"
|
||||
|
||||
#include "Container.h"
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Defines
|
||||
@@ -162,7 +164,7 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile );
|
||||
|
||||
BOOLEAN GetFileManFileTime( HWFILE hFile, SGP_FILETIME *pCreationTime, SGP_FILETIME *pLastAccessedTime, SGP_FILETIME *pLastWriteTime );
|
||||
|
||||
|
||||
INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_FIND_DATA *pFind );
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "himage.h"
|
||||
#include "vobject.h"
|
||||
#include "vobject_blitters.h"
|
||||
|
||||
#include <sstream>
|
||||
#endif
|
||||
//*******************************************************
|
||||
//
|
||||
@@ -126,7 +128,12 @@ void SetFontForeground(UINT8 ubForeground)
|
||||
UINT32 uiRed, uiGreen, uiBlue;
|
||||
|
||||
if((FontDefault < 0) || (FontDefault > MAX_FONTS))
|
||||
return;
|
||||
{
|
||||
//return;
|
||||
std::wstringstream wss;
|
||||
wss << L"invalid font index ( " << FontDefault << L" )";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
}
|
||||
|
||||
FontForeground8=ubForeground;
|
||||
|
||||
@@ -186,7 +193,12 @@ void SetFontBackground(UINT8 ubBackground)
|
||||
UINT32 uiRed, uiGreen, uiBlue;
|
||||
|
||||
if((FontDefault < 0) || (FontDefault > MAX_FONTS))
|
||||
return;
|
||||
{
|
||||
//return;
|
||||
std::wstringstream wss;
|
||||
wss << L"invalid color background value ( " << ubBackground << L" )";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
}
|
||||
|
||||
FontBackground8=ubBackground;
|
||||
|
||||
@@ -582,6 +594,34 @@ INT16 StringPixLength(const STR16 string, INT32 UseFont)
|
||||
return((INT16)Cur);
|
||||
}
|
||||
|
||||
//*****************************************************************************************
|
||||
//
|
||||
// SubstringPixLength
|
||||
//
|
||||
// Return the length of the of a substring of a string
|
||||
//
|
||||
// Returns INT16
|
||||
//
|
||||
// Created by: Owen Wigg
|
||||
// Created on: 26/04/2009
|
||||
//
|
||||
//*****************************************************************************************
|
||||
INT16 SubstringPixLength(STR16 string, UINT32 iStart, UINT32 iEnd, INT32 UseFont)
|
||||
{
|
||||
Assert (string != NULL);
|
||||
Assert(iStart >= 0 && iStart <= iEnd);
|
||||
Assert(iEnd < wcslen(string));
|
||||
|
||||
INT16 cnt = 0;
|
||||
|
||||
for (unsigned int i=iStart; i <= iEnd; i++)
|
||||
{
|
||||
cnt += GetWidth(FontObjs[UseFont], GetIndex(string[i]));
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@@ -899,9 +939,12 @@ CHAR16 GetUnicodeChar(CHAR16 siChar)
|
||||
//*****************************************************************************
|
||||
BOOLEAN SetFont(INT32 iFontIndex)
|
||||
{
|
||||
Assert(iFontIndex >= 0);
|
||||
Assert(iFontIndex <= MAX_FONTS);
|
||||
Assert(FontObjs[iFontIndex]!=NULL);
|
||||
//Assert(iFontIndex >= 0);
|
||||
//Assert(iFontIndex <= MAX_FONTS);
|
||||
//Assert(FontObjs[iFontIndex]!=NULL);
|
||||
THROWIFFALSE( iFontIndex >= 0 ,"negative font index");
|
||||
THROWIFFALSE( iFontIndex <= MAX_FONTS, "font index > MAX_FONTS" );
|
||||
THROWIFFALSE( FontObjs[iFontIndex]!=NULL, "font is not initialized" );
|
||||
#ifdef WINFONTS
|
||||
SET_WINFONT(WinFontMap[iFontIndex]);
|
||||
#endif
|
||||
@@ -1407,6 +1450,14 @@ UINT8 *pDestBuf;
|
||||
desty+=GetHeight(FontObjs[FontDefault], transletter);
|
||||
}
|
||||
|
||||
// we get a ctd if we try try to write outside of the screen
|
||||
if(desty + GetHeight(FontObjs[FontDefault], transletter) > SCREEN_HEIGHT)
|
||||
{
|
||||
// don't forget to unlock buffer
|
||||
UnLockVideoSurface( FontDestBuffer );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Blit directly
|
||||
if ( gbPixelDepth == 8 )
|
||||
{
|
||||
|
||||
@@ -157,7 +157,7 @@ extern UINT32 GetWidth(HVOBJECT hSrcVObject, INT16 ssIndex);
|
||||
extern INT16 StringPixLengthArgFastHelp( INT32 usUseFont, INT32 usBoldFont, UINT32 uiCharCount, STR16 pFontString );
|
||||
extern INT16 StringPixLengthArg(INT32 usUseFont, UINT32 uiCharCount, STR16 pFontString, ...);
|
||||
extern INT16 StringPixLength(const STR16 string,INT32 UseFont);
|
||||
|
||||
extern INT16 SubstringPixLength(STR16 string, UINT32 iStart, UINT32 iEnd, INT32 UseFont);
|
||||
extern INT16 StringNPixLength(STR16 string, UINT32 uiMaxCount, INT32 UseFont);
|
||||
extern void SaveFontSettings(void);
|
||||
extern void RestoreFontSettings(void);
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#include "vfs.h"
|
||||
#include "PropertyContainer.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define DEBUG_MEM_LEAKS // turns on tracking of every MemAlloc and MemFree!
|
||||
#endif
|
||||
@@ -211,6 +214,7 @@ void ShutdownMemoryManager( void )
|
||||
#ifndef EXTREME_MEMORY_DEBUGGING
|
||||
#ifdef JA2BETAVERSION
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
fp = fopen( "MemLeakInfo.txt", "a" );
|
||||
if( fp )
|
||||
@@ -226,6 +230,18 @@ void ShutdownMemoryManager( void )
|
||||
fprintf( fp, "\n\n" );
|
||||
}
|
||||
fclose( fp );
|
||||
#else
|
||||
CLog memLeak( L"MemLeakInfo.txt", true);
|
||||
memLeak.Endl().Endl();
|
||||
memLeak << ">>>>> MEMORY LEAK DETECTED!!! <<<<<" << CLog::endl;
|
||||
memLeak << " " << guiMemAlloced << " bytes memory total was allocated" << CLog::endl;
|
||||
memLeak << "- " << guiMemFreed << " bytes memory total was freed" << CLog::endl;
|
||||
memLeak << "_______________________________________________" << CLog::endl;
|
||||
memLeak << guiMemTotal << " bytes memory total STILL allocated" << CLog::endl;
|
||||
memLeak << MemDebugCounter << " memory blocks still allocated" << CLog::endl;
|
||||
memLeak << "guiScreenExitedFrom = " << gzJA2ScreenNames[ gMsgBox.uiExitScreen ] << CLog::endl;
|
||||
memLeak.Endl().Endl();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
#ifndef _PNGLOADER_H_
|
||||
#define _PNGLOADER_H_
|
||||
|
||||
#include "types.h"
|
||||
#include "himage.h"
|
||||
|
||||
bool LoadPNGFileToImage(HIMAGE hImage, UINT16 fContents);
|
||||
|
||||
bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents);
|
||||
|
||||
|
||||
#endif // _PNGLOADER_H_
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="SGP_2005Express"
|
||||
ProjectGUID="{6283CE93-2960-4596-8E74-7A6FBA8716FF}"
|
||||
RootNamespace="SGP_2005Express"
|
||||
@@ -41,7 +41,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -105,7 +105,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="false"
|
||||
@@ -166,7 +166,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="false"
|
||||
@@ -228,7 +228,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -424,6 +424,10 @@
|
||||
RelativePath=".\pcx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PngLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RAD.H"
|
||||
>
|
||||
@@ -642,6 +646,10 @@
|
||||
RelativePath=".\PCX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PngLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Random.cpp"
|
||||
>
|
||||
|
||||
@@ -423,6 +423,10 @@
|
||||
RelativePath="pcx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PngLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="RAD.H"
|
||||
>
|
||||
@@ -639,6 +643,10 @@
|
||||
RelativePath="PCX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PngLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Random.cpp"
|
||||
>
|
||||
|
||||
@@ -14,11 +14,18 @@
|
||||
#include "impTGA.h"
|
||||
#include "pcx.h"
|
||||
#include "STCI.h"
|
||||
#include "PngLoader.h"
|
||||
#include "wcheck.h"
|
||||
#include "Compression.h"
|
||||
#include "vobject.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
const utf8string::str_t CONST_DOTJPC(L".jpc.7z");
|
||||
|
||||
|
||||
|
||||
// This is the color substituted to keep a 24bpp->16bpp color
|
||||
// from going transparent (0x0000) -- DB
|
||||
|
||||
@@ -79,19 +86,42 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
iFileLoader = PCX_FILE_READER;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( _stricmp( Extension, "TGA" ) == 0 )
|
||||
else if ( _stricmp( Extension, "TGA" ) == 0 )
|
||||
{
|
||||
iFileLoader = TGA_FILE_READER;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( _stricmp( Extension, "STI" ) == 0 )
|
||||
else if ( _stricmp( Extension, "STI" ) == 0 )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
// see if there is a .jpc file first and when that fails, try .sti
|
||||
utf8string str(ImageFile);
|
||||
utf8string::str_t const& findext = str.c_wcs();
|
||||
utf8string::size_t dot = findext.find_last_of(vfs::Const::DOT());
|
||||
utf8string fname = findext.substr(0,dot).append(CONST_DOTJPC);
|
||||
if(GetVFS()->FileExists(fname))
|
||||
{
|
||||
iFileLoader = JPC_FILE_READER;
|
||||
strncpy(ImageFile, fname.utf8().c_str(), fname.length());
|
||||
ImageFile[fname.length()] = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
iFileLoader = STCI_FILE_READER;
|
||||
break;
|
||||
}
|
||||
|
||||
else if ( _stricmp( Extension, "PNG" ) == 0 )
|
||||
{
|
||||
iFileLoader = PNG_FILE_READER;
|
||||
break;
|
||||
}
|
||||
#ifdef USE_VFS
|
||||
else if ( StrCmp::Equal(Extension, L"jpc.7z") )
|
||||
{
|
||||
iFileLoader = JPC_FILE_READER;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
} while ( FALSE );
|
||||
|
||||
// Determine if resource exists before creating image structure
|
||||
@@ -104,6 +134,7 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
#endif
|
||||
#endif
|
||||
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, String("Resource file %s does not exist.", ImageFile) );
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
@@ -221,6 +252,14 @@ BOOLEAN LoadImageData( HIMAGE hImage, UINT16 fContents )
|
||||
fReturnVal = LoadSTCIFileToImage( hImage, fContents );
|
||||
break;
|
||||
|
||||
case PNG_FILE_READER:
|
||||
fReturnVal = LoadPNGFileToImage( hImage, fContents );
|
||||
break;
|
||||
|
||||
case JPC_FILE_READER:
|
||||
fReturnVal = LoadJPCFileToImage( hImage, fContents );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, "Unknown image loader was specified." );
|
||||
@@ -905,6 +944,10 @@ BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
|
||||
|
||||
// Create buffer for objects
|
||||
pBuffer->pETRLEObject = (ETRLEObject *) MemAlloc( sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
||||
if(!pBuffer->pETRLEObject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CHECKF( pBuffer->pETRLEObject != NULL );
|
||||
memset( pBuffer->pETRLEObject, 0, sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
||||
|
||||
@@ -913,6 +956,10 @@ BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
|
||||
|
||||
// Allocate memory for pixel data
|
||||
pBuffer->pPixData = MemAlloc( hImage->uiSizePixData );
|
||||
if(!pBuffer->pPixData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CHECKF( pBuffer->pPixData != NULL );
|
||||
memset( pBuffer->pPixData, 0, hImage->uiSizePixData );
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#define TGA_FILE_READER 0x2
|
||||
#define STCI_FILE_READER 0x4
|
||||
#define TRLE_FILE_READER 0x8
|
||||
#define PNG_FILE_READER 0x10
|
||||
#define JPC_FILE_READER 0x20
|
||||
#define UNKNOWN_FILE_READER 0x200
|
||||
|
||||
// Defines for buffer bit depth
|
||||
@@ -93,41 +95,29 @@ typedef struct
|
||||
{
|
||||
UINT16 usWidth;
|
||||
UINT16 usHeight;
|
||||
UINT8 ubBitDepth;
|
||||
UINT8 ubBitDepth;
|
||||
UINT16 fFlags;
|
||||
SGPFILENAME ImageFile;
|
||||
SGPFILENAME ImageFile;
|
||||
UINT32 iFileLoader;
|
||||
SGPPaletteEntry *pPalette;
|
||||
UINT16 *pui16BPPPalette;
|
||||
UINT8 * pAppData;
|
||||
SGPPaletteEntry* pPalette;
|
||||
UINT16* pui16BPPPalette;
|
||||
UINT8* pAppData;
|
||||
UINT32 uiAppDataSize;
|
||||
// This union is used to describe each data type and is flexible to include the
|
||||
// data strucutre of the compresssed format, once developed.
|
||||
union
|
||||
{
|
||||
//struct
|
||||
//{
|
||||
PTR pImageData;
|
||||
//};
|
||||
//struct
|
||||
//{
|
||||
PTR pCompressedImageData;
|
||||
//};
|
||||
//struct
|
||||
//{
|
||||
UINT8 *p8BPPData;
|
||||
//};
|
||||
//struct
|
||||
//{
|
||||
|
||||
UINT16 *p16BPPData;
|
||||
//};
|
||||
PTR pImageData;
|
||||
PTR pCompressedImageData;
|
||||
UINT8* p8BPPData;
|
||||
UINT16* p16BPPData;
|
||||
UINT32* p32BPPData;
|
||||
struct
|
||||
{
|
||||
UINT8 * pPixData8;
|
||||
UINT32 uiSizePixData;
|
||||
ETRLEObject * pETRLEObject;
|
||||
UINT16 usNumberOfObjects;
|
||||
UINT8* pPixData8;
|
||||
UINT32 uiSizePixData;
|
||||
ETRLEObject* pETRLEObject;
|
||||
UINT16 usNumberOfObjects;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1080,7 +1080,7 @@ void MSYS_DisableRegion(MOUSE_REGION *region)
|
||||
//
|
||||
void MSYS_SetCurrentCursor(UINT16 Cursor)
|
||||
{
|
||||
SetCurrentCursorFromDatabase( Cursor );
|
||||
TRYCATCH_RETHROW(SetCurrentCursorFromDatabase( Cursor ), "Could not set Cursor");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,13 @@
|
||||
#include "input.h"
|
||||
#include "zmouse.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_init.h"
|
||||
#include "VFS/File/vfs_file.h"
|
||||
#include "VFS/Location/vfs_slf_library.h"
|
||||
#include "Text.h"
|
||||
|
||||
#define USE_CONSOLE 0
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -46,6 +53,7 @@
|
||||
#include "INIReader.h"
|
||||
#include "Console.h"
|
||||
#include "Lua Interpreter.h"
|
||||
#include "connect.h"
|
||||
|
||||
#ifdef JA2
|
||||
#include "BuildDefines.h"
|
||||
@@ -57,6 +65,24 @@
|
||||
#endif
|
||||
|
||||
|
||||
static void MAGIC(std::string const& aarrrrgggh = "")
|
||||
{}
|
||||
|
||||
static bool s_VfsIsInitialized = false;
|
||||
static std::list<vfs::Path> vfs_config_ini;
|
||||
|
||||
|
||||
void SHOWEXCEPTION(CBasicException& ex)
|
||||
{
|
||||
try {
|
||||
_ExceptionMessage(ex);
|
||||
}
|
||||
catch(CBasicException &ex2) {
|
||||
LogException(ex2);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
extern UINT32 MemDebugCounter;
|
||||
#ifdef JA2
|
||||
extern BOOLEAN gfPauseDueToPlayerGamePause;
|
||||
@@ -76,7 +102,9 @@ void GetRuntimeSettings( );
|
||||
|
||||
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
|
||||
|
||||
#if USE_CONSOLE
|
||||
Console g_Console("", "", "Lua Console", "no");
|
||||
#endif
|
||||
|
||||
#if !defined(JA2) && !defined(UTILS)
|
||||
void ProcessCommandLine(CHAR8 *pCommandLine);
|
||||
@@ -485,12 +513,20 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
if (wParam == '\\' &&
|
||||
lParam && KF_ALTDOWN)
|
||||
{
|
||||
g_Console.Create(ghWindow);
|
||||
cout << "LUA console ready" << endl;
|
||||
cout << "> ";
|
||||
// WANNE: We disable this for now in multiplayer, because user could enter "\" for the file transfer path
|
||||
if (!is_networked)
|
||||
{
|
||||
if (wParam == '\\' &&
|
||||
lParam && KF_ALTDOWN)
|
||||
{
|
||||
#if USE_CONSOLE
|
||||
g_Console.Create(ghWindow);
|
||||
cout << "LUA console ready" << endl;
|
||||
cout << "> ";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -515,8 +551,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
{
|
||||
FontTranslationTable *pFontTable;
|
||||
@@ -533,7 +567,31 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
#endif
|
||||
|
||||
// Second, read in settings
|
||||
GetRuntimeSettings( );
|
||||
std::list<CBasicException> exlist;
|
||||
try
|
||||
{
|
||||
GetRuntimeSettings( );
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
{
|
||||
// nothing is set up, no vfs, no video manager
|
||||
// regular error processing wouldn't work here
|
||||
// set default values and continue as if nothing has happened
|
||||
iResolution = 1;
|
||||
|
||||
gbPixelDepth = PIXEL_DEPTH;
|
||||
|
||||
SCREEN_WIDTH = 800;
|
||||
SCREEN_HEIGHT = 600;
|
||||
|
||||
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
|
||||
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
|
||||
|
||||
iScreenMode = 1;
|
||||
iPlayIntro = 0;
|
||||
// rethrow exception after full setup
|
||||
exlist.push_back(ex);
|
||||
}
|
||||
|
||||
// Initialize the Debug Manager - success doesn't matter
|
||||
InitializeDebugManager();
|
||||
@@ -603,12 +661,37 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
InitializeJA2Clock();
|
||||
//InitializeJA2TimerID();
|
||||
|
||||
#ifdef USE_VFS
|
||||
STRING512 sExecutableDir;
|
||||
GetExecutableDirectory( sExecutableDir );
|
||||
|
||||
//vfs::Path fullpath = vfs::Path(sExecutableDir) + vfs::Path("vfs_config.ini");
|
||||
|
||||
// set current directory to exe's directory
|
||||
SetCurrentDirectory(sExecutableDir);
|
||||
|
||||
//if(!InitVirtualFileSystem( fullpath ))
|
||||
//{
|
||||
// FastDebugMsg("FAILED : Initializing Virtual File System");
|
||||
// return FALSE;
|
||||
//}
|
||||
//THROWIFFALSE( InitVirtualFileSystem( fullpath ), L"Initializing Virtual File System failed");
|
||||
THROWIFFALSE( InitVirtualFileSystem( vfs_config_ini ), L"Initializing Virtual File System failed");
|
||||
|
||||
s_VfsIsInitialized = true;
|
||||
|
||||
GetVFS()->GetVirtualLocation(vfs::Path("Temp"),true)->SetIsExclusive(true);
|
||||
GetVFS()->GetVirtualLocation(vfs::Path("ShadeTables"),true)->SetIsExclusive(true);
|
||||
GetVFS()->GetVirtualLocation(vfs::Path(pMessageStrings[MSG_SAVEDIRECTORY]+3),true)->SetIsExclusive(true);
|
||||
GetVFS()->GetVirtualLocation(vfs::Path(pMessageStrings[MSG_MPSAVEDIRECTORY]+3),true)->SetIsExclusive(true);
|
||||
#else
|
||||
// Snap: moved the following from InitJA2SplashScreen for clarity
|
||||
STRING512 CurrentDir;
|
||||
STRING512 DataDir;
|
||||
|
||||
InitializeJA2Clock();
|
||||
//InitializeJA2TimerID();
|
||||
// Get Executable Directory
|
||||
GetExecutableDirectory( CurrentDir );
|
||||
|
||||
@@ -633,7 +716,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
if ( GetPrivateProfileString( "Ja2 Settings","CUSTOM_DATA_LOCATION", "", customDataPath, MAX_PATH, "..\\Ja2.ini" ) ) {
|
||||
gCustomDataCat.NewCat(std::string(CurrentDir) + '\\' + customDataPath);
|
||||
}
|
||||
|
||||
#endif
|
||||
//#ifdef JA2
|
||||
InitJA2SplashScreen();
|
||||
//#endif
|
||||
@@ -686,7 +769,11 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
guiMouseWheelMsg = RegisterWindowMessage( MSH_MOUSEWHEEL );
|
||||
|
||||
gfGameInitialized = TRUE;
|
||||
|
||||
|
||||
if(!exlist.empty())
|
||||
{
|
||||
RETHROWEXCEPTION(L"Error during reading runtime settings", &exlist.front());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -762,6 +849,10 @@ void ShutdownStandardGamingPlatform(void)
|
||||
UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
|
||||
|
||||
ShutdownDebugManager();
|
||||
|
||||
CLog::FlushFinally();
|
||||
vfs::CVirtualFileSystem::ShutdownVFS();
|
||||
CFileAllocator::Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -870,10 +961,78 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
|
||||
// ShowCursor(FALSE);
|
||||
|
||||
// Inititialize the SGP
|
||||
if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE)
|
||||
{ // We failed to initialize the SGP
|
||||
return 0;
|
||||
#ifdef USE_VFS
|
||||
STRING512 sExecutableDir;
|
||||
GetExecutableDirectory( sExecutableDir );
|
||||
SetCurrentDirectory(sExecutableDir);
|
||||
#endif
|
||||
try
|
||||
{
|
||||
// Inititialize the SGP
|
||||
if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE)
|
||||
{
|
||||
// We failed to initialize the SGP
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch(CBasicException &ex)
|
||||
{
|
||||
if(!s_VfsIsInitialized)
|
||||
{
|
||||
vfs::CFile* fonts = new vfs::CFile("Data/Fonts.slf");
|
||||
vfs::CSLFLibrary* slfLib = new vfs::CSLFLibrary(vfs::tReadableFile::Cast(fonts),"");
|
||||
if(slfLib->Init())
|
||||
{
|
||||
GetVFS()->AddLocation(slfLib,"doesn't matter");
|
||||
}
|
||||
// fonts not initialized
|
||||
FontTranslationTable *pFontTable = CreateEnglishTransTable( );
|
||||
if ( pFontTable == NULL )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Initialize Font Manager
|
||||
FastDebugMsg("Initializing the Font Manager");
|
||||
// Init the manager and copy the TransTable stuff into it.
|
||||
if ( !InitializeFontManager( 8, pFontTable ) )
|
||||
{
|
||||
FastDebugMsg("FAILED : Initializing Font Manager");
|
||||
return FALSE;
|
||||
}
|
||||
// Don't need this thing anymore, so get rid of it (but don't de-alloc the contents)
|
||||
MemFree( pFontTable );
|
||||
if ( !InitializeFonts( ) )
|
||||
{
|
||||
// Send debug message and quit
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "COULD NOT INUT FONT SYSTEM...");
|
||||
return( ERROR_SCREEN );
|
||||
}
|
||||
}
|
||||
gfProgramIsRunning = 1;
|
||||
LogException(ex);
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
gfProgramIsRunning = 1;
|
||||
CBasicException nex(ex.what(),_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
LogException(nex);
|
||||
SHOWEXCEPTION(nex);
|
||||
}
|
||||
catch(const char* msg)
|
||||
{
|
||||
gfProgramIsRunning = 1;
|
||||
CBasicException ex(msg,_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
LogException(ex);
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
gfProgramIsRunning = 1;
|
||||
CBasicException ex("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__);
|
||||
LogException( ex );
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
|
||||
#ifdef LUACONSOLE
|
||||
@@ -901,18 +1060,45 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
// attend to the gaming mechanics themselves
|
||||
Message.wParam = 0;
|
||||
|
||||
while (gfProgramIsRunning)
|
||||
try
|
||||
{
|
||||
// if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
|
||||
// { // We have a message on the WIN95 queue, let's get it
|
||||
if (!GetMessage(&Message, NULL, 0, 0))
|
||||
{ // It's quitting time
|
||||
return Message.wParam;
|
||||
MAGIC();
|
||||
while (gfProgramIsRunning)
|
||||
{
|
||||
if (!GetMessage(&Message, NULL, 0, 0))
|
||||
{
|
||||
// It's quitting time
|
||||
return Message.wParam;
|
||||
}
|
||||
// Ok, now that we have the message, let's handle it
|
||||
TranslateMessage(&Message);
|
||||
DispatchMessage(&Message);
|
||||
}
|
||||
// Ok, now that we have the message, let's handle it
|
||||
TranslateMessage(&Message);
|
||||
DispatchMessage(&Message);
|
||||
}
|
||||
catch(CBasicException &ex)
|
||||
{
|
||||
LogException(ex);
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
CBasicException nex(ex.what(),_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
LogException(nex);
|
||||
SHOWEXCEPTION(nex);
|
||||
}
|
||||
catch(const char* msg)
|
||||
{
|
||||
CBasicException ex(msg,_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
LogException(ex);
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
CBasicException ex("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__);
|
||||
LogException( ex );
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
|
||||
#if 0
|
||||
else
|
||||
{ // Windows hasn't processed any messages, therefore we handle the rest
|
||||
@@ -992,6 +1178,7 @@ void SGPExit(void)
|
||||
|
||||
void GetRuntimeSettings( )
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
// Runtime settings - for now use INI file - later use registry
|
||||
STRING512 INIFile; // Path to the ini file
|
||||
CHAR8 zScreenResolution[ 50 ];
|
||||
@@ -1000,19 +1187,43 @@ void GetRuntimeSettings( )
|
||||
GetExecutableDirectory( INIFile );
|
||||
|
||||
strcat(INIFile, "\\Ja2.ini");
|
||||
|
||||
#else
|
||||
CPropertyContainer oProps;
|
||||
oProps.InitFromIniFile("Ja2.ini");
|
||||
#endif
|
||||
iResolution = -1;
|
||||
|
||||
#ifndef USE_VFS
|
||||
if (GetPrivateProfileString( "Ja2 Settings","SCREEN_RESOLUTION", "", zScreenResolution, 50, INIFile ))
|
||||
{
|
||||
iResolution = atoi(zScreenResolution);
|
||||
}
|
||||
#else
|
||||
iResolution = oProps.GetIntProperty(L"Ja2 Settings", L"SCREEN_RESOLUTION", -1);
|
||||
|
||||
std::list<utf8string> ini_list;
|
||||
if(oProps.GetStringListProperty(L"Ja2 Settings", L"VFS_CONFIG_INI", ini_list, L""))
|
||||
{
|
||||
vfs_config_ini.clear();
|
||||
for(std::list<utf8string>::iterator it = ini_list.begin(); it != ini_list.end(); ++it)
|
||||
{
|
||||
vfs_config_ini.push_back(*it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs_config_ini.push_back(L"vfs_config.ini");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef JA2EDITOR
|
||||
#ifndef USE_VFS
|
||||
if (GetPrivateProfileString( "Ja2 Settings","EDITOR_SCREEN_RESOLUTION", "", zScreenResolution, 50, INIFile ))
|
||||
{
|
||||
iResolution = atoi(zScreenResolution);
|
||||
}
|
||||
#else
|
||||
iResolution = oProps.GetIntProperty("Ja2 Settings","EDITOR_SCREEN_RESOLUTION", -1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1038,7 +1249,7 @@ void GetRuntimeSettings( )
|
||||
iResY = 600;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
gbPixelDepth = GetPrivateProfileInt( "SGP", "PIXEL_DEPTH", PIXEL_DEPTH, INIFile );
|
||||
|
||||
SCREEN_WIDTH = GetPrivateProfileInt( "SGP", "WIDTH", iResX, INIFile );
|
||||
@@ -1054,6 +1265,25 @@ void GetRuntimeSettings( )
|
||||
|
||||
// WANNE: Should we play the intro?
|
||||
iPlayIntro = (int) GetPrivateProfileInt( "Ja2 Settings","PLAY_INTRO", iPlayIntro, INIFile );
|
||||
#else
|
||||
gbPixelDepth = (UINT8)oProps.GetIntProperty(L"SGP", L"PIXEL_DEPTH", PIXEL_DEPTH);
|
||||
|
||||
SCREEN_WIDTH = (UINT16)oProps.GetIntProperty(L"SGP", L"WIDTH", iResX);
|
||||
SCREEN_HEIGHT = (UINT16)oProps.GetIntProperty(L"SGP", L"HEIGHT", iResY);
|
||||
|
||||
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
|
||||
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
|
||||
|
||||
/* Sergeant_Kolja. 2007-02-20: runtime Windowed mode instead of compile-time */
|
||||
/* 1 for Windowed, 0 for Fullscreen */
|
||||
if( !bScreenModeCmdLine )
|
||||
{
|
||||
iScreenMode = oProps.GetIntProperty("Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode);
|
||||
}
|
||||
|
||||
// WANNE: Should we play the intro?
|
||||
iPlayIntro = oProps.GetIntProperty("Ja2 Settings","PLAY_INTRO", iPlayIntro);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShutdownWithErrorBox(CHAR8 *pcMessage)
|
||||
|
||||
@@ -1801,10 +1801,14 @@ UINT32 uiCount;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
#include "vfs.h"
|
||||
#include "PropertyContainer.h"
|
||||
|
||||
// Lesh modifications
|
||||
// Sound debug
|
||||
|
||||
#ifdef USE_VFS
|
||||
static CLog& s_SoundLog = *CLog::Create(SndDebugFileName,true);
|
||||
#endif
|
||||
//*****************************************************************************************
|
||||
// SoundLog
|
||||
// Writes string into log file
|
||||
@@ -1815,11 +1819,15 @@ UINT32 uiCount;
|
||||
//*****************************************************************************************
|
||||
void SoundLog(CHAR8 *strMessage)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
if ((SndDebug = fopen(SndDebugFileName, "a+t")) != NULL)
|
||||
{
|
||||
fprintf(SndDebug, "%s\n", strMessage);
|
||||
fclose(SndDebug);
|
||||
}
|
||||
#else
|
||||
s_SoundLog << strMessage << CLog::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//*****************************************************************************************
|
||||
@@ -1832,8 +1840,10 @@ void SoundLog(CHAR8 *strMessage)
|
||||
//*****************************************************************************************
|
||||
void InitLogging()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
if ((SndDebug = fopen(SndDebugFileName, "wt")) != NULL)
|
||||
{
|
||||
fclose(SndDebug);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2916,7 +2916,11 @@ BOOLEAN EraseMouseCursor( )
|
||||
//
|
||||
|
||||
pTmpPointer = LockMouseBuffer(&uiPitch);
|
||||
memset(pTmpPointer, 0, MAX_CURSOR_HEIGHT * uiPitch);
|
||||
// when there is no mouse buffer the game can run into an infinite loop (some DirectX stuff)
|
||||
if(pTmpPointer)
|
||||
{
|
||||
memset(pTmpPointer, 0, MAX_CURSOR_HEIGHT * uiPitch);
|
||||
}
|
||||
UnlockMouseBuffer();
|
||||
|
||||
// Don't set dirty
|
||||
|
||||
@@ -455,6 +455,54 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
|
||||
}
|
||||
}
|
||||
|
||||
if(hImage->ubBitDepth == 32)
|
||||
{
|
||||
hVObject->p16BPPObject = new SixteenBPPObjectInfo;
|
||||
int SIZE = hImage->usHeight*hImage->usWidth;
|
||||
hVObject->pPixData = new UINT32[SIZE];
|
||||
memcpy(hVObject->pPixData, hImage->p32BPPData, SIZE*sizeof(UINT32));
|
||||
hVObject->p16BPPObject->p16BPPData = NULL;
|
||||
hVObject->p16BPPObject->sOffsetX = 0;
|
||||
hVObject->p16BPPObject->sOffsetY = 0;
|
||||
hVObject->p16BPPObject->ubShadeLevel = 0;
|
||||
hVObject->p16BPPObject->usHeight = hImage->usHeight;
|
||||
hVObject->p16BPPObject->usWidth = hImage->usWidth;
|
||||
hVObject->p16BPPObject->usRegionIndex = 0;
|
||||
|
||||
hVObject->usNumberOf16BPPObjects = 1;
|
||||
hVObject->ubBitDepth = hImage->ubBitDepth;
|
||||
|
||||
if ( VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMFILE )
|
||||
{
|
||||
DestroyImage( hImage );
|
||||
}
|
||||
|
||||
return hVObject;
|
||||
}
|
||||
else if(hImage->ubBitDepth == 16)
|
||||
{
|
||||
hVObject->p16BPPObject = new SixteenBPPObjectInfo;
|
||||
int SIZE = hImage->usHeight*hImage->usWidth;
|
||||
hVObject->p16BPPObject->p16BPPData = new UINT16[SIZE];
|
||||
memcpy(hVObject->p16BPPObject->p16BPPData, hImage->p16BPPData, SIZE*sizeof(UINT16));
|
||||
hVObject->p16BPPObject->sOffsetX = 0;
|
||||
hVObject->p16BPPObject->sOffsetY = 0;
|
||||
hVObject->p16BPPObject->ubShadeLevel = 0;
|
||||
hVObject->p16BPPObject->usHeight = hImage->usHeight;
|
||||
hVObject->p16BPPObject->usWidth = hImage->usWidth;
|
||||
hVObject->p16BPPObject->usRegionIndex = 0;
|
||||
|
||||
hVObject->usNumberOf16BPPObjects = 1;
|
||||
hVObject->ubBitDepth = hImage->ubBitDepth;
|
||||
|
||||
if ( VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMFILE )
|
||||
{
|
||||
DestroyImage( hImage );
|
||||
}
|
||||
|
||||
return hVObject;
|
||||
}
|
||||
|
||||
// Check if returned himage is TRLE compressed - return error if not
|
||||
if ( ! (hImage->fFlags & IMAGE_TRLECOMPRESSED ) )
|
||||
{
|
||||
@@ -723,23 +771,49 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
|
||||
__try
|
||||
{
|
||||
// Assertions
|
||||
Assert( pBuffer != NULL );
|
||||
//Assert( pBuffer != NULL );
|
||||
THROWIFFALSE( pBuffer != NULL, L"No Destination Buffer" );
|
||||
|
||||
if ( hSrcVObject == NULL )
|
||||
{
|
||||
//int breakpoint=0;
|
||||
}
|
||||
|
||||
Assert( hSrcVObject != NULL );
|
||||
//Assert( hSrcVObject != NULL );
|
||||
THROWIFFALSE( hSrcVObject != NULL, L"No Source Object" )
|
||||
|
||||
SixteenBPPObjectInfo *image = NULL;
|
||||
// Check For Flags and bit depths
|
||||
switch( hSrcVObject->ubBitDepth )
|
||||
{
|
||||
case 32:
|
||||
image = &hSrcVObject->p16BPPObject[usIndex];
|
||||
#if 0
|
||||
Blt16BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
|
||||
image->p16BPPData, image->usWidth * sizeof(UINT16),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight,
|
||||
0 );
|
||||
#else
|
||||
Blt32BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
|
||||
(UINT32*)hSrcVObject->pPixData, image->usWidth * sizeof(UINT32),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 16:
|
||||
image = &hSrcVObject->p16BPPObject[usIndex];
|
||||
Blt16BPPTo16BPP( pBuffer, uiDestPitchBYTES,
|
||||
image->p16BPPData, image->usWidth * sizeof(UINT16),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight );
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
THROWIFFALSE( hSrcVObject->usNumberOfObjects > usIndex, L"Video object index is larger than the number of subimages");
|
||||
// Switch based on flags given
|
||||
do
|
||||
{
|
||||
|
||||
@@ -22,6 +22,85 @@
|
||||
#endif
|
||||
|
||||
|
||||
static UINT8 g_AlphaTimesValueCache[256][256];
|
||||
|
||||
class InitAlphaTimesValueCache
|
||||
{
|
||||
public:
|
||||
InitAlphaTimesValueCache()
|
||||
{
|
||||
for(unsigned int alpha = 0; alpha < 256; alpha++)
|
||||
{
|
||||
for(unsigned int val = 0; val < 256; val++)
|
||||
{
|
||||
// it can't get any simpler than that
|
||||
g_AlphaTimesValueCache[alpha][val] = (UINT8)( ((double)alpha/255.0) * val );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static InitAlphaTimesValueCache s_InitAlphaCache;
|
||||
|
||||
BOOLEAN Blt32BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight)
|
||||
{
|
||||
UINT32 *pSrcPtr;
|
||||
UINT16 *pDestPtr;
|
||||
UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
|
||||
Assert(pDest!=NULL);
|
||||
Assert(pSrc!=NULL);
|
||||
|
||||
pSrcPtr = (UINT32 *)((UINT8 *)pSrc+(iSrcYPos*uiSrcPitch)+(iSrcXPos*4));
|
||||
uiLineSkipSrc = uiSrcPitch-(uiWidth*4);
|
||||
|
||||
pDestPtr = (UINT16 *)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
|
||||
uiLineSkipDest = uiDestPitch-(uiWidth*2);
|
||||
|
||||
UINT8 alpha, dst_channel, src_channel;
|
||||
UINT8 red, green, blue;
|
||||
do
|
||||
{
|
||||
UINT32 w = uiWidth;
|
||||
do
|
||||
{
|
||||
//alpha = (UINT8)((0xFF000000 & *pSrcPtr) >> 24);
|
||||
alpha = 255;
|
||||
// r
|
||||
dst_channel = (UINT8)((0x1F & *pDestPtr) << 3);
|
||||
src_channel = (UINT8)((0xFF & *pSrcPtr) );
|
||||
//red = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
red = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
// g
|
||||
dst_channel = (UINT8)((0x7E0 & *pDestPtr) >> 3);
|
||||
src_channel = (UINT8)((0xFF00 & *pSrcPtr) >> 8);
|
||||
//green = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
green = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
// b
|
||||
dst_channel = (UINT8)((0xF800 & *pDestPtr) >> 8);
|
||||
src_channel = (UINT8)((0xFF0000 & *pSrcPtr) >> 16);
|
||||
//blue = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
blue = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
|
||||
UINT32 newcolor = FROMRGB(red,green,blue);
|
||||
*pDestPtr = Get16BPPColor(newcolor);
|
||||
pSrcPtr++;
|
||||
pDestPtr++;
|
||||
}
|
||||
while (--w != 0);
|
||||
pSrcPtr = (UINT32*)((UINT8*)pSrcPtr + uiLineSkipSrc);
|
||||
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
|
||||
}
|
||||
while (--uiHeight != 0);
|
||||
|
||||
return ( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Here are bliting functions. If you dont know what kind of functions they are so :
|
||||
* correct me if im wrong they copy array of bits from src image to dest image
|
||||
* maby we can get ride this includes above? we dont need theme here i thinks so
|
||||
@@ -6907,6 +6986,15 @@ UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
Assert(pDest!=NULL);
|
||||
Assert(pSrc!=NULL);
|
||||
|
||||
if(iSrcXPos >= SCREEN_WIDTH)
|
||||
return false;
|
||||
if(iSrcYPos >= SCREEN_HEIGHT)
|
||||
return false;
|
||||
if(iSrcXPos + uiWidth > SCREEN_WIDTH)
|
||||
uiWidth = SCREEN_WIDTH - iSrcXPos;
|
||||
if(iSrcYPos + uiHeight > SCREEN_HEIGHT)
|
||||
uiHeight = SCREEN_HEIGHT - iSrcYPos;
|
||||
|
||||
pSrcPtr=(UINT16 *)((UINT8 *)pSrc+(iSrcYPos*uiSrcPitch)+(iSrcXPos*2));
|
||||
pDestPtr=(UINT16 *)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
|
||||
uiLineSkipDest=uiDestPitch-(uiWidth*2);
|
||||
@@ -6978,7 +7066,22 @@ UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
pDestPtr=(UINT16 *)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
|
||||
uiLineSkipDest=uiDestPitch-(uiWidth*2);
|
||||
uiLineSkipSrc=uiSrcPitch-(uiWidth*2);
|
||||
|
||||
#if 1
|
||||
do
|
||||
{
|
||||
UINT32 w = uiWidth;
|
||||
do
|
||||
{
|
||||
if (*pSrcPtr != usTrans) *pDestPtr = *pSrcPtr;
|
||||
pSrcPtr++;
|
||||
pDestPtr++;
|
||||
}
|
||||
while (--w != 0);
|
||||
pSrcPtr = (UINT16*)((UINT8*)pSrcPtr + uiLineSkipSrc);
|
||||
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
|
||||
}
|
||||
while (--uiHeight != 0);
|
||||
#else
|
||||
__asm {
|
||||
mov esi, pSrcPtr
|
||||
mov edi, pDestPtr
|
||||
@@ -7007,7 +7110,7 @@ Blit3:
|
||||
jnz BlitNewLine
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,8 @@ BOOLEAN BlitZRect(UINT16 *pZBuffer, UINT32 uiPitch, INT16 sLeft, INT16 sTop, INT
|
||||
|
||||
// New 16/16 blitters
|
||||
|
||||
BOOLEAN Blt32BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight);
|
||||
|
||||
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 );
|
||||
|
||||
@@ -2057,7 +2057,7 @@ void VerifyTownTrainingIsPaidFor( void )
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -3950,9 +3950,9 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
|
||||
|
||||
// factor in their mutual relationship
|
||||
if (OKToCheckOpinion(pInstructor->ubProfile))
|
||||
bOpinionFactor = gMercProfiles[ pStudent->ubProfile ].bMercOpinion[ pInstructor->ubProfile ];
|
||||
bOpinionFactor = gMercProfiles[ pStudent->ubProfile ].bMercOpinion[ pInstructor->ubProfile ];
|
||||
if (OKToCheckOpinion(pStudent->ubProfile))
|
||||
bOpinionFactor += gMercProfiles[ pInstructor->ubProfile ].bMercOpinion[ pStudent->ubProfile ] / 2;
|
||||
bOpinionFactor += gMercProfiles[ pInstructor->ubProfile ].bMercOpinion[ pStudent->ubProfile ] / 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -10663,7 +10663,7 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn
|
||||
CHAR16 sString[ 128 ];
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
pSoldier = NULL;
|
||||
|
||||
@@ -10982,7 +10982,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam )
|
||||
|
||||
|
||||
// sets assignment for the list
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( gCharactersList[ iCounter ].fValid ) &&
|
||||
( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) &&
|
||||
@@ -11542,7 +11542,7 @@ SOLDIERTYPE *GetSelectedAssignSoldier( BOOLEAN fNullOK )
|
||||
if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
|
||||
{
|
||||
// mapscreen version
|
||||
if( ( bSelectedAssignChar >= 0 ) && ( bSelectedAssignChar < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) &&
|
||||
if( ( bSelectedAssignChar >= 0 ) && ( bSelectedAssignChar < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) &&
|
||||
( gCharactersList[ bSelectedAssignChar ].fValid ) )
|
||||
{
|
||||
pSoldier = &Menptr[ gCharactersList[ bSelectedAssignChar ].usSolID ];
|
||||
|
||||
@@ -87,6 +87,8 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
{
|
||||
|
||||
BOOLEAN bMercDayOne = FALSE;
|
||||
// BF : file access is bad, especially if a function is called so often.
|
||||
#if 0
|
||||
// Kaiden: Opening the INI File
|
||||
CIniReader iniReader("..\\Ja2_Options.ini");
|
||||
|
||||
@@ -96,7 +98,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
// for some reason, this can't be in gamesettings.cpp
|
||||
// or it won't work.
|
||||
bMercDayOne = iniReader.ReadBoolean("Options","MERC_DAY_ONE",FALSE);
|
||||
|
||||
#endif
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent");
|
||||
|
||||
if( gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents && _KeyDown( NUM_LOCK ) )
|
||||
|
||||
+14
-6
@@ -519,10 +519,14 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
|
||||
{
|
||||
SetLaptopExitScreen( MAP_SCREEN ); //hayden
|
||||
SetPendingNewScreen( MAP_SCREEN );
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_CHAT, L"------------------------------------------------------");
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_CHAT, MPHelp[0]);
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_CHAT, L"------------------------------------------------------");
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_CHAT, MPHelp[1]);
|
||||
|
||||
// WANNE: No more used
|
||||
/*
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_MPSYSTEM, L"------------------------------------------------------");
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_MPSYSTEM, MPHelp[0]);
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_MPSYSTEM, L"------------------------------------------------------");
|
||||
ScreenMsg( MSG_FONT_WHITE, MSG_MPSYSTEM, MPHelp[1]);
|
||||
*/
|
||||
|
||||
}
|
||||
else
|
||||
@@ -698,7 +702,7 @@ void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex )
|
||||
// TEMP!
|
||||
// make carman's opinion of us high!
|
||||
if (OKToCheckOpinion(ubProfileIndex))
|
||||
gMercProfiles[ 78 ].bMercOpinion[ ubProfileIndex ] = 25;
|
||||
gMercProfiles[ 78 ].bMercOpinion[ ubProfileIndex ] = 25;
|
||||
|
||||
}
|
||||
else if ( uiCount == 1 )
|
||||
@@ -896,5 +900,9 @@ void ReStartingGame()
|
||||
// Reset timer callbacks
|
||||
gpCustomizableTimerCallback = NULL;
|
||||
|
||||
gubCheatLevel = STARTING_CHEAT_LEVEL;
|
||||
// WANNE - MP: Set cheat level to 0 for mp
|
||||
if (!is_networked)
|
||||
gubCheatLevel = STARTING_CHEAT_LEVEL;
|
||||
else
|
||||
gubCheatLevel = 0;
|
||||
}
|
||||
@@ -432,7 +432,7 @@ void InitalizeVehicleAndCharacterList( void )
|
||||
|
||||
void SetEntryInSelectedCharacterList( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// set this entry to selected
|
||||
fSelectedListOfMercsForMapScreen[ bEntry ] = TRUE ;
|
||||
@@ -442,7 +442,7 @@ void SetEntryInSelectedCharacterList( INT8 bEntry )
|
||||
|
||||
void ResetEntryForSelectedList( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// set this entry to selected
|
||||
fSelectedListOfMercsForMapScreen[ bEntry ] = FALSE;
|
||||
@@ -469,7 +469,7 @@ void ResetSelectedListForMapScreen( void )
|
||||
|
||||
BOOLEAN IsEntryInSelectedListSet( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// is this entry in the selected list set?
|
||||
|
||||
@@ -480,7 +480,7 @@ BOOLEAN IsEntryInSelectedListSet( INT8 bEntry )
|
||||
|
||||
void ToggleEntryInSelectedList( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// toggle the value in the selected list
|
||||
fSelectedListOfMercsForMapScreen[ bEntry ] = !( fSelectedListOfMercsForMapScreen[ bEntry ] );
|
||||
@@ -522,7 +522,7 @@ BOOLEAN MultipleCharacterListEntriesSelected( void )
|
||||
INT32 iCounter = 0;
|
||||
|
||||
// check if more than one person is selected in the selected list
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[iCounter] == TRUE )
|
||||
{
|
||||
@@ -547,7 +547,7 @@ void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( INT8 bAssignme
|
||||
INT32 iCounter = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -579,7 +579,7 @@ void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX,
|
||||
INT32 iCounter = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -632,7 +632,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier )
|
||||
|
||||
|
||||
// deselect any other selected mercs that can't travel together with pSoldier
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -727,7 +727,7 @@ void SelectUnselectedMercsWhoMustMoveWithThisGuy( void )
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -759,7 +759,7 @@ BOOLEAN AnyMercInSameSquadOrVehicleIsSelected( SOLDIERTYPE *pSoldier )
|
||||
SOLDIERTYPE *pSoldier2 = NULL;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -838,7 +838,7 @@ void RestoreBackgroundForAssignmentGlowRegionList( void )
|
||||
if( iOldAssignmentLine != giAssignHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 66, Y_START - 1, 118 + 1 - 67, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
RestoreExternBackgroundRect( 66, Y_START - 1, 118 + 1 - 67, ( INT16 )( ( ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -866,7 +866,7 @@ void RestoreBackgroundForDestinationGlowRegionList( void )
|
||||
if( iOldDestinationLine != giDestHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 182, Y_START - 1, 217 + 1 - 182, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
RestoreExternBackgroundRect( 182, Y_START - 1, 217 + 1 - 182, ( INT16 )( ( ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -894,7 +894,7 @@ void RestoreBackgroundForContractGlowRegionList( void )
|
||||
if( iOldContractLine != giContractHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 222, Y_START - 1, 250 + 1 - 222, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
RestoreExternBackgroundRect( 222, Y_START - 1, 250 + 1 - 222, ( INT16 )( ( ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -926,7 +926,7 @@ void RestoreBackgroundForSleepGlowRegionList( void )
|
||||
if( iOldSleepHighLine != giSleepHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 123, Y_START - 1, 142 + 1 - 123, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
RestoreExternBackgroundRect( 123, Y_START - 1, 142 + 1 - 123, ( INT16 )( ( ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -967,7 +967,7 @@ void PlayGlowRegionSound( void )
|
||||
INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber )
|
||||
{
|
||||
// valid character number?
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber )
|
||||
BOOLEAN IsCharacterSelectedForAssignment( INT16 sCharNumber )
|
||||
{
|
||||
// valid character number?
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ BOOLEAN IsCharacterSelectedForAssignment( INT16 sCharNumber )
|
||||
BOOLEAN IsCharacterSelectedForSleep( INT16 sCharNumber )
|
||||
{
|
||||
// valid character number?
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1249,7 +1249,7 @@ void CheckAndUpdateBasedOnContractTimes( void )
|
||||
INT32 iCounter = 0;
|
||||
INT32 iTimeRemaining = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[iCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -1345,7 +1345,7 @@ void HandleDisplayOfSelectedMercArrows( void )
|
||||
BltVideoObject( guiSAVEBUFFER , hHandle, 0,SELECTED_CHAR_ARROW_X, sYPosition , VO_BLT_SRCTRANSPARENCY,NULL );
|
||||
|
||||
// now run through the selected list of guys, an arrow for each
|
||||
for( ubCount = 0; ubCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; ubCount++ )
|
||||
for( ubCount = 0; ubCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ubCount++ )
|
||||
{
|
||||
if( gCharactersList[ ubCount ].fValid == TRUE )
|
||||
{
|
||||
@@ -2111,7 +2111,7 @@ void FindAndSetThisContractSoldier( SOLDIERTYPE *pSoldier )
|
||||
|
||||
fShowContractMenu = FALSE;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -2345,7 +2345,7 @@ INT32 GetNumberOfPeopleInCharacterList( void )
|
||||
INT32 iCounter = 0, iCount = 0;
|
||||
|
||||
// get the number of valid mercs in the mapscreen character list
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -2513,7 +2513,7 @@ void GoToNextCharacterInList( void )
|
||||
}
|
||||
|
||||
// is the current guy invalid or the first one?
|
||||
if( ( bSelectedInfoChar == -1 )|| ( bSelectedInfoChar == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
if( ( bSelectedInfoChar == -1 )|| ( bSelectedInfoChar == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
iCount = 0;
|
||||
}
|
||||
@@ -2522,9 +2522,9 @@ void GoToNextCharacterInList( void )
|
||||
iCount = bSelectedInfoChar + 1;
|
||||
}
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
{
|
||||
ChangeSelectedInfoChar( ( INT8 )iCount, TRUE );
|
||||
break;
|
||||
@@ -2533,7 +2533,7 @@ void GoToNextCharacterInList( void )
|
||||
{
|
||||
iCount++;
|
||||
|
||||
if( iCount >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
if( iCount >= giMAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
{
|
||||
iCount = 0;
|
||||
}
|
||||
@@ -2560,7 +2560,7 @@ void GoToPrevCharacterInList( void )
|
||||
// is the current guy invalid or the first one?
|
||||
if( ( bSelectedInfoChar == -1 ) || ( bSelectedInfoChar == 0 ) )
|
||||
{
|
||||
iCount = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
iCount = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2568,9 +2568,9 @@ void GoToPrevCharacterInList( void )
|
||||
}
|
||||
|
||||
// now run through the list and find first prev guy
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
{
|
||||
ChangeSelectedInfoChar( ( INT8 )iCount, TRUE );
|
||||
break;
|
||||
@@ -2582,7 +2582,7 @@ void GoToPrevCharacterInList( void )
|
||||
if( iCount < 0 )
|
||||
{
|
||||
// was FIRST_VEHICLE
|
||||
iCount = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
iCount = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3363,7 +3363,7 @@ void AddSoldierToMovingLists( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( pSoldierMovingList[ iCounter ] == pSoldier )
|
||||
{
|
||||
@@ -3459,7 +3459,7 @@ void InitializeMovingLists( void )
|
||||
giNumberOfVehiclesInSectorMoving = 0;
|
||||
|
||||
// init the soldiers
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// soldier is NOT moving
|
||||
pSoldierMovingList[ iCounter ] = NULL;
|
||||
@@ -3497,7 +3497,7 @@ BOOLEAN IsAnythingSelectedForMoving( void )
|
||||
|
||||
|
||||
// check soldiers
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if ( ( pSoldierMovingList[ iCounter ] != NULL ) && fSoldierIsMoving[ iCounter ] )
|
||||
{
|
||||
@@ -3580,7 +3580,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
||||
|
||||
// note that Skyrider can't be moved using the move box, and won't appear because the helicoprer is not in the char list
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid )
|
||||
{
|
||||
@@ -4442,7 +4442,7 @@ void HandleSettingTheSelectedListOfMercs( void )
|
||||
bSelectedDestChar = -1;
|
||||
|
||||
// run through the list of grunts
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// is the current guy a valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
@@ -6107,7 +6107,7 @@ BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbError
|
||||
// even if group is 0 (not that that should happen, should it?) still loop through for other mercs selected to move
|
||||
|
||||
// if anyone in the merc's group or also selected cannot move for whatever reason return false
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ BOOLEAN SaveContractRenewalDataToSaveGameFile( HWFILE hFile )
|
||||
{
|
||||
UINT32 uiNumBytesWritten;
|
||||
|
||||
for (int idx=0; idx < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
for (int idx=0; idx < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
FileWrite( hFile, &ContractRenewalList[idx], sizeof( CONTRACT_NEWAL_LIST_NODE ), &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( CONTRACT_NEWAL_LIST_NODE ) )
|
||||
{
|
||||
@@ -126,7 +126,7 @@ BOOLEAN LoadContractRenewalDataFromSaveGameFile( HWFILE hFile )
|
||||
{
|
||||
UINT32 uiNumBytesRead;
|
||||
|
||||
for (int idx=0; idx < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
for (int idx=0; idx < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
FileRead( hFile, &ContractRenewalList[idx], sizeof( CONTRACT_NEWAL_LIST_NODE ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( CONTRACT_NEWAL_LIST_NODE ) )
|
||||
{
|
||||
|
||||
+47
-18
@@ -550,23 +550,24 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
gfPendingEnemies = (NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) > mapMaximumNumberOfEnemies );
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
if( pSector->uiFlags & SF_USE_MAP_SETTINGS )
|
||||
{ //count the number of enemy placements in a map and use those
|
||||
SOLDIERINITNODE *curr = gSoldierInitHead;
|
||||
ubTotalAdmins = ubTotalTroops = ubTotalElites = 0;
|
||||
while( curr )
|
||||
|
||||
// OJW - 20090403 - override max ai in co-op
|
||||
if (is_networked && is_server && OVERRIDE_MAX_AI == 1)
|
||||
{
|
||||
float totalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites;
|
||||
ubTotalAdmins = ((float)pSector->ubNumAdmins / totalEnemies) * mapMaximumNumberOfEnemies;
|
||||
ubTotalTroops = ((float)pSector->ubNumTroops / totalEnemies) * mapMaximumNumberOfEnemies;
|
||||
ubTotalElites = ((float)pSector->ubNumElites / totalEnemies) * mapMaximumNumberOfEnemies;
|
||||
totalEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites;
|
||||
|
||||
// take care of any rounding losses
|
||||
while (totalEnemies < mapMaximumNumberOfEnemies)
|
||||
{
|
||||
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
switch( curr->pBasicPlacement->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: ubTotalAdmins++; break;
|
||||
case SOLDIER_CLASS_ARMY: ubTotalTroops++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubTotalElites++; break;
|
||||
}
|
||||
}
|
||||
curr = curr->next;
|
||||
// just fill out with standard troops
|
||||
ubTotalTroops++;
|
||||
totalEnemies++;
|
||||
}
|
||||
|
||||
pSector->ubNumAdmins = ubTotalAdmins;
|
||||
pSector->ubNumTroops = ubTotalTroops;
|
||||
pSector->ubNumElites = ubTotalElites;
|
||||
@@ -576,9 +577,37 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
}
|
||||
else
|
||||
{
|
||||
ubTotalAdmins = pSector->ubNumAdmins - pSector->ubAdminsInBattle;
|
||||
ubTotalTroops = pSector->ubNumTroops - pSector->ubTroopsInBattle;
|
||||
ubTotalElites = pSector->ubNumElites - pSector->ubElitesInBattle;
|
||||
|
||||
if( pSector->uiFlags & SF_USE_MAP_SETTINGS )
|
||||
{ //count the number of enemy placements in a map and use those
|
||||
SOLDIERINITNODE *curr = gSoldierInitHead;
|
||||
ubTotalAdmins = ubTotalTroops = ubTotalElites = 0;
|
||||
while( curr )
|
||||
{
|
||||
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
switch( curr->pBasicPlacement->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: ubTotalAdmins++; break;
|
||||
case SOLDIER_CLASS_ARMY: ubTotalTroops++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubTotalElites++; break;
|
||||
}
|
||||
}
|
||||
curr = curr->next;
|
||||
}
|
||||
pSector->ubNumAdmins = ubTotalAdmins;
|
||||
pSector->ubNumTroops = ubTotalTroops;
|
||||
pSector->ubNumElites = ubTotalElites;
|
||||
pSector->ubAdminsInBattle = 0;
|
||||
pSector->ubTroopsInBattle = 0;
|
||||
pSector->ubElitesInBattle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ubTotalAdmins = pSector->ubNumAdmins - pSector->ubAdminsInBattle;
|
||||
ubTotalTroops = pSector->ubNumTroops - pSector->ubTroopsInBattle;
|
||||
ubTotalElites = pSector->ubNumElites - pSector->ubElitesInBattle;
|
||||
}
|
||||
}
|
||||
|
||||
totalCountOfStationaryEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites;
|
||||
|
||||
@@ -2817,7 +2817,7 @@ BOOLEAN CreateDestroyDisplayTextEntryBox( UINT8 ubAction, STR16 pString, TEXT_EN
|
||||
gfRedrawQuestDebugSystem = TRUE;
|
||||
|
||||
//get the striong from the text field
|
||||
Get16BitStringFromField( 0, zText );
|
||||
Get16BitStringFromField( 0, zText, 32 );
|
||||
|
||||
//if the text is not null
|
||||
if( zText[0] != '\0' )
|
||||
|
||||
+10
-5
@@ -34,6 +34,7 @@
|
||||
#endif
|
||||
|
||||
#include "BobbyRMailOrder.h"
|
||||
#include "connect.h"
|
||||
|
||||
|
||||
#define TESTQUESTS
|
||||
@@ -1248,10 +1249,11 @@ void InternalStartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN
|
||||
{
|
||||
gubQuest[ubQuest] = QUESTINPROGRESS;
|
||||
|
||||
if ( fUpdateHistory )
|
||||
{
|
||||
SetHistoryFact( HISTORY_QUEST_STARTED, ubQuest, GetWorldTotalMin(), sSectorX, sSectorY );
|
||||
}
|
||||
if ( fUpdateHistory )
|
||||
{
|
||||
if (!is_networked)
|
||||
SetHistoryFact( HISTORY_QUEST_STARTED, ubQuest, GetWorldTotalMin(), sSectorX, sSectorY );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1330,9 +1332,12 @@ void CheckForQuests( UINT32 uiDay )
|
||||
// already started
|
||||
if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED)
|
||||
{
|
||||
|
||||
StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
|
||||
#ifdef TESTQUESTS
|
||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
|
||||
|
||||
if (!is_networked)
|
||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -4562,23 +4562,31 @@ void HourlyCheckStrategicAI()
|
||||
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
#include "vfs.h"
|
||||
#include "PropertyContainer.h"
|
||||
|
||||
static CLog& s_stratD = *CLog::Create(L"Strategic Decisions.txt", true);
|
||||
|
||||
void LogStrategicMsg( STR8 str, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR8 string[512];
|
||||
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen( "Strategic Decisions.txt", "a" );
|
||||
if( !fp )
|
||||
return;
|
||||
|
||||
#endif
|
||||
va_start(argptr, str );
|
||||
vsprintf( string, str, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf( fp, "%s\n", string );
|
||||
#else
|
||||
s_stratD << string << CLog::endl;
|
||||
#endif
|
||||
|
||||
if( gfDisplayStrategicAILogs )
|
||||
{
|
||||
@@ -4589,28 +4597,32 @@ void LogStrategicMsg( STR8 str, ... )
|
||||
OutputDebugString( (LPCSTR)String( "%s\n", string ) );
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
fclose( fp );
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogStrategicEvent( STR8 str, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR8 string[512];
|
||||
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen( "Strategic Decisions.txt", "a" );
|
||||
if( !fp )
|
||||
return;
|
||||
|
||||
#endif
|
||||
va_start(argptr, str );
|
||||
vsprintf( string, str, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf( fp, "\n%S:\n", WORLDTIMESTR );
|
||||
fprintf( fp, "%s\n", string );
|
||||
|
||||
#else
|
||||
s_stratD.Endl() << WORLDTIMESTR << ":" << CLog::endl << string << CLog::endl;
|
||||
#endif
|
||||
if( gfDisplayStrategicAILogs )
|
||||
{
|
||||
ScreenMsg( FONT_LTKHAKI, MSG_DIALOG, L"%S", string );
|
||||
@@ -4619,12 +4631,14 @@ void LogStrategicEvent( STR8 str, ... )
|
||||
{
|
||||
OutputDebugString( (LPCSTR)String( "%s\n", string ) );
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
fclose( fp );
|
||||
#endif
|
||||
}
|
||||
|
||||
void ClearStrategicLog()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
fp = fopen( "Strategic Decisions.txt", "w" );
|
||||
if( !fp )
|
||||
@@ -4633,6 +4647,9 @@ void ClearStrategicLog()
|
||||
fprintf( fp, "STRATEGIC LOG\n" );
|
||||
|
||||
fclose( fp );
|
||||
#else
|
||||
s_stratD.Flush();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1017,7 +1017,7 @@ void UpdateBuddyAndHatedCounters( void )
|
||||
if (OKToCheckOpinion(ubOtherProfileID)) {
|
||||
pProfile->bMercOpinion[ubOtherProfileID] += (HATED_OPINION - pProfile->bMercOpinion[ubOtherProfileID]) / (pProfile->bLearnToHateCount + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1050,15 +1050,15 @@ void UpdateBuddyAndHatedCounters( void )
|
||||
{
|
||||
// add to liked!
|
||||
if (OKToCheckOpinion(ubOtherProfileID)) {
|
||||
pProfile->bBuddy[2] = pProfile->bLearnToLike;
|
||||
pProfile->bMercOpinion[ubOtherProfileID] = BUDDY_OPINION;
|
||||
pProfile->bBuddy[2] = pProfile->bLearnToLike;
|
||||
pProfile->bMercOpinion[ubOtherProfileID] = BUDDY_OPINION;
|
||||
}
|
||||
}
|
||||
else if (pProfile->bLearnToLikeCount < pProfile->bLearnToLikeTime / 2)
|
||||
{
|
||||
// increase opinion of them!
|
||||
if (OKToCheckOpinion(ubOtherProfileID)) {
|
||||
pProfile->bMercOpinion[ubOtherProfileID] += (BUDDY_OPINION - pProfile->bMercOpinion[ubOtherProfileID]) / (pProfile->bLearnToLikeCount + 1);
|
||||
pProfile->bMercOpinion[ubOtherProfileID] += (BUDDY_OPINION - pProfile->bMercOpinion[ubOtherProfileID]) / (pProfile->bLearnToLikeCount + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -105,7 +105,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="false"
|
||||
|
||||
@@ -1163,7 +1163,7 @@ void HandleCompletionOfTownTrainingByGroupWithTrainer( SOLDIERTYPE *pTrainer )
|
||||
sSectorY = pTrainer->sSectorY;
|
||||
bSectorZ = pTrainer->bSectorZ;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -1298,7 +1298,7 @@ void BuildListOfUnpaidTrainableSectors( void )
|
||||
|
||||
if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN )
|
||||
{
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid )
|
||||
@@ -1337,11 +1337,11 @@ void BuildListOfUnpaidTrainableSectors( void )
|
||||
}
|
||||
|
||||
// now clean out repeated sectors
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1; iCounter++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounter ] > 0 )
|
||||
{
|
||||
for( iCounterB = iCounter + 1 ; iCounterB < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterB++ )
|
||||
for( iCounterB = iCounter + 1 ; iCounterB < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterB++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounterB ] == gsUnpaidStrategicSector[ iCounter ] )
|
||||
{
|
||||
@@ -1362,7 +1362,7 @@ INT32 GetNumberOfUnpaidTrainableSectors( void )
|
||||
BuildListOfUnpaidTrainableSectors();
|
||||
|
||||
// now count up the results
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounter ] > 0 )
|
||||
{
|
||||
@@ -1387,7 +1387,7 @@ void StartTrainingInAllUnpaidTrainableSectors()
|
||||
BuildListOfUnpaidTrainableSectors();
|
||||
|
||||
// pay up in each sector
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounter ] > 0 )
|
||||
{
|
||||
|
||||
+164
-109
@@ -1851,7 +1851,7 @@ BOOLEAN SetInfoChar( UINT8 ubID )
|
||||
{
|
||||
INT8 bCounter;
|
||||
|
||||
for ( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++)
|
||||
for ( bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++)
|
||||
{
|
||||
// skip invalid characters
|
||||
if ( gCharactersList[ bCounter ].fValid == TRUE )
|
||||
@@ -3121,7 +3121,7 @@ BOOLEAN CharacterIsInTransitAndHasItemPickedUp( INT8 bCharacterNumber )
|
||||
|
||||
void DisplayCharacterInfo( void )
|
||||
{
|
||||
Assert( bSelectedInfoChar < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
Assert( bSelectedInfoChar < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
Assert( gCharactersList[ bSelectedInfoChar ].fValid );
|
||||
|
||||
// set font buffer
|
||||
@@ -3313,7 +3313,7 @@ void HighLightAssignLine()
|
||||
UINT16 usColor;
|
||||
static INT32 iColorNum = STARTING_COLOR_NUM;
|
||||
static BOOLEAN fDelta=FALSE;
|
||||
static INT32 uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
static INT32 uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
INT16 usCount = 0;
|
||||
UINT16 usX;
|
||||
UINT16 usY;
|
||||
@@ -3323,7 +3323,7 @@ void HighLightAssignLine()
|
||||
// is this a valid line?
|
||||
if( ( giAssignHighLine == -1 ) || fShowInventoryFlag )
|
||||
{
|
||||
uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3354,7 +3354,7 @@ void HighLightAssignLine()
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
for( usCount = 0; usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
for( usCount = 0; usCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
{
|
||||
if( IsCharacterSelectedForAssignment( usCount ) == TRUE )
|
||||
{
|
||||
@@ -3377,7 +3377,7 @@ void HighLightAssignLine()
|
||||
LineDraw( TRUE, usX, usY, usX+ASSIGN_WIDTH, usY, usColor,pDestBuf);
|
||||
}
|
||||
|
||||
if( ( ( usCount == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
if( ( ( usCount == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
{
|
||||
LineDraw(TRUE, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX+ASSIGN_WIDTH, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf);
|
||||
}
|
||||
@@ -3397,7 +3397,7 @@ void HighLightDestLine()
|
||||
UINT16 usColor;
|
||||
static INT32 iColorNum = STARTING_COLOR_NUM;
|
||||
static BOOLEAN fDelta=FALSE;
|
||||
static INT32 uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
static INT32 uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
UINT16 usCount = 0;
|
||||
UINT16 usX;
|
||||
UINT16 usY;
|
||||
@@ -3406,7 +3406,7 @@ void HighLightDestLine()
|
||||
|
||||
if( ( giDestHighLine == -1 ) || fShowInventoryFlag )
|
||||
{
|
||||
uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3438,7 +3438,7 @@ void HighLightDestLine()
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
for( usCount = 0; usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
for( usCount = 0; usCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
{
|
||||
if( CharacterIsGettingPathPlotted( usCount ) == TRUE )
|
||||
{
|
||||
@@ -3457,7 +3457,7 @@ void HighLightDestLine()
|
||||
{
|
||||
LineDraw( TRUE, usX+4, usY, usX+DEST_ETA_WIDTH+4, usY, usColor,pDestBuf);
|
||||
}
|
||||
if( ( ( usCount == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
if( ( ( usCount == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
{
|
||||
LineDraw(TRUE, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX+DEST_ETA_WIDTH+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf);
|
||||
}
|
||||
@@ -3483,7 +3483,7 @@ void HighLightSleepLine()
|
||||
UINT16 usColor;
|
||||
static INT32 iColorNum = STARTING_COLOR_NUM;
|
||||
static BOOLEAN fDelta=FALSE;
|
||||
static INT32 uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
static INT32 uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
UINT16 usCount = 0;
|
||||
UINT16 usX, usX2;
|
||||
UINT16 usY;
|
||||
@@ -3493,7 +3493,7 @@ void HighLightSleepLine()
|
||||
// is this a valid line?
|
||||
if( ( giSleepHighLine == -1 ) || fShowInventoryFlag )
|
||||
{
|
||||
uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
uiOldHighlight = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3525,7 +3525,7 @@ void HighLightSleepLine()
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
for( usCount = 0; usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
for( usCount = 0; usCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
{
|
||||
if( IsCharacterSelectedForSleep( usCount ) == TRUE )
|
||||
{
|
||||
@@ -3546,7 +3546,7 @@ void HighLightSleepLine()
|
||||
{
|
||||
LineDraw( TRUE, usX+4, usY, usX2, usY, usColor,pDestBuf);
|
||||
}
|
||||
if( ( ( usCount == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
if( ( ( usCount == giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( giMAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
{
|
||||
LineDraw(TRUE, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX2, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf);
|
||||
}
|
||||
@@ -3583,7 +3583,7 @@ void AddCharacter( SOLDIERTYPE *pCharacter )
|
||||
// adding a vehicle?
|
||||
if( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{
|
||||
while( usVehicleLoop < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
while( usVehicleLoop < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
{
|
||||
if ( gCharactersList[ usVehicleLoop ].fValid )
|
||||
{
|
||||
@@ -3600,15 +3600,15 @@ void AddCharacter( SOLDIERTYPE *pCharacter )
|
||||
else
|
||||
{
|
||||
// go through character list until a blank is reached
|
||||
while( (gCharactersList[usCount].fValid)&&(usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS) )
|
||||
while( (gCharactersList[usCount].fValid)&&(usCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS) )
|
||||
{
|
||||
usCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Assert( usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
if (usCount >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
Assert( usCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
if (usCount >= giMAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3707,7 +3707,7 @@ void DisplayCharacterList()
|
||||
SetFontBackground(FONT_BLACK);
|
||||
|
||||
|
||||
for (sCount = 0; sCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
for (sCount = 0; sCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
{
|
||||
// skip invalid characters
|
||||
if ( gCharactersList[sCount].fValid == TRUE )
|
||||
@@ -3776,6 +3776,8 @@ void DrawMPPlayerList ()
|
||||
INT16 usX=0;
|
||||
INT16 usY=0;
|
||||
|
||||
static UINT8 pbar_id_player[4];
|
||||
|
||||
if (is_networked && is_client && is_connected)
|
||||
{
|
||||
wchar_t szPlayerName[30];
|
||||
@@ -3784,46 +3786,78 @@ void DrawMPPlayerList ()
|
||||
int row=0;
|
||||
for(int i=0; i < 4; i++)
|
||||
{
|
||||
//if (i != CLIENT_NUM)
|
||||
//{
|
||||
if (client_names[i] != NULL)
|
||||
if (client_names[i] != NULL)
|
||||
{
|
||||
// setup bouds for player dirty rect and progress bar
|
||||
int l,t,b,r;
|
||||
l = MP_PLAYER_X+1;
|
||||
r = l + MP_PLAYER_W - 1;
|
||||
t = MP_ROWSTART_Y+(row*Y_SIZE);
|
||||
b = t + Y_SIZE - 1;
|
||||
|
||||
// set up or destroy progress bar if needed
|
||||
if (client_downloading[i] == 1 && pbar_id_player[i] == 0)
|
||||
{
|
||||
if (client_ready[i]==1)
|
||||
{
|
||||
SetFontForeground( FONT_GREEN );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFontForeground( FONT_WHITE );
|
||||
}
|
||||
|
||||
if (strcmp(client_names[i],"")!=0)
|
||||
{
|
||||
// valid player
|
||||
memset(szPlayerName,0,30*sizeof(wchar_t));
|
||||
mbstowcs( szPlayerName,client_names[i],30);
|
||||
FindFontCenterCoordinates((short)MP_PLAYER_X + 1, (short)(MP_ROWSTART_Y+(row*Y_SIZE)), (short)MP_PLAYER_W, (short)Y_SIZE, szPlayerName, (long)MAP_SCREEN_FONT, &usX, &usY);
|
||||
DrawString( (STR16)szPlayerName , usX,usY, MAP_SCREEN_FONT);
|
||||
|
||||
// <TODO> check for gametype here
|
||||
//wcscpy(szTeam,L"N/A");
|
||||
if (PLAYER_BSIDE==MP_TYPE_DEATHMATCH)
|
||||
wcscpy(szTeam,L"N/A");
|
||||
else
|
||||
wcscpy(szTeam,gszMPTeamNames[client_teams[i]]);
|
||||
FindFontCenterCoordinates((short)MP_TEAM_X + 1, (short)(MP_ROWSTART_Y+(row*Y_SIZE)), (short)MP_TEAM_W, (short)Y_SIZE, szTeam, (long)MAP_SCREEN_FONT, &usX, &usY);
|
||||
DrawString( szTeam,usX,(short)usY, MAP_SCREEN_FONT);
|
||||
|
||||
wcscpy(szCompass,(RANDOM_SPAWN==1 ? L"?" : gszMPEdgesText[client_edges[i]]));
|
||||
FindFontCenterCoordinates((short)MP_COMPASS_X + 1, (short)(MP_ROWSTART_Y+(row*Y_SIZE)), (short)MP_COMPASS_W, (short)Y_SIZE, szCompass, (long)MAP_SCREEN_FONT, &usX, &usY);
|
||||
DrawString(szCompass , usX,(short)usY, MAP_SCREEN_FONT);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
fTeamPanelDirty = true;
|
||||
|
||||
CreateProgressBarNoBorder(i,l,t,r,b);
|
||||
SetProgressBarColor(i,112,154,209);
|
||||
SetProgressBarRenderBuffer(i,guiSAVEBUFFER);
|
||||
pbar_id_player[i] = 1;
|
||||
}
|
||||
else if (client_downloading[i] == 0 && pbar_id_player[i] == 1)
|
||||
{
|
||||
fTeamPanelDirty = true;
|
||||
RemoveProgressBar(i);
|
||||
pbar_id_player[i] = 0;
|
||||
}
|
||||
|
||||
// render the progress bar if needed
|
||||
if (client_downloading[i] == 1 && pbar_id_player[i] == 1)
|
||||
{
|
||||
RenderProgressBar(i,client_progress[i]);
|
||||
}
|
||||
|
||||
//}
|
||||
if (client_ready[i]==1)
|
||||
{
|
||||
SetFontForeground( FONT_GREEN );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFontForeground( FONT_WHITE );
|
||||
}
|
||||
|
||||
if (strcmp(client_names[i],"")!=0)
|
||||
{
|
||||
// valid player
|
||||
memset(szPlayerName,0,30*sizeof(wchar_t));
|
||||
mbstowcs( szPlayerName,client_names[i],30);
|
||||
FindFontCenterCoordinates((short)MP_PLAYER_X + 1, (short)(MP_ROWSTART_Y+(row*Y_SIZE)), (short)MP_PLAYER_W, (short)Y_SIZE, szPlayerName, (long)MAP_SCREEN_FONT, &usX, &usY);
|
||||
// do it manually here so as DrawString overrides the dirty rects
|
||||
// we want the dirty rect to include progress bar as well as player text
|
||||
SetFont(MAP_SCREEN_FONT);
|
||||
mprintf(usX,usY,(STR16)szPlayerName);
|
||||
int iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, l, t, r, b);
|
||||
SetBackgroundRectFilled( iBack );
|
||||
//DrawString( (STR16)szPlayerName , usX,usY, MAP_SCREEN_FONT);
|
||||
|
||||
// <TODO> check for gametype here
|
||||
//wcscpy(szTeam,L"N/A");
|
||||
if (PLAYER_BSIDE==MP_TYPE_DEATHMATCH)
|
||||
wcscpy(szTeam,L"N/A");
|
||||
else
|
||||
wcscpy(szTeam,gszMPTeamNames[client_teams[i]]);
|
||||
FindFontCenterCoordinates((short)MP_TEAM_X + 1, (short)(MP_ROWSTART_Y+(row*Y_SIZE)), (short)MP_TEAM_W, (short)Y_SIZE, szTeam, (long)MAP_SCREEN_FONT, &usX, &usY);
|
||||
DrawString( szTeam,usX,(short)usY, MAP_SCREEN_FONT);
|
||||
|
||||
wcscpy(szCompass,(RANDOM_SPAWN==1 ? L"?" : gszMPEdgesText[client_edges[i]]));
|
||||
FindFontCenterCoordinates((short)MP_COMPASS_X + 1, (short)(MP_ROWSTART_Y+(row*Y_SIZE)), (short)MP_COMPASS_W, (short)Y_SIZE, szCompass, (long)MAP_SCREEN_FONT, &usX, &usY);
|
||||
DrawString(szCompass , usX,(short)usY, MAP_SCREEN_FONT);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the Server Info
|
||||
@@ -3875,15 +3909,28 @@ void DrawMPPlayerList ()
|
||||
swprintf(szSquadSize,L"%i",MAX_MERCS);
|
||||
DrawString( szSquadSize , MP_GAMEINFO_X + StringPixLength(gszMPMapscreenText[2],MAP_SCREEN_FONT),MP_ROWSTART_Y+(3*Y_SIZE), MAP_SCREEN_FONT);
|
||||
|
||||
row = 4;
|
||||
if (RANDOM_MERCS)
|
||||
{
|
||||
// Random Mercs
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
DrawString( gszMPMapscreenText[5] , MP_GAMEINFO_X ,MP_ROWSTART_Y+(4*Y_SIZE), MAP_SCREEN_FONT);
|
||||
DrawString( gszMPMapscreenText[5] , MP_GAMEINFO_X ,MP_ROWSTART_Y+(row*Y_SIZE), MAP_SCREEN_FONT);
|
||||
SetFontForeground( FONT_WHITE );
|
||||
DrawString( gszMPMapscreenText[6] , MP_GAMEINFO_X + StringPixLength(gszMPMapscreenText[5],MAP_SCREEN_FONT),MP_ROWSTART_Y+(4*Y_SIZE), MAP_SCREEN_FONT);
|
||||
DrawString( gszMPMapscreenText[6] , MP_GAMEINFO_X + StringPixLength(gszMPMapscreenText[5],MAP_SCREEN_FONT),MP_ROWSTART_Y+(row*Y_SIZE), MAP_SCREEN_FONT);
|
||||
row++;
|
||||
}
|
||||
|
||||
// Server Version
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
DrawString( gszMPMapscreenText[8] , MP_GAMEINFO_X ,MP_ROWSTART_Y+(row*Y_SIZE), MAP_SCREEN_FONT);
|
||||
row++;
|
||||
|
||||
wchar_t szServerVer[30];
|
||||
memset(szServerVer,0,30*sizeof(wchar_t));
|
||||
mbstowcs( szServerVer,MPVERSION,30);
|
||||
SetFontForeground( FONT_WHITE );
|
||||
DrawString( szServerVer , MP_GAMEINFO_X ,MP_ROWSTART_Y+(row*Y_SIZE), MAP_SCREEN_FONT);
|
||||
|
||||
}
|
||||
}
|
||||
void DestroyMPCompassBox( void )
|
||||
@@ -5257,9 +5304,9 @@ UINT32 MapScreenHandle(void)
|
||||
{
|
||||
fShowInventoryFlag = FALSE;
|
||||
// CHRISL: Added call to re-render the bottom panel
|
||||
// RenderMapScreenInterfaceBottom ( TRUE );
|
||||
RenderMapScreenInterfaceBottom ( TRUE );
|
||||
// set help text for item glow region
|
||||
//XXXj? SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] );
|
||||
SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -6536,20 +6583,25 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
||||
case BACKSPACE:
|
||||
StopAnyCurrentlyTalkingSpeech( );
|
||||
break;
|
||||
|
||||
// multiplayer: Roman: Should be changed, because the keys are already bount to another feature
|
||||
|
||||
case F1:
|
||||
// WANNE: No more needed
|
||||
/*
|
||||
if (is_networked)
|
||||
{
|
||||
mp_help();
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case F2:
|
||||
// WANNE: No more needed
|
||||
/*
|
||||
if (is_networked)
|
||||
{
|
||||
mp_help2();
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case F3:
|
||||
case F4:
|
||||
case F5:
|
||||
@@ -9319,7 +9371,7 @@ void CreateMouseRegionsForTeamList( void )
|
||||
// the info region...is the background for the list itself
|
||||
|
||||
// OJW - MP
|
||||
int max_rows = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
int max_rows = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
if (is_networked)
|
||||
max_rows = 7; // <TODO> check this value is correct / unhardcode it
|
||||
|
||||
@@ -9415,7 +9467,7 @@ void DestroyMouseRegionsForTeamList( void )
|
||||
// will destroy mouse regions overlaying the team list area
|
||||
INT32 sCounter = 0;
|
||||
|
||||
for( sCounter = 0; sCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCounter++ )
|
||||
for( sCounter = 0; sCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCounter++ )
|
||||
{
|
||||
MSYS_RemoveRegion( &gTeamListNameRegion[ sCounter ]);
|
||||
MSYS_RemoveRegion( &gTeamListAssignmentRegion[ sCounter ]);
|
||||
@@ -9463,7 +9515,7 @@ void MPReadyButtonCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
else if (allowlaptop)
|
||||
{
|
||||
// warn the user that cannot change once buying has commenced
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, gszMPMapscreenText[3]);
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, gszMPMapscreenText[3]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -9491,11 +9543,11 @@ void MPReadyButtonCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
else if (allowlaptop)
|
||||
{
|
||||
// warn the user that cannot change once buying has commenced
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, gszMPMapscreenText[4]);
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, gszMPMapscreenText[4]);
|
||||
}
|
||||
else if (RANDOM_SPAWN)
|
||||
{
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, L"Cannot change edge, the game is set to random spawn");
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"Cannot change edge, the game is set to random spawn");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -9528,7 +9580,7 @@ void MPCompassChangeCallback( MOUSE_REGION * pReason, INT32 iReason)
|
||||
else if (allowlaptop)
|
||||
{
|
||||
// warn the user that cannot change once buying has commenced
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, gszMPMapscreenText[3]);
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, gszMPMapscreenText[3]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -9557,11 +9609,11 @@ void MPTeamChangeCallback( MOUSE_REGION * pReason, INT32 iReason)
|
||||
else if (allowlaptop)
|
||||
{
|
||||
// warn the user that cannot change once buying has commenced
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, gszMPMapscreenText[4]);
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, gszMPMapscreenText[4]);
|
||||
}
|
||||
else if (RANDOM_SPAWN)
|
||||
{
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, L"Cannot change edge, the game is set to random spawn");
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"Cannot change edge, the game is set to random spawn");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -9939,7 +9991,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason )
|
||||
// Select all characters in squad
|
||||
INT16 iCounter;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -11054,20 +11106,22 @@ void ReBuildCharactersList( void )
|
||||
|
||||
|
||||
// add in characters
|
||||
for ( sCount = 0; sCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
for ( sCount = 0; sCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
{
|
||||
// clear this slot
|
||||
gCharactersList[ sCount ].fValid = FALSE;
|
||||
gCharactersList[ sCount ].usSolID = 0;
|
||||
}
|
||||
|
||||
for ( sCount = 0; sCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
// fills array with pressence of player controlled characters
|
||||
for ( INT32 cnt=gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++)
|
||||
{
|
||||
// add character into the cleared slot
|
||||
AddCharacter( &Menptr[ gTacticalStatus.Team[ OUR_TEAM ].bFirstID + sCount ] );
|
||||
if(Menptr[ cnt ].bActive == 1)
|
||||
{
|
||||
AddCharacter( &Menptr[ cnt ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sort them according to current sorting method
|
||||
SortListOfMercsInTeamPanel( FALSE );
|
||||
|
||||
@@ -11156,7 +11210,7 @@ void EnableDisableTeamListRegionsAndHelpText( void )
|
||||
INT8 bCharNum;
|
||||
|
||||
|
||||
for( bCharNum = 0; bCharNum < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCharNum++ )
|
||||
for( bCharNum = 0; bCharNum < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCharNum++ )
|
||||
{
|
||||
if( gCharactersList[ bCharNum ].fValid == FALSE )
|
||||
{
|
||||
@@ -11351,7 +11405,7 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone )
|
||||
}
|
||||
|
||||
// otherwise, find this character
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
for( bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
if( gCharactersList[bCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -11378,7 +11432,7 @@ void HandleSpontanousTalking( )
|
||||
|
||||
if( DialogueActive() == FALSE )
|
||||
{
|
||||
if( ( bSelectedInfoChar != -1 ) && ( bSelectedInfoChar < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
if( ( bSelectedInfoChar != -1 ) && ( bSelectedInfoChar < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
ContinueDialogue( ( &Menptr[gCharactersList[bSelectedInfoChar].usSolID] ), TRUE );
|
||||
}
|
||||
@@ -11514,7 +11568,7 @@ void RebuildWayPointsForAllSelectedCharsGroups( void )
|
||||
|
||||
memset( fGroupIDRebuilt, FALSE, sizeof( fGroupIDRebuilt ) );
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) )
|
||||
{
|
||||
@@ -11946,7 +12000,7 @@ INT8 GetLastValidCharacterInTeamPanelList( void )
|
||||
INT8 iCounter = 0, iValue = 0;
|
||||
|
||||
// run through the list and find the last valid guy in the list
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -12254,7 +12308,7 @@ void UpdateBadAssignments( void )
|
||||
{
|
||||
UINT32 iCounter;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -12312,7 +12366,7 @@ BOOLEAN AnyMercsLeavingRealSoon()
|
||||
UINT32 uiTimeInMin = GetWorldTotalMin();
|
||||
BOOLEAN fFoundOne = FALSE;
|
||||
|
||||
for( uiCounter = 0; uiCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; uiCounter++ )
|
||||
for( uiCounter = 0; uiCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; uiCounter++ )
|
||||
{
|
||||
if( gCharactersList[ uiCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -12892,7 +12946,7 @@ void TellPlayerWhyHeCantCompressTime( void )
|
||||
// WANNE - MP: It is forbidden to compress time in multiplayer
|
||||
else if (is_networked)
|
||||
{
|
||||
ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"You cannot compress time in multiplayer game. Press '3' to start the battle.");
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, MPClientMessage[65]);
|
||||
}
|
||||
else if ( !AnyUsableRealMercenariesOnTeam() )
|
||||
{
|
||||
@@ -13032,15 +13086,17 @@ void AddTeamPanelSortButtonsForMapScreen( void )
|
||||
void AddMPButtonsForMapScreen( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
//SGPFILENAME filename;
|
||||
SGPFILENAME filename;
|
||||
INT32 iImageIndex[ MAX_MP_BUTTONS+1 ] = { 0, 1, 3, 5 , 7 }; // sleep image is out or order (last)
|
||||
INT32 iPressedIndex[ MAX_MP_BUTTONS+1 ] = { 0 , 2 , 4 , 6 , 8 };
|
||||
|
||||
GetMLGFilename( filename, MLG_MP_GOLDPIECEBUTTONS );
|
||||
|
||||
// <TODO> add start game button and hide it...
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_MP_BUTTONS+1; iCounter++ )
|
||||
{
|
||||
giMapMPButtonImage[ iCounter ] = LoadButtonImage( "INTERFACE\\MPGOLDPIECEBUTTONS.STI", -1, iImageIndex[ iCounter ] , -1, iPressedIndex[ iCounter ] , -1 );
|
||||
giMapMPButtonImage[ iCounter ] = LoadButtonImage( filename, -1, iImageIndex[ iCounter ] , -1, iPressedIndex[ iCounter ] , -1 );
|
||||
|
||||
if (iCounter < MAX_MP_BUTTONS)
|
||||
{
|
||||
@@ -13084,7 +13140,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse
|
||||
}
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// set current entry to null
|
||||
pSelectedSoldier[ iCounter ] = NULL;
|
||||
@@ -13321,11 +13377,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse
|
||||
|
||||
|
||||
// now select all the soldiers that were selected before
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( pSelectedSoldier[ iCounter ] )
|
||||
{
|
||||
for( iCounterA = 0; iCounterA < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterA++ )
|
||||
for( iCounterA = 0; iCounterA < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterA++ )
|
||||
{
|
||||
// is this entry even valid
|
||||
if( gCharactersList[ iCounterA ].fValid == FALSE )
|
||||
@@ -13463,7 +13519,7 @@ void HandleAssignmentsDoneAndAwaitingFurtherOrders( void )
|
||||
// update timer so that we only run check so often
|
||||
giFlashAssignBaseTime = iCurrentTime;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
{
|
||||
@@ -13501,7 +13557,7 @@ void DisplayIconsForMercsAsleep( void )
|
||||
|
||||
GetVideoObject(&hHandle, guiSleepIcon );
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -13618,7 +13674,7 @@ BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber )
|
||||
|
||||
|
||||
Assert( bCharNumber >= 0 );
|
||||
Assert( bCharNumber < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
Assert( bCharNumber < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
|
||||
// invalid character slot selected?
|
||||
if( gCharactersList[ bCharNumber ].fValid == FALSE )
|
||||
@@ -13957,7 +14013,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA
|
||||
|
||||
INT16 iCounter;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -14012,7 +14068,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA
|
||||
|
||||
INT16 iCounter;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -14118,7 +14174,7 @@ INT32 GetContractExpiryTime( SOLDIERTYPE *pSoldier )
|
||||
|
||||
void ChangeSelectedInfoChar( INT8 bCharNumber, BOOLEAN fResetSelectedList )
|
||||
{
|
||||
Assert( ( bCharNumber >= -1 ) && ( bCharNumber < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
Assert( ( bCharNumber >= -1 ) && ( bCharNumber < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
if( ( bCharNumber != -1 ) && ( gCharactersList[ bCharNumber ].fValid == FALSE ) )
|
||||
return;
|
||||
@@ -14194,7 +14250,7 @@ void CopyPathToAllSelectedCharacters( PathStPtr pPath )
|
||||
|
||||
|
||||
// run through list and copy paths for each selected character
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
{
|
||||
@@ -14232,7 +14288,7 @@ void CancelPathsOfAllSelectedCharacters()
|
||||
|
||||
|
||||
// cancel destination for the clicked and ALL other valid & selected characters with a route set
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
for( bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
// if we've clicked on a selected valid character
|
||||
if( ( gCharactersList[ bCounter ].fValid == TRUE ) && IsEntryInSelectedListSet( bCounter ) )
|
||||
@@ -14315,7 +14371,7 @@ INT16 CalcLocationValueForChar( INT32 iCounter )
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
INT16 sLocValue = 0;
|
||||
|
||||
Assert( iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
Assert( iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
return( sLocValue );
|
||||
@@ -14620,7 +14676,7 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void )
|
||||
UINT8 ubChosenMerc;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) )
|
||||
{
|
||||
@@ -14789,10 +14845,10 @@ BOOLEAN CanMoveBullseyeAndClickedOnIt( INT16 sMapX, INT16 sMapY )
|
||||
// haydent
|
||||
else if(is_server)
|
||||
{
|
||||
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPServerMessage[9] );
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, MPServerMessage[9] );
|
||||
}
|
||||
else if(is_client)
|
||||
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[38] );
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, MPClientMessage[38] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -14849,7 +14905,7 @@ void WakeUpAnySleepingSelectedMercsOnFootOrDriving( void )
|
||||
BOOLEAN fSuccess = FALSE;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) )
|
||||
{
|
||||
@@ -15086,7 +15142,7 @@ void InitPreviousPaths( void )
|
||||
INT32 iCounter = 0;
|
||||
|
||||
// init character previous paths
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
gpCharacterPreviousMercPath[ iCounter ] = NULL;
|
||||
}
|
||||
@@ -15101,7 +15157,7 @@ void RememberPreviousPathForAllSelectedChars( void )
|
||||
INT32 iCounter = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
{
|
||||
@@ -15168,7 +15224,7 @@ void RestorePreviousPaths( void )
|
||||
}
|
||||
else // character(s) plotting
|
||||
{
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// if selected
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
@@ -15241,7 +15297,7 @@ void ClearPreviousPaths( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
{
|
||||
@@ -15268,7 +15324,7 @@ void SelectAllCharactersInSquad( INT8 bSquadNumber )
|
||||
ChangeSelectedInfoChar( -1, TRUE );
|
||||
|
||||
// now select all the soldiers that are in this squad
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
for( bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
// is this entry is valid
|
||||
if( gCharactersList[ bCounter ].fValid == TRUE )
|
||||
@@ -15377,8 +15433,7 @@ void RequestToggleMercInventoryPanel( void )
|
||||
else
|
||||
{
|
||||
// Headrock. New line forces InvBottom rerender when the inventory is opened and closed.
|
||||
//RenderMapScreenInterfaceBottom ( TRUE );
|
||||
fMapScreenBottomDirty = TRUE;
|
||||
RenderMapScreenInterfaceBottom ( TRUE );
|
||||
SetRegionFastHelpText( &gCharInfoHandRegion, pMiscMapScreenMouseRegionHelpText[ 0 ] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,9 @@
|
||||
#include "connect.h" //hayden added alot ""'s to get around client spawing random/different placed AI
|
||||
#include "SaveLoadGame.h"
|
||||
|
||||
#include "vfs.h"
|
||||
#include "PropertyContainer.h"
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
class SOLDIERTYPE;
|
||||
@@ -1377,6 +1380,7 @@ void EndLoadScreen( )
|
||||
'A' + gWorldSectorY - 1, gWorldSectorX, gbWorldSectorZ, uiSeconds, uiHundreths );
|
||||
}
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str );
|
||||
#ifndef USE_VFS
|
||||
if( fStartNewFile )
|
||||
{ //start new file
|
||||
fp = fopen( "TimeResults.txt", "w" );
|
||||
@@ -1447,6 +1451,65 @@ void EndLoadScreen( )
|
||||
|
||||
fclose( fp );
|
||||
}
|
||||
#else
|
||||
CLog timeResults(L"TimeResults.txt", true);
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, L"See JA2\\Data\\TimeResults.txt for more detailed timings." );
|
||||
|
||||
//Record all of the timings.
|
||||
timeResults << str << CLog::endl;
|
||||
timeResults << "EnterSector() supersets LoadWorld(). This includes other external sections." << CLog::endl;
|
||||
//FileRead()
|
||||
timeResults << CLog::endl << CLog::endl << "VARIOUS FUNCTION TIMINGS (exclusive of actual function timings in second heading)" << CLog::endl;
|
||||
uiSeconds = uiTotalFileReadTime / 1000;
|
||||
uiHundreths = (uiTotalFileReadTime / 10) % 100;
|
||||
//fprintf( fp, "FileRead: %d.%02d (called %d times)\n", uiSeconds, uiHundreths, uiTotalFileReadCalls );
|
||||
timeResults << "FileRead: " <<uiSeconds<< "." << uiHundreths << " (called " << uiTotalFileReadCalls << " times)" << CLog::endl;
|
||||
|
||||
timeResults.Endl().Endl() << "SECTIONS OF LOADWORLD (all parts should add up to 100%)" << CLog::endl;
|
||||
|
||||
//TrashWorld()
|
||||
uiSeconds = uiTrashWorldTime / 1000;
|
||||
uiHundreths = (uiTrashWorldTime / 10) % 100;
|
||||
timeResults << "TrashWorld: " << uiSeconds << "." << uiHundreths << CLog::endl;
|
||||
//LoadMapTilesets()
|
||||
uiSeconds = uiLoadMapTilesetTime / 1000;
|
||||
uiHundreths = (uiLoadMapTilesetTime / 10) % 100;
|
||||
timeResults << "LoadMapTileset: " << uiSeconds << "." << uiHundreths << CLog::endl;
|
||||
//LoadMapLights()
|
||||
uiSeconds = uiLoadMapLightsTime / 1000;
|
||||
uiHundreths = (uiLoadMapLightsTime / 10) % 100;
|
||||
timeResults << "LoadMapLights: " << uiSeconds << "." << uiHundreths << CLog::endl;
|
||||
|
||||
uiSeconds = uiBuildShadeTableTime / 1000;
|
||||
uiHundreths = (uiBuildShadeTableTime / 10) % 100;
|
||||
timeResults << " 1) BuildShadeTables: " << uiSeconds << "." << uiHundreths << CLog::endl;
|
||||
|
||||
uiPercentage = uiNumImagesReloaded * 100 / NUMBEROFTILETYPES;
|
||||
timeResults << " 2) " << uiPercentage << "% of the tileset images were actually reloaded." << CLog::endl;
|
||||
if ( ( uiNumTablesSaved+uiNumTablesLoaded ) != 0 )
|
||||
{
|
||||
uiPercentage = uiNumTablesSaved * 100 / (uiNumTablesSaved+uiNumTablesLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiPercentage = 0;
|
||||
}
|
||||
timeResults << " 3) Of that, " << uiPercentage << "% of the shade tables were generated (not loaded)." << CLog::endl;
|
||||
if( gfForceBuildShadeTables )
|
||||
{
|
||||
timeResults << " NOTE: Force building of shadetables enabled on this local computer." << CLog::endl;
|
||||
}
|
||||
|
||||
//Unaccounted
|
||||
uiUnaccounted = uiLoadWorldTime - uiTrashWorldTime - uiLoadMapTilesetTime - uiLoadMapLightsTime;
|
||||
uiSeconds = uiUnaccounted / 1000;
|
||||
uiHundreths = (uiUnaccounted / 10) % 100;
|
||||
timeResults << "Unaccounted: " << uiSeconds << "." << uiHundreths << CLog::endl;
|
||||
//LoadWorld()
|
||||
uiSeconds = uiLoadWorldTime / 1000;
|
||||
uiHundreths = (uiLoadWorldTime / 10) % 100;
|
||||
timeResults.Endl() << "Total: " << uiSeconds << "." << uiHundreths << CLog::endl;
|
||||
#endif // USE_VFS
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "types.h"
|
||||
|
||||
#define MAX_CACHE_SIZE 20
|
||||
#define MIN_CACHE_SIZE 2
|
||||
//#define MIN_CACHE_SIZE 2
|
||||
#define MIN_CACHE_SIZE 4
|
||||
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -1073,7 +1073,7 @@ BOOLEAN AddFacesToAutoBandageBox( void )
|
||||
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// find a free slot
|
||||
if( iDoctorList[ iCounter ] != -1 )
|
||||
@@ -1096,7 +1096,7 @@ BOOLEAN AddFacesToAutoBandageBox( void )
|
||||
}
|
||||
}
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// find a free slot
|
||||
if( iPatientList[ iCounter ] != -1 )
|
||||
@@ -1134,7 +1134,7 @@ BOOLEAN RemoveFacesForAutoBandage( void )
|
||||
INT32 iCounter = 0, iNumberOfDoctors = 0;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// find a free slot
|
||||
if( iDoctorList[ iCounter ] != -1 )
|
||||
@@ -1146,7 +1146,7 @@ BOOLEAN RemoveFacesForAutoBandage( void )
|
||||
}
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// find a free slot
|
||||
if( iPatientList[ iCounter ] != -1 )
|
||||
@@ -1182,7 +1182,7 @@ BOOLEAN RenderSoldierSmallFaceForAutoBandagePanel( INT32 iIndex, INT16 sCurrentX
|
||||
BltVideoObject( FRAME_BUFFER , hHandle , 0, sCurrentXPosition+2, sCurrentYPosition+2, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// find a free slot
|
||||
if( iDoctorList[ iCounter ] != -1 )
|
||||
|
||||
@@ -249,7 +249,7 @@ void ShutDownQuoteBox( BOOLEAN fForce )
|
||||
}
|
||||
else
|
||||
{
|
||||
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[39] );
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, MPClientMessage[39] );
|
||||
ActionDone( gCivQuoteData.pCiv );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1360,7 +1360,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY
|
||||
pSoldier = MercPtrs[ i ];
|
||||
|
||||
//make sure the person is active, alive, in the sector, and is not a profiled person
|
||||
if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife && pSoldier->ubProfile == NO_PROFILE )
|
||||
if( pSoldier && pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife && pSoldier->ubProfile == NO_PROFILE )
|
||||
{ //soldier is valid, so find the matching soldier init list entry for modification.
|
||||
curr = gSoldierInitHead;
|
||||
while( curr && curr->pSoldier != pSoldier )
|
||||
|
||||
@@ -2966,7 +2966,7 @@ BOOLEAN AddTopMessage( UINT8 ubType, STR16 pzString )
|
||||
gTacticalStatus.fInTopMessage = TRUE;
|
||||
|
||||
// Copy string
|
||||
wcscpy( gTacticalStatus.zTopMessageString, pzString );
|
||||
wcsncpy( gTacticalStatus.zTopMessageString, pzString, 19 );
|
||||
|
||||
CreateTopMessage( gTopMessage.uiSurface, ubType, pzString );
|
||||
|
||||
|
||||
@@ -273,12 +273,19 @@ const int startingZ = 0;
|
||||
// ENUMERATION OF SOLDIER POSIITONS IN GLOBAL SOLDIER LIST
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
#define CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS 32
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS;
|
||||
#define CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES 6
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES;
|
||||
#define CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS+CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
#define CODE_MAXIMUM_NUMBER_OF_ENEMIES 64
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_ENEMIES;
|
||||
#define CODE_MAXIMUM_NUMBER_OF_CREATURES 40
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_CREATURES;
|
||||
#define CODE_MAXIMUM_NUMBER_OF_REBELS 64
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_REBELS;
|
||||
#define CODE_MAXIMUM_NUMBER_OF_CIVS 40
|
||||
extern UINT8 giMAXIMUM_NUMBER_OF_CIVS;
|
||||
|
||||
// The following should be the largest from the above set of constants.
|
||||
// Note: Is there any way to compute this via the preprocessor?
|
||||
|
||||
+26
-13
@@ -117,6 +117,16 @@
|
||||
#include "test_space.h"
|
||||
#include "connect.h"
|
||||
|
||||
// OJW - 20090419
|
||||
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS = CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS;
|
||||
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES = CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES;
|
||||
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
UINT8 giMAXIMUM_NUMBER_OF_ENEMIES = CODE_MAXIMUM_NUMBER_OF_ENEMIES;
|
||||
UINT8 giMAXIMUM_NUMBER_OF_CREATURES = CODE_MAXIMUM_NUMBER_OF_CREATURES;
|
||||
UINT8 giMAXIMUM_NUMBER_OF_REBELS = CODE_MAXIMUM_NUMBER_OF_REBELS;
|
||||
UINT8 giMAXIMUM_NUMBER_OF_CIVS = CODE_MAXIMUM_NUMBER_OF_CIVS;
|
||||
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
class SOLDIERTYPE;
|
||||
@@ -362,16 +372,16 @@ UINT8 bDefaultTeamRanges[ MAXTEAMS_SP ][ 2 ] =
|
||||
|
||||
COLORVAL bDefaultTeamColors[ MAXTEAMS ] =
|
||||
{
|
||||
FROMRGB( 255, 255, 0 ),
|
||||
FROMRGB( 255, 255, 0 ), // own team: yellow
|
||||
FROMRGB( 255, 0, 0 ),
|
||||
FROMRGB( 255, 0, 255 ),
|
||||
FROMRGB( 0, 255, 0 ),
|
||||
FROMRGB( 255, 255, 255 ),
|
||||
FROMRGB( 0, 0, 255 ),
|
||||
FROMRGB( 255, 156, 49 ), //hayden //team 1 (radar colours)
|
||||
FROMRGB( 49, 255, 207 ), //2
|
||||
FROMRGB( 193, 85, 255 ), //3
|
||||
FROMRGB( 0, 255, 115 ) //4
|
||||
FROMRGB( 255, 120, 0 ), //hayden //team 1 (radar colours) // orange
|
||||
FROMRGB( 62, 140, 240 ), //2 // light blue
|
||||
FROMRGB( 180, 50, 255 ), //3 // violett
|
||||
FROMRGB( 0, 180, 20 ) //4 // green
|
||||
|
||||
};
|
||||
|
||||
@@ -7075,16 +7085,19 @@ BOOLEAN CheckForLosingEndOfBattle( )
|
||||
|
||||
gfKillingGuysForLosingBattle = FALSE;
|
||||
|
||||
if ( fDoCapture )
|
||||
// WANNE - MP: Only do special scenes (capture, ...) in a single player game
|
||||
if (!is_networked)
|
||||
{
|
||||
EndCaptureSequence( );
|
||||
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
|
||||
if ( fDoCapture )
|
||||
{
|
||||
EndCaptureSequence( );
|
||||
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCustomizableTimerCallbackAndDelay( 10000, DeathTimerCallback, FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCustomizableTimerCallbackAndDelay( 10000, DeathTimerCallback, FALSE );
|
||||
}
|
||||
|
||||
}
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
||||
if(is_networked) {
|
||||
if(is_networked && (pCreateStruct->fOnRoof==1))
|
||||
{
|
||||
ScreenMsg( FONT_YELLOW, MSG_CHAT, L"skipping roof merc");
|
||||
ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"skipping roof merc");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
||||
|
||||
if(is_networked && (pCreateStruct->bBodyType==23 || pCreateStruct->bBodyType==24))
|
||||
{
|
||||
ScreenMsg( FONT_YELLOW, MSG_CHAT, L"skipping tank");
|
||||
ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"skipping tank");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
}
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: return false"));
|
||||
if(is_server) ScreenMsg( FONT_YELLOW, MSG_CHAT, L"report this MP error (AddPlacementToWorld-FAIL!)");
|
||||
if(is_server) ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"report this MP error (AddPlacementToWorld-FAIL!)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -485,8 +485,9 @@ BOOLEAN RemoveCharacterFromSquads( SOLDIERTYPE *pCharacter )
|
||||
AddDeadCharacterToSquadDeadGuys( pCharacter, iCounterA );
|
||||
}
|
||||
|
||||
//if we are not loading a saved game
|
||||
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) && guiCurrentScreen == GAME_SCREEN )
|
||||
//if we are not loading a saved game
|
||||
// OJW - 20090427 - fix bug leaving gamescree/tactical for MAIN_MENU
|
||||
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) && guiCurrentScreen == GAME_SCREEN && guiPendingScreen != MAINMENU_SCREEN )
|
||||
{
|
||||
UpdateCurrentlySelectedMerc( pCharacter, ( INT8 )iCounterA );
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#include "Map Screen Interface Map Inventory.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
BOOLEAN gfWasInMeanwhile = FALSE;
|
||||
|
||||
|
||||
@@ -1546,6 +1548,7 @@ BOOLEAN RetrieveTempFileFromSavedGame( HWFILE hFile, UINT32 uiType, INT16 sMapX,
|
||||
//Deletes the Temp map Directory
|
||||
BOOLEAN InitTacticalSave( BOOLEAN fCreateTempDir )
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
UINT32 uiRetVal;
|
||||
|
||||
//If the Map Temp directory exists, removes the temp files
|
||||
@@ -1569,13 +1572,14 @@ BOOLEAN InitTacticalSave( BOOLEAN fCreateTempDir )
|
||||
AssertMsg( 0, "Error creating the Temp Directory.");
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
EraseDirectory( MAPS_DIR );
|
||||
#endif
|
||||
if( fCreateTempDir )
|
||||
{
|
||||
//Create the initial temp file for the Npc Quote Info
|
||||
InitTempNpcQuoteInfoForNPCFromTempFile();
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
+18
-13
@@ -932,16 +932,18 @@ void StartInterrupt( void )
|
||||
}
|
||||
// otherwise it's the AI interrupting another AI team
|
||||
|
||||
gTacticalStatus.ubCurrentTeam = pSoldier->bTeam;
|
||||
|
||||
//#ifdef JA2BETAVERSION
|
||||
if (pSoldier != NULL)
|
||||
gTacticalStatus.ubCurrentTeam = pSoldier->bTeam;
|
||||
|
||||
if (is_networked)
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Interrupt ( could be hidden )" );
|
||||
|
||||
//#endif
|
||||
//send_interrupt( pSoldier );//hayden
|
||||
StartNPCAI( pSoldier );
|
||||
{
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Interrupt ( could be hidden )" );
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pSoldier != NULL)
|
||||
StartNPCAI( pSoldier );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1776,11 +1778,14 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f
|
||||
#ifdef DEBUG_INTERRUPTS
|
||||
DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("Calculating int pts for %d vs %d, number is %d", pSoldier->ubID, ubOpponentID, iPoints ) );
|
||||
#endif
|
||||
if(is_networked)
|
||||
{
|
||||
SOLDIERTYPE *pOpp = &Menptr[ubOpponentID];
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_CHAT, L"Interrupt: '%s' vs '%s' = %d points.",pSoldier->name,pOpp->name, iPoints );
|
||||
}
|
||||
if(is_networked)
|
||||
{
|
||||
SOLDIERTYPE *pOpp = &Menptr[ubOpponentID];
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_MPSYSTEM, L"Interrupt: '%s' vs '%s' = %d points.",pSoldier->name,pOpp->name, iPoints );
|
||||
#endif
|
||||
}
|
||||
DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"CalcInterruptDuelPts done");
|
||||
return( (INT8)iPoints );
|
||||
}
|
||||
|
||||
@@ -2366,27 +2366,31 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
}
|
||||
}
|
||||
else if ( fCtrl ) // The_Bob - real time sneaking, 01-06-09
|
||||
{ // ctrl-x: enter turn based while sneaking - check if RT sneak is on, iw we're not already in combat and if we actually see any enemies
|
||||
if (gGameExternalOptions.fAllowRealTimeSneak)
|
||||
{
|
||||
if (!is_networked)
|
||||
{
|
||||
BOOLEAN fSneakingInRealTime = true;
|
||||
// ctrl-x: enter turn based while sneaking - check if RT sneak is on, iw we're not already in combat and if we actually see any enemies
|
||||
if (gGameExternalOptions.fAllowRealTimeSneak)
|
||||
{
|
||||
BOOLEAN fSneakingInRealTime = true;
|
||||
|
||||
if( gTacticalStatus.uiFlags & INCOMBAT )
|
||||
{ // Don't allow this in combat
|
||||
if (!gGameExternalOptions.fQuietRealTimeSneak)
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_IN_COMBAT_ALREADY]);
|
||||
fSneakingInRealTime = false;
|
||||
}
|
||||
if( gTacticalStatus.uiFlags & INCOMBAT )
|
||||
{ // Don't allow this in combat
|
||||
if (!gGameExternalOptions.fQuietRealTimeSneak)
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_IN_COMBAT_ALREADY]);
|
||||
fSneakingInRealTime = false;
|
||||
}
|
||||
|
||||
if( WeSeeNoOne() )
|
||||
{ // Don't allow this if no enemies are seen - we have the forced turn mode for that
|
||||
if (!gGameExternalOptions.fQuietRealTimeSneak)
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_NO_ENEMIES]);
|
||||
fSneakingInRealTime = false;
|
||||
if( WeSeeNoOne() )
|
||||
{ // Don't allow this if no enemies are seen - we have the forced turn mode for that
|
||||
if (!gGameExternalOptions.fQuietRealTimeSneak)
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_NO_ENEMIES]);
|
||||
fSneakingInRealTime = false;
|
||||
}
|
||||
|
||||
if (fSneakingInRealTime)
|
||||
EnterCombatMode(OUR_TEAM);
|
||||
}
|
||||
|
||||
if (fSneakingInRealTime)
|
||||
EnterCombatMode(OUR_TEAM);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2394,25 +2398,25 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
case 'X': // shift-ctrl-x: toggle real time sneaking
|
||||
if ( fCtrl )
|
||||
{
|
||||
if (gGameExternalOptions.fAllowRealTimeSneak)
|
||||
if (!is_networked)
|
||||
{
|
||||
gGameExternalOptions.fAllowRealTimeSneak = false;
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_OFF]);
|
||||
|
||||
if( !WeSeeNoOne() ) // if we're sneaking up on someone, enter turn-based
|
||||
EnterCombatMode(OUR_TEAM);
|
||||
if (gGameExternalOptions.fAllowRealTimeSneak)
|
||||
{
|
||||
gGameExternalOptions.fAllowRealTimeSneak = false;
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_OFF]);
|
||||
|
||||
if( !WeSeeNoOne() ) // if we're sneaking up on someone, enter turn-based
|
||||
EnterCombatMode(OUR_TEAM);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGameExternalOptions.fAllowRealTimeSneak = true;
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_ON]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gGameExternalOptions.fAllowRealTimeSneak = true;
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_ON]);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case '/':
|
||||
|
||||
// Center to guy....
|
||||
|
||||
@@ -452,7 +452,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId )
|
||||
pVehicleSoldier = GetSoldierStructureForVehicle( iId );
|
||||
|
||||
//CHRISL: Get number of vehicles currently in player team
|
||||
for(int x = 0; x < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; x++)
|
||||
for(int x = 0; x < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; x++)
|
||||
{
|
||||
if(MercPtrs[x]->bTeam == OUR_TEAM && (MercPtrs[x]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[x]->bActive == TRUE)
|
||||
vCount ++;
|
||||
|
||||
@@ -402,8 +402,7 @@ BOOLEAN ReadInLBEPocketStats(STR fileName, BOOLEAN localizedVersion)
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
|
||||
@@ -232,8 +232,8 @@ BOOLEAN ReadInlbeStats(STR fileName)
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
LoadBearingEquipment.clear();
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
|
||||
@@ -545,8 +545,11 @@ BOOLEAN ReadInMercStartingGearStats(STR fileName)
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
for(int i=0; i<NUM_PROFILES; ++i)
|
||||
{
|
||||
gMercProfileGear[i].clearInventory();
|
||||
}
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ inline bool OKToCheckOpinion(int profileNumber) {
|
||||
return (profileNumber < DontUseMeDirectly::MaxIDToCheckForMorale);
|
||||
}
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NO_SKILLTRAIT = 0,
|
||||
@@ -368,7 +367,6 @@ public:
|
||||
INT8 bTown;
|
||||
INT8 bTownAttachment;
|
||||
UINT16 usOptionalGearCost;
|
||||
|
||||
// See above note near the definition of MaxIDToCheckForMorale
|
||||
INT8 bMercOpinion[DontUseMeDirectly::MaxIDToCheckForMorale];
|
||||
|
||||
@@ -606,7 +604,6 @@ public:
|
||||
INT8 bTown;
|
||||
INT8 bTownAttachment;
|
||||
UINT16 usOptionalGearCost;
|
||||
|
||||
// See above note near the definition of MaxIDToCheckForMorale
|
||||
INT8 bMercOpinion[DontUseMeDirectly::MaxIDToCheckForMorale];
|
||||
|
||||
|
||||
@@ -2282,7 +2282,7 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
|
||||
}
|
||||
if(is_networked)
|
||||
{
|
||||
ScreenMsg( FONT_LTBLUE, MSG_CHAT, L"explosives not coded in MP");
|
||||
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"explosives not coded in MP");
|
||||
return;
|
||||
}
|
||||
// Set values for recompile region to optimize area we need to recompile for MPs
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "Smell.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
#define NUM_REVEALED_BYTES 3200
|
||||
|
||||
extern BOOLEAN gfLoadingExitGrids;
|
||||
@@ -300,8 +302,12 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
|
||||
{
|
||||
ReSetSectorFlag( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_MAP_MODIFICATIONS_TEMP_FILE_EXISTS );
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
FileClose( hFile );
|
||||
#else
|
||||
// FileClose( hFile );
|
||||
// file already deleted. can't close it anymore (handle is invalid)
|
||||
#endif
|
||||
|
||||
//Free the memory used for the temp array
|
||||
MemFree( pTempArrayOfMaps );
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Fileman.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
|
||||
#define SHADE_TABLE_DIR "ShadeTables"
|
||||
|
||||
@@ -28,8 +28,10 @@ BOOLEAN gfForceBuildShadeTables = FALSE;
|
||||
|
||||
void DetermineRGBDistributionSettings()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
STRING512 DataDir;
|
||||
STRING512 ExecDir;
|
||||
#endif
|
||||
STRING512 ShadeTableDir;
|
||||
UINT32 uiRBitMask, uiGBitMask, uiBBitMask;
|
||||
UINT32 uiPrevRBitMask, uiPrevGBitMask, uiPrevBBitMask;
|
||||
@@ -39,6 +41,7 @@ void DetermineRGBDistributionSettings()
|
||||
BOOLEAN fCleanShadeTable = FALSE;
|
||||
BOOLEAN fLoadedPrevRGBDist = FALSE;
|
||||
|
||||
#ifndef USE_VFS
|
||||
// Snap: save current directory
|
||||
GetFileManCurrentDirectory( DataDir );
|
||||
|
||||
@@ -48,7 +51,6 @@ void DetermineRGBDistributionSettings()
|
||||
GetExecutableDirectory( ExecDir );
|
||||
sprintf( ShadeTableDir, "%s\\%s", DataDir, SHADE_TABLE_DIR );
|
||||
|
||||
|
||||
//Check to make sure we have a ShadeTable directory. If we don't create one!
|
||||
if( !SetFileManCurrentDirectory( ShadeTableDir ) )
|
||||
{
|
||||
@@ -62,10 +64,22 @@ void DetermineRGBDistributionSettings()
|
||||
}
|
||||
fSaveRGBDist = TRUE;
|
||||
}
|
||||
// directory existed or was created.
|
||||
SetFileManCurrentDirectory( DataDir );
|
||||
#else
|
||||
// changing the current directory can screw up the VFS; don't do it
|
||||
// the creation of the SHADE_TABLE_DIR directory is done by the VFS
|
||||
sprintf( ShadeTableDir, "%s", SHADE_TABLE_DIR );
|
||||
#endif
|
||||
|
||||
CHAR8 sRGBDist[50];
|
||||
sprintf( sRGBDist, "%s\\%s", SHADE_TABLE_DIR, "RGBDist.dat");
|
||||
CHAR8 sResetShadeTables[50];
|
||||
sprintf( sResetShadeTables, "%s\\%s", SHADE_TABLE_DIR, "ResetShadeTables.txt");
|
||||
|
||||
if( !fSaveRGBDist )
|
||||
{ //Load the previous RGBDist and determine if it is the same one
|
||||
if( !FileExists( "RGBDist.dat" ) || FileExists( "ResetShadeTables.txt" ) )
|
||||
if( !FileExists( sRGBDist ) || FileExists( sResetShadeTables ) )
|
||||
{ //Can't find the RGBDist.dat file. The directory exists, but the file doesn't, which
|
||||
//means the user deleted the file manually. Now, set it up to create a new one.
|
||||
fSaveRGBDist = TRUE;
|
||||
@@ -73,7 +87,7 @@ void DetermineRGBDistributionSettings()
|
||||
}
|
||||
else
|
||||
{
|
||||
hfile = FileOpen( "RGBDist.dat", FILE_ACCESS_READ, FALSE );
|
||||
hfile = FileOpen( sRGBDist, FILE_ACCESS_READ, FALSE );
|
||||
if( !hfile )
|
||||
{
|
||||
AssertMsg( 0, "Couldn't open RGBDist.dat, even though it exists!" );
|
||||
@@ -111,7 +125,7 @@ void DetermineRGBDistributionSettings()
|
||||
{ //The RGB distribution is going to be saved in a tiny file for future reference. As long as the
|
||||
//RGB distribution never changes, the shade table will grow until eventually, all tilesets are loaded,
|
||||
//shadetables generated and saved in this directory.
|
||||
hfile = FileOpen( "RGBDist.dat", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
hfile = FileOpen( sRGBDist, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if( !hfile )
|
||||
{
|
||||
AssertMsg( 0, "Couldn't create RGBDist.dat for writing!" );
|
||||
@@ -123,7 +137,10 @@ void DetermineRGBDistributionSettings()
|
||||
}
|
||||
|
||||
// Snap: Restore the data directory once we are finished.
|
||||
SetFileManCurrentDirectory( DataDir );
|
||||
|
||||
// BF : current directory was reset above
|
||||
//SetFileManCurrentDirectory( DataDir );
|
||||
|
||||
//We're done, so restore the executable directory to JA2\Data.
|
||||
//sprintf( DataDir, "%s\\Data", ExecDir );
|
||||
//SetFileManCurrentDirectory( DataDir );
|
||||
@@ -140,7 +157,11 @@ BOOLEAN LoadShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex )
|
||||
//We are assuming that the uiTileTypeIndex is referring to the correct file
|
||||
//stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem
|
||||
//and should be fixed. Also assumes that the directory is set to Data\ShadeTables.
|
||||
strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] );
|
||||
|
||||
//BF
|
||||
//strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] );
|
||||
sprintf( ShadeFileName, "%s\\%s", SHADE_TABLE_DIR, TileSurfaceFilenames[ uiTileTypeIndex ] );
|
||||
|
||||
ptr = strstr( ShadeFileName, "." );
|
||||
if( !ptr )
|
||||
{
|
||||
@@ -149,12 +170,15 @@ BOOLEAN LoadShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex )
|
||||
ptr++;
|
||||
sprintf( ptr, "sha" );
|
||||
|
||||
hfile = FileOpen( ShadeFileName, FILE_ACCESS_READ, FALSE );
|
||||
if( !hfile )
|
||||
{ //File doesn't exist, so generate it
|
||||
FileClose( hfile );
|
||||
//hfile = FileOpen( ShadeFileName, FILE_ACCESS_READ, FALSE );
|
||||
//if( !hfile )
|
||||
//{ //File doesn't exist, so generate it
|
||||
// FileClose( hfile );
|
||||
if(!FileExists(ShadeFileName))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
hfile = FileOpen( ShadeFileName, FILE_ACCESS_READ, FALSE );
|
||||
|
||||
//MISSING: Compare time stamps.
|
||||
|
||||
@@ -180,14 +204,18 @@ BOOLEAN SaveShadeTable( HVOBJECT pObj, UINT32 uiTileTypeIndex )
|
||||
UINT32 uiNumBytesWritten;
|
||||
CHAR8 ShadeFileName[ 100 ];
|
||||
CHAR8 *ptr;
|
||||
#ifdef JA2TESTVERSION
|
||||
uiNumTablesSaved++;
|
||||
#endif
|
||||
#ifdef JA2TESTVERSION
|
||||
uiNumTablesSaved++;
|
||||
#endif
|
||||
//ASSUMPTIONS:
|
||||
//We are assuming that the uiTileTypeIndex is referring to the correct file
|
||||
//stored in the TileSurfaceFilenames[]. If it isn't, then that is a huge problem
|
||||
//and should be fixed. Also assumes that the directory is set to Data\ShadeTables.
|
||||
strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] );
|
||||
|
||||
// BF
|
||||
//strcpy( ShadeFileName, TileSurfaceFilenames[ uiTileTypeIndex ] );
|
||||
sprintf_s( ShadeFileName, "%s\\%s", SHADE_TABLE_DIR, TileSurfaceFilenames[ uiTileTypeIndex ] );
|
||||
|
||||
ptr = strstr( ShadeFileName, "." );
|
||||
if( !ptr )
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#endif
|
||||
#include "connect.h"
|
||||
#include "saveloadscreen.h"
|
||||
#include "Map Edgepoints.h"
|
||||
|
||||
|
||||
typedef struct MERCPLACEMENT
|
||||
@@ -120,7 +121,8 @@ void PickUpMercPiece( INT32 iPlacement );
|
||||
void SetCursorMerc( INT8 bPlacementID );
|
||||
void SelectNextUnplacedUnit();
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
// WANNE: Made methods available for Release build, because we need them in multiplayer
|
||||
//#ifdef JA2BETAVERSION
|
||||
|
||||
BOOLEAN gfNorthValid, gfEastValid, gfSouthValid, gfWestValid;
|
||||
BOOLEAN gfChangedEntrySide = FALSE;
|
||||
@@ -219,7 +221,7 @@ void CheckForValidMapEdge( UINT8 *pubStrategicInsertionCode )
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
||||
void InitTacticalPlacementGUI()
|
||||
@@ -316,6 +318,7 @@ void InitTacticalPlacementGUI()
|
||||
SpecifyButtonHilitedTextColors( iTPButtons[ GROUP_BUTTON ], FONT_WHITE, FONT_NEARBLACK );
|
||||
SpecifyButtonHilitedTextColors( iTPButtons[ DONE_BUTTON ], FONT_WHITE, FONT_NEARBLACK );
|
||||
|
||||
|
||||
//First pass: Count the number of mercs that are going to be placed by the player.
|
||||
// This determines the size of the array we will allocate.
|
||||
giPlacements = 0;
|
||||
@@ -349,6 +352,12 @@ void InitTacticalPlacementGUI()
|
||||
!MercPtrs[ i ]->bSectorZ )
|
||||
{
|
||||
|
||||
// WANNE - MP: Check if the desired insertion direction is valid on the map. If not, choose another entry direction!
|
||||
if (is_networked)
|
||||
{
|
||||
MercPtrs[ i ]->ubStrategicInsertionCode = GetValidInsertionDirectionForMP(MercPtrs[ i ]->ubStrategicInsertionCode);
|
||||
}
|
||||
|
||||
// ATE: If we are in a vehicle - remove ourselves from it!
|
||||
//if ( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) )
|
||||
//{
|
||||
@@ -363,9 +372,15 @@ void InitTacticalPlacementGUI()
|
||||
gMercPlacement[ giPlacements ].pSoldier = MercPtrs[ i ];
|
||||
gMercPlacement[ giPlacements ].ubStrategicInsertionCode = MercPtrs[ i ]->ubStrategicInsertionCode;
|
||||
gMercPlacement[ giPlacements ].fPlaced = FALSE;
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
CheckForValidMapEdge( &MercPtrs[ i ]->ubStrategicInsertionCode );
|
||||
#else
|
||||
// WANNE: We need to have valid map edges in multiplayer!
|
||||
if (is_networked)
|
||||
CheckForValidMapEdge( &MercPtrs[ i ]->ubStrategicInsertionCode );
|
||||
#endif
|
||||
|
||||
switch( MercPtrs[ i ]->ubStrategicInsertionCode )
|
||||
{
|
||||
case INSERTION_CODE_NORTH:
|
||||
@@ -445,6 +460,107 @@ void InitTacticalPlacementGUI()
|
||||
}
|
||||
}
|
||||
|
||||
// WANNE - MP: This method checks, if the desired entry direction (N, E, S, W) on the map is valid. If not it chooses the next valid diretion
|
||||
UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint)
|
||||
{
|
||||
bool foundValidDirection = false;
|
||||
UINT8 validInsertionDirection = currentInsertionPoint;
|
||||
|
||||
// Check if current insertion direction is valid
|
||||
switch (currentInsertionPoint)
|
||||
{
|
||||
case INSERTION_CODE_NORTH:
|
||||
if (gus1stNorthEdgepointArraySize > 0 || gus2ndNorthEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_NORTH;
|
||||
}
|
||||
break;
|
||||
case INSERTION_CODE_SOUTH:
|
||||
if (gus1stSouthEdgepointArraySize > 0 || gus2ndSouthEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_SOUTH;
|
||||
}
|
||||
break;
|
||||
case INSERTION_CODE_EAST:
|
||||
if (gus1stEastEdgepointArraySize > 0 || gus2ndEastEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_EAST;
|
||||
}
|
||||
break;
|
||||
case INSERTION_CODE_WEST:
|
||||
if (gus1stWestEdgepointArraySize > 0 || gus2ndWestEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_WEST;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Find alternate insertion direction by looping through all directions (N, S, E, W)
|
||||
if (!foundValidDirection)
|
||||
{
|
||||
UINT8 direction = 0;
|
||||
|
||||
// Find NEXT valid direction
|
||||
for (int i = currentInsertionPoint; (i < currentInsertionPoint + 4); i++)
|
||||
{
|
||||
// First iteration, start with current insertion direction
|
||||
if (i == currentInsertionPoint)
|
||||
direction = i;
|
||||
else
|
||||
{
|
||||
if (i <= 3)
|
||||
direction = i;
|
||||
else
|
||||
{
|
||||
direction = 4 - i;
|
||||
}
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case INSERTION_CODE_NORTH:
|
||||
if (gus1stNorthEdgepointArraySize > 0 || gus2ndNorthEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_NORTH;
|
||||
}
|
||||
break;
|
||||
case INSERTION_CODE_SOUTH:
|
||||
if (gus1stSouthEdgepointArraySize > 0 || gus2ndSouthEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_SOUTH;
|
||||
}
|
||||
break;
|
||||
case INSERTION_CODE_EAST:
|
||||
if (gus1stEastEdgepointArraySize > 0 || gus2ndEastEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_EAST;
|
||||
}
|
||||
break;
|
||||
case INSERTION_CODE_WEST:
|
||||
if (gus1stWestEdgepointArraySize > 0 || gus2ndWestEdgepointArraySize > 0)
|
||||
{
|
||||
foundValidDirection = true;
|
||||
validInsertionDirection = INSERTION_CODE_WEST;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Exit loop condition
|
||||
if (foundValidDirection)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return validInsertionDirection;
|
||||
}
|
||||
|
||||
void RenderTacticalPlacementGUI()
|
||||
{
|
||||
INT32 i, xp, yp, width, height;
|
||||
@@ -574,17 +690,33 @@ void RenderTacticalPlacementGUI()
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO.RW: Check for insertion
|
||||
if (is_networked)
|
||||
{
|
||||
gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode = GetValidInsertionDirectionForMP(gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode);
|
||||
}
|
||||
|
||||
gTPClipRect.iLeft = iOffsetHorizontal;
|
||||
gTPClipRect.iTop = iOffsetVertical + 3;
|
||||
//gTPClipRect.iRight = iOffsetHorizontal + 640;
|
||||
gTPClipRect.iRight = iOffsetHorizontal + 634; // 635
|
||||
gTPClipRect.iBottom = iOffsetVertical + 320;
|
||||
|
||||
|
||||
switch( gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode )
|
||||
{
|
||||
case INSERTION_CODE_NORTH: gTPClipRect.iTop = iOffsetVertical + 30 + 3; break;
|
||||
case INSERTION_CODE_EAST: gTPClipRect.iRight = iOffsetHorizontal + 610; break;
|
||||
case INSERTION_CODE_SOUTH: gTPClipRect.iBottom = iOffsetVertical + 290; break;
|
||||
case INSERTION_CODE_WEST: gTPClipRect.iLeft = iOffsetHorizontal + 30; break;
|
||||
case INSERTION_CODE_NORTH:
|
||||
gTPClipRect.iTop = iOffsetVertical + 30 + 3;
|
||||
break;
|
||||
case INSERTION_CODE_EAST:
|
||||
gTPClipRect.iRight = iOffsetHorizontal + 610;
|
||||
break;
|
||||
case INSERTION_CODE_SOUTH:
|
||||
gTPClipRect.iBottom = iOffsetVertical + 290;
|
||||
break;
|
||||
case INSERTION_CODE_WEST:
|
||||
gTPClipRect.iLeft = iOffsetHorizontal + 30;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
|
||||
@@ -11,6 +11,9 @@ void RenderTacticalPlacementGUI();
|
||||
|
||||
void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason );
|
||||
|
||||
// WANNE - MP: This method checks, if the desired entry direction (N, E, S, W) on the map is valid. If not it chooses the next valid diretion
|
||||
UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint);
|
||||
|
||||
extern BOOLEAN gfTacticalPlacementGUIActive;
|
||||
extern BOOLEAN gfEnterTacticalPlacementGUI;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="TileEngine_2005Express"
|
||||
ProjectGUID="{FC1938E8-9253-49A8-AA99-4639BBB46C1B}"
|
||||
RootNamespace="TileEngine_2005Express"
|
||||
@@ -41,7 +41,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -105,7 +105,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="false"
|
||||
@@ -166,7 +166,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="false"
|
||||
@@ -228,7 +228,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Multiplayer"
|
||||
AdditionalIncludeDirectories="..\Multiplayer;..\ext\utf8\source;..\VFS"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
+25
-4
@@ -14,6 +14,9 @@
|
||||
#include "fileMan.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "XMLWriter.h"
|
||||
|
||||
// THIS FILE CONTAINS DEFINITIONS FOR TILESET FILES
|
||||
|
||||
void SetTilesetThreeTerrainValues();
|
||||
@@ -34,6 +37,7 @@ void InitEngineTilesets( )
|
||||
HWFILE hfile;
|
||||
CHAR8 zName[32];
|
||||
UINT32 uiNumBytesRead;
|
||||
XMLWriter xmlw;
|
||||
|
||||
//OPEN FILE
|
||||
// hfile = fopen( "BINARYDATA\\JA2SET.DAT", "rb" );
|
||||
@@ -44,6 +48,7 @@ void InitEngineTilesets( )
|
||||
return;
|
||||
}
|
||||
|
||||
xmlw.OpenNode("JA2SET");
|
||||
|
||||
// READ # TILESETS and compare
|
||||
// fread( &gubNumSets, sizeof( gubNumSets ), 1, hfile );
|
||||
@@ -55,6 +60,7 @@ void InitEngineTilesets( )
|
||||
SET_ERROR( "Too many tilesets in the data file" );
|
||||
return;
|
||||
}
|
||||
xmlw.AddAttributeToNextValue("numTilesets",(int)gubNumSets);
|
||||
|
||||
// READ #files
|
||||
// fread( &uiNumFiles, sizeof( uiNumFiles ), 1, hfile );
|
||||
@@ -67,40 +73,55 @@ void InitEngineTilesets( )
|
||||
SET_ERROR( "Number of tilesets slots in code does not match data file" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
xmlw.AddAttributeToNextValue("numFiles",(int)uiNumFiles);
|
||||
xmlw.OpenNode("tilesets");
|
||||
// Loop through each tileset, load name then files
|
||||
for ( cnt = 0; cnt < gubNumSets; cnt++ )
|
||||
{
|
||||
xmlw.AddAttributeToNextValue("index",(int)cnt);
|
||||
xmlw.OpenNode("Tileset");
|
||||
//Read name
|
||||
// fread( &zName, sizeof( zName ), 1, hfile );
|
||||
FileRead( hfile, &zName, sizeof( zName ), &uiNumBytesRead );
|
||||
xmlw.AddValue("Name",std::string(zName));
|
||||
|
||||
// Read ambience value
|
||||
// fread( &(gTilesets[ cnt ].ubAmbientID), sizeof( UINT8), 1, hfile );
|
||||
FileRead( hfile, &(gTilesets[ cnt ].ubAmbientID), sizeof( UINT8 ), &uiNumBytesRead );
|
||||
xmlw.AddValue("AmbientID",(int)gTilesets[ cnt ].ubAmbientID);
|
||||
|
||||
// Set into tileset
|
||||
swprintf( gTilesets[ cnt ].zName, L"%S", zName );
|
||||
|
||||
xmlw.OpenNode("Files");
|
||||
// Loop for files
|
||||
for ( cnt2 = 0; cnt2 < uiNumFiles; cnt2++ )
|
||||
{
|
||||
// Read file name
|
||||
// fread( &zName, sizeof( zName ), 1, hfile );
|
||||
FileRead( hfile, &zName, sizeof( zName ), &uiNumBytesRead );
|
||||
if(!std::string(zName).empty())
|
||||
{
|
||||
xmlw.AddAttributeToNextValue("index",(int)cnt2);
|
||||
xmlw.AddValue("file",std::string(zName));
|
||||
}
|
||||
|
||||
// Set into database
|
||||
strcpy( gTilesets[ cnt ].TileSurfaceFilenames[ cnt2 ], zName );
|
||||
|
||||
}
|
||||
|
||||
xmlw.CloseNode(); // Files
|
||||
xmlw.CloseNode(); // tileset
|
||||
}
|
||||
xmlw.CloseNode();
|
||||
|
||||
// fclose( hfile );
|
||||
FileClose( hfile );
|
||||
|
||||
|
||||
xmlw.CloseNode();
|
||||
#ifdef USE_VFS
|
||||
xmlw.WriteToFile("Ja2Set.dat.xml");
|
||||
#endif
|
||||
// SET CALLBACK FUNTIONS!!!!!!!!!!!!!
|
||||
gTilesets[ TLS_CAVES_1 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetTwoTerrainValues;
|
||||
gTilesets[ TLS_AIRSTRIP ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetThreeTerrainValues;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "Text.h"
|
||||
#include "connect.h"
|
||||
|
||||
//effects whether or not time of day effects the lighting. Underground
|
||||
//maps have an ambient light level that is saved in the map, and doesn't change.
|
||||
@@ -682,13 +683,20 @@ BOOLEAN LightningEndOfTurn( UINT8 ubTeam )
|
||||
|
||||
UINT8 GetTimeOfDayAmbientLightLevel()
|
||||
{
|
||||
if ( SectorTemperature( GetWorldMinutesInDay(), gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) == HOT )
|
||||
if (!is_networked)
|
||||
{
|
||||
return( HOT_DAY_LIGHTLEVEL );
|
||||
if ( SectorTemperature( GetWorldMinutesInDay(), gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) == HOT )
|
||||
{
|
||||
return( HOT_DAY_LIGHTLEVEL );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( gubEnvLightValue );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return( gubEnvLightValue );
|
||||
return ( gubEnvLightValue );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+65
-24
@@ -503,20 +503,20 @@ void HandleOverheadMap( )
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &sMapPos ) )
|
||||
{
|
||||
if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &sMapPos ) )
|
||||
{
|
||||
if ( GetClosestMercInOverheadMap( sMapPos, &pSoldier, 1 ) )
|
||||
{
|
||||
if ( pSoldier->bTeam == gbPlayerNum )
|
||||
{
|
||||
gfUIHandleSelectionAboveGuy = TRUE;
|
||||
gsSelectedGuy = pSoldier->ubID;
|
||||
}
|
||||
if ( pSoldier->bTeam == gbPlayerNum )
|
||||
{
|
||||
gfUIHandleSelectionAboveGuy = TRUE;
|
||||
gsSelectedGuy = pSoldier->ubID;
|
||||
}
|
||||
|
||||
DisplayMercNameInOverhead( pSoldier );
|
||||
}
|
||||
DisplayMercNameInOverhead( pSoldier );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ void HandleOverheadMap( )
|
||||
{
|
||||
pSoldier = MercPtrs[ gusSelectedSoldier ];
|
||||
|
||||
DisplayMercNameInOverhead( pSoldier );
|
||||
DisplayMercNameInOverhead( pSoldier );
|
||||
}
|
||||
|
||||
RenderButtons( );
|
||||
@@ -1272,22 +1272,44 @@ void RenderOverheadOverlays()
|
||||
else
|
||||
#endif
|
||||
if( !gfTacticalPlacementGUIActive )
|
||||
{ //normal
|
||||
{
|
||||
//normal
|
||||
if(is_networked)
|
||||
{
|
||||
if(pSoldier->bTeam!=0)
|
||||
{
|
||||
if(pSoldier->bSide==1)Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 1 );
|
||||
if(pSoldier->bSide==0)Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 3 );
|
||||
if(pSoldier->bSide==1)
|
||||
{
|
||||
// Civ (white)
|
||||
if (pSoldier->bTeam == 4)
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 4 );
|
||||
// Enemy (red)
|
||||
else
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 1 );
|
||||
}
|
||||
|
||||
// Other clients
|
||||
if(pSoldier->bSide==0)
|
||||
{
|
||||
int personIndex = pSoldier->bTeam + 4;
|
||||
// TODO.RW: Get the correct person index (depending on the pSoldier->bTeam)
|
||||
//Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 3 );
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, personIndex );
|
||||
}
|
||||
}
|
||||
else Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
else
|
||||
// Color depends on the bTeam
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
}
|
||||
// Color depends on the bTeam
|
||||
else
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
|
||||
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
|
||||
}
|
||||
else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{ //vehicle
|
||||
{
|
||||
//vehicle
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 9 );
|
||||
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-6), (INT16)(sY), (INT16)(sX + 9), (INT16)(sY + 10));
|
||||
}
|
||||
@@ -1296,30 +1318,49 @@ void RenderOverheadOverlays()
|
||||
// ubPassengers++;
|
||||
//}
|
||||
else if( gpTacticalPlacementSelectedSoldier == pSoldier )
|
||||
{ //tactical placement selected merc
|
||||
{
|
||||
//tactical placement selected merc
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 7 );
|
||||
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
|
||||
}
|
||||
else if( gpTacticalPlacementHilightedSoldier == pSoldier && pSoldier->flags.uiStatusFlags )
|
||||
{ //tactical placement hilighted merc
|
||||
{
|
||||
//tactical placement hilighted merc
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 8 );
|
||||
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
|
||||
}
|
||||
else
|
||||
{ //normal
|
||||
{
|
||||
//normal
|
||||
if(is_networked)
|
||||
{
|
||||
if(pSoldier->bTeam!=0)
|
||||
{
|
||||
if(pSoldier->bSide==1)continue;//dont render enemy
|
||||
if(pSoldier->bSide==0)Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 3 );
|
||||
if(pSoldier->bSide==1)
|
||||
continue;//dont render enemy
|
||||
|
||||
// Green
|
||||
// Other clients
|
||||
if(pSoldier->bSide==0)
|
||||
{
|
||||
int personIndex = pSoldier->bTeam + 4;
|
||||
// TODO.RW: Get the correct person index (depending on the pSoldier->bTeam)
|
||||
|
||||
//Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 3 );
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, personIndex );
|
||||
}
|
||||
}
|
||||
else Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
else
|
||||
// Color depends on the bTeam
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
}
|
||||
else
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
// Color depends on the bTeam
|
||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
|
||||
|
||||
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
|
||||
}
|
||||
|
||||
if( ubPassengers )
|
||||
{
|
||||
SetFont( SMALLCOMPFONT );
|
||||
|
||||
+41
-35
@@ -522,8 +522,9 @@ extern BOOLEAN gfLoadShadeTablesFromTextFile;
|
||||
void BuildTileShadeTables( )
|
||||
{
|
||||
HWFILE hfile;
|
||||
STRING512 DataDir;
|
||||
STRING512 ShadeTableDir;
|
||||
// BF
|
||||
//STRING512 DataDir;
|
||||
//STRING512 ShadeTableDir;
|
||||
UINT32 uiLoop;
|
||||
CHAR8 cRootFile[ 128 ];
|
||||
BOOLEAN fForceRebuildForSlot = FALSE;
|
||||
@@ -540,18 +541,22 @@ void BuildTileShadeTables( )
|
||||
uiStartTime = GetJA2Clock();
|
||||
#endif
|
||||
|
||||
|
||||
//Set the directory to the shadetable directory
|
||||
GetFileManCurrentDirectory( DataDir );
|
||||
sprintf( ShadeTableDir, "%s\\ShadeTables", DataDir );
|
||||
if( !SetFileManCurrentDirectory( ShadeTableDir ) )
|
||||
// BF : adjust filename, instead of changing current directory (doesn't make sence with a VFS)
|
||||
//////////////Set the directory to the shadetable directory
|
||||
////////////GetFileManCurrentDirectory( DataDir );
|
||||
////////////sprintf( ShadeTableDir, "%s\\ShadeTables", DataDir );
|
||||
////////////if( !SetFileManCurrentDirectory( ShadeTableDir ) )
|
||||
////////////{
|
||||
//////////// AssertMsg( 0, "Can't set the directory to Data\\ShadeTable. Kris' big problem!" );
|
||||
////////////}
|
||||
CHAR8 sIgnoreShadeTables[50];
|
||||
sprintf( sIgnoreShadeTables, "%s\\%s", "ShadeTables", "IgnoreShadeTables.txt");
|
||||
//hfile = FileOpen( sIgnoreShadeTables, FILE_ACCESS_READ, FALSE );
|
||||
//if( hfile )
|
||||
//{
|
||||
// FileClose( hfile );
|
||||
if(FileExists(sIgnoreShadeTables))
|
||||
{
|
||||
AssertMsg( 0, "Can't set the directory to Data\\ShadeTable. Kris' big problem!" );
|
||||
}
|
||||
hfile = FileOpen( "IgnoreShadeTables.txt", FILE_ACCESS_READ, FALSE );
|
||||
if( hfile )
|
||||
{
|
||||
FileClose( hfile );
|
||||
gfForceBuildShadeTables = TRUE;
|
||||
}
|
||||
else
|
||||
@@ -585,40 +590,41 @@ void BuildTileShadeTables( )
|
||||
if ( gTileSurfaceArray[ uiLoop ] != NULL )
|
||||
{
|
||||
// Don't Create shade tables if default were already used once!
|
||||
#ifdef JA2EDITOR
|
||||
if( gbNewTileSurfaceLoaded[ uiLoop ] || gfEditorForceShadeTableRebuild )
|
||||
#else
|
||||
if( gbNewTileSurfaceLoaded[ uiLoop ] )
|
||||
#endif
|
||||
{
|
||||
fForceRebuildForSlot = FALSE;
|
||||
#ifdef JA2EDITOR
|
||||
if( gbNewTileSurfaceLoaded[ uiLoop ] || gfEditorForceShadeTableRebuild )
|
||||
#else
|
||||
if( gbNewTileSurfaceLoaded[ uiLoop ] )
|
||||
#endif
|
||||
{
|
||||
fForceRebuildForSlot = FALSE;
|
||||
|
||||
GetRootName( cRootFile, TileSurfaceFilenames[ uiLoop ] );
|
||||
|
||||
if ( strcmp( cRootFile, "grass2" ) == 0 )
|
||||
{
|
||||
fForceRebuildForSlot = TRUE;
|
||||
}
|
||||
if ( strcmp( cRootFile, "grass2" ) == 0 )
|
||||
{
|
||||
fForceRebuildForSlot = TRUE;
|
||||
}
|
||||
|
||||
#ifdef JA2TESTVERSION
|
||||
uiNumImagesReloaded++;
|
||||
#endif
|
||||
RenderProgressBar( 0, uiLoop * 100 / NUMBEROFTILETYPES );
|
||||
CreateTilePaletteTables( gTileSurfaceArray[ uiLoop ]->vo, uiLoop, fForceRebuildForSlot );
|
||||
}
|
||||
#ifdef JA2TESTVERSION
|
||||
uiNumImagesReloaded++;
|
||||
#endif
|
||||
RenderProgressBar( 0, uiLoop * 100 / NUMBEROFTILETYPES );
|
||||
CreateTilePaletteTables( gTileSurfaceArray[ uiLoop ]->vo, uiLoop, fForceRebuildForSlot );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Restore the data directory once we are finished.
|
||||
SetFileManCurrentDirectory( DataDir );
|
||||
// BF : see above
|
||||
////Restore the data directory once we are finished.
|
||||
//SetFileManCurrentDirectory( DataDir );
|
||||
|
||||
ubLastRed = gpLightColors[0].peRed;
|
||||
ubLastGreen = gpLightColors[0].peGreen;
|
||||
ubLastBlue = gpLightColors[0].peBlue;
|
||||
|
||||
#ifdef JA2TESTVERSION
|
||||
uiBuildShadeTableTime = GetJA2Clock() - uiStartTime;
|
||||
#endif
|
||||
#ifdef JA2TESTVERSION
|
||||
uiBuildShadeTableTime = GetJA2Clock() - uiStartTime;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DestroyTileShadeTables( )
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "music control.h"
|
||||
#include "Timer Control.h"
|
||||
#include "sysutil.h"
|
||||
#include "math.h"
|
||||
#endif
|
||||
|
||||
double rStart, rEnd;
|
||||
@@ -23,7 +24,6 @@ double rActual;
|
||||
|
||||
PROGRESSBAR *pBar[ MAX_PROGRESSBARS ];
|
||||
|
||||
BOOLEAN gfUseLoadScreenProgressBar = FALSE;
|
||||
UINT16 gusLeftmostShaded = 0;
|
||||
|
||||
extern BOOLEAN bShowSmallImage;
|
||||
@@ -31,7 +31,6 @@ extern BOOLEAN bShowSmallImage;
|
||||
void CreateLoadingScreenProgressBar()
|
||||
{
|
||||
gusLeftmostShaded = 162;
|
||||
gfUseLoadScreenProgressBar = TRUE;
|
||||
|
||||
// Special case->show small image centered
|
||||
if (bShowSmallImage == TRUE)
|
||||
@@ -56,19 +55,28 @@ void CreateLoadingScreenProgressBar()
|
||||
CreateProgressBar(0, 259, 683, 767, 708);
|
||||
}
|
||||
}
|
||||
|
||||
SetProgressBarUseBorder(0, FALSE );
|
||||
}
|
||||
|
||||
void RemoveLoadingScreenProgressBar()
|
||||
{
|
||||
gfUseLoadScreenProgressBar = FALSE;
|
||||
RemoveProgressBar( 0 );
|
||||
SetFontShadow(DEFAULT_SHADOW);
|
||||
}
|
||||
|
||||
// OJW - 20090422
|
||||
void CreateProgressBarNoBorder( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom )
|
||||
{
|
||||
CreateProgressBar( ubProgressBarID, usLeft, usTop, usRight, usBottom );
|
||||
SetProgressBarUseBorder( ubProgressBarID, FALSE );
|
||||
}
|
||||
|
||||
//This creates a single progress bar given the coordinates without a panel (containing a title and background).
|
||||
//A panel is automatically created if you specify a title using SetProgressBarTitle
|
||||
BOOLEAN CreateProgressBar( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom )
|
||||
{
|
||||
|
||||
PROGRESSBAR *pNew;
|
||||
//Allocate new progress bar
|
||||
pNew = (PROGRESSBAR*)MemAlloc( sizeof( PROGRESSBAR ) );
|
||||
@@ -100,6 +108,10 @@ BOOLEAN CreateProgressBar( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, U
|
||||
pNew->ubColorFillBlue = 0;
|
||||
|
||||
pNew->fDisplayText = FALSE;
|
||||
//OJW - 20090222
|
||||
pNew->uiFrameBuffer = FRAME_BUFFER;
|
||||
pNew->fDrawBorder = TRUE;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -166,6 +178,27 @@ void SetProgressBarMsgAttributes( UINT32 ubID, UINT32 usFont, UINT8 ubForeColor,
|
||||
pCurr->ubMsgFontShadowColor = ubShadowColor;
|
||||
}
|
||||
|
||||
//OJW - 20090422
|
||||
void SetProgressBarRenderBuffer( UINT32 ubID , UINT32 uiBufferID )
|
||||
{
|
||||
PROGRESSBAR *pCurr;
|
||||
Assert( ubID < MAX_PROGRESSBARS );
|
||||
pCurr = pBar[ ubID ];
|
||||
if( !pCurr )
|
||||
return;
|
||||
pCurr->uiFrameBuffer = uiBufferID;
|
||||
}
|
||||
|
||||
void SetProgressBarUseBorder( UINT32 ubID , BOOLEAN bBorder )
|
||||
{
|
||||
PROGRESSBAR *pCurr;
|
||||
Assert( ubID < MAX_PROGRESSBARS );
|
||||
pCurr = pBar[ ubID ];
|
||||
if( !pCurr )
|
||||
return;
|
||||
pCurr->fDrawBorder = bBorder;
|
||||
}
|
||||
|
||||
|
||||
//When finished, the progress bar needs to be removed.
|
||||
void RemoveProgressBar( UINT8 ubID )
|
||||
@@ -198,8 +231,8 @@ void SetRelativeStartAndEndPercentage( UINT8 ubID, UINT32 uiRelStartPerc, UINT32
|
||||
if( !pCurr )
|
||||
return;
|
||||
|
||||
pCurr->rStart = uiRelStartPerc*0.01;
|
||||
pCurr->rEnd = uiRelEndPerc*0.01;
|
||||
pCurr->rStart = (double)uiRelStartPerc*0.01f;
|
||||
pCurr->rEnd = (double)uiRelEndPerc*0.01f;
|
||||
|
||||
//Render the entire panel now, as it doesn't need update during the normal rendering
|
||||
if( pCurr->fPanel )
|
||||
@@ -271,7 +304,7 @@ void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage )
|
||||
{
|
||||
rActual = pCurr->rStart+(pCurr->rEnd-pCurr->rStart)*uiPercentage*0.01;
|
||||
|
||||
if( rActual - pCurr->rLastActual < 0.01 )
|
||||
if( fabs(rActual - pCurr->rLastActual) < 0.01 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -283,9 +316,9 @@ void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( gfUseLoadScreenProgressBar )
|
||||
if( !pCurr->fDrawBorder )
|
||||
{
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER,
|
||||
ColorFillVideoSurfaceArea( pCurr->uiFrameBuffer, //FRAME_BUFFER,
|
||||
pCurr->usBarLeft, pCurr->usBarTop, end, pCurr->usBarBottom,
|
||||
Get16BPPColor(FROMRGB( pCurr->ubColorFillRed, pCurr->ubColorFillGreen, pCurr->ubColorFillBlue )) );
|
||||
//if( pCurr->usBarRight > gusLeftmostShaded )
|
||||
@@ -297,14 +330,14 @@ void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage )
|
||||
else
|
||||
{
|
||||
//Border edge of the progress bar itself in gray
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER,
|
||||
ColorFillVideoSurfaceArea( pCurr->uiFrameBuffer,
|
||||
pCurr->usBarLeft, pCurr->usBarTop, pCurr->usBarRight, pCurr->usBarBottom,
|
||||
Get16BPPColor(FROMRGB(160, 160, 160)) );
|
||||
//Interior of progress bar in black
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER,
|
||||
ColorFillVideoSurfaceArea( pCurr->uiFrameBuffer,
|
||||
pCurr->usBarLeft+2, pCurr->usBarTop+2, pCurr->usBarRight-2, pCurr->usBarBottom-2,
|
||||
Get16BPPColor(FROMRGB( 0, 0, 0)) );
|
||||
ColorFillVideoSurfaceArea(FRAME_BUFFER, pCurr->usBarLeft+2, pCurr->usBarTop+2, end, pCurr->usBarBottom-2, Get16BPPColor(FROMRGB(72 , 155, 24)));
|
||||
ColorFillVideoSurfaceArea(pCurr->uiFrameBuffer, pCurr->usBarLeft+2, pCurr->usBarTop+2, end, pCurr->usBarBottom-2, Get16BPPColor(FROMRGB(72 , 155, 24)));
|
||||
}
|
||||
InvalidateRegion( pCurr->usBarLeft, pCurr->usBarTop, pCurr->usBarRight, pCurr->usBarBottom );
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
|
||||
@@ -25,6 +25,8 @@ typedef struct PROGRESSBAR
|
||||
BOOLEAN fDisplayText;
|
||||
BOOLEAN fUseSaveBuffer; //use the save buffer when display the text
|
||||
double rLastActual;
|
||||
UINT32 uiFrameBuffer;
|
||||
BOOLEAN fDrawBorder;
|
||||
}PROGRESSBAR;
|
||||
|
||||
extern PROGRESSBAR *pBar[ MAX_PROGRESSBARS ];
|
||||
@@ -75,4 +77,13 @@ void SetProgressBarColor( UINT8 ubID, UINT8 ubColorFillRed, UINT8 ubColorFillGre
|
||||
//Pass in TRUE to display the strings.
|
||||
void SetProgressBarTextDisplayFlag( UINT8 ubID, BOOLEAN fDisplayText, BOOLEAN fUseSaveBuffer, BOOLEAN fSaveScreenToFrameBuffer );
|
||||
|
||||
// OJW - 20090422
|
||||
// draw the progress bar with a white border, or not
|
||||
void SetProgressBarUseBorder( UINT32 ubID , BOOLEAN bBorder );
|
||||
// specify which buffer to render the bar to
|
||||
void SetProgressBarRenderBuffer( UINT32 ubID , UINT32 uiBufferID );
|
||||
// create a color bar with no border
|
||||
void CreateProgressBarNoBorder( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom );
|
||||
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user