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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

660 lines
21 KiB
C++

#ifdef PRECOMPILEDHEADERS
#include "JA2 All.h"
#include "Intro.h"
#else
#include "Types.h"
#include "MPScoreScreen.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"
#endif
#include "gameloop.h"
#include "Game Init.h"
#include "connect.h"
#include "network.h" // for client name
#include "saveloadscreen.h"
////////////////////////////////////////////
//
// Global Defines
//
///////////////////////////////////////////
#define MPS_TITLE_FONT FONT14ARIAL//FONT16ARIAL
#define MPS_TITLE_COLOR FONT_MCOLOR_WHITE
#define MPS_LABEL_TEXT_FONT FONT12ARIAL//FONT16ARIAL
#define MPS_LABEL_TEXT_COLOR FONT_MCOLOR_WHITE
//buttons
#define MPS_BTN_CONTINUE_X iScreenWidthOffset + 320 + 143
#define MPS_BTN_CONTINUE_Y iScreenHeightOffset + 435
//#define MPJ_BTN_HOST_X MPJ_BTN_JOIN_X-180
//#define MPJ_BTN_HOST_Y iScreenHeightOffset + 435
#define MPS_BTN_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2)
#define MPS_BTN_CANCEL_Y MPS_BTN_CONTINUE_Y
//main title
#define MPS_MAIN_TITLE_X 0
#define MPS_MAIN_TITLE_Y iScreenHeightOffset + 10
#define MPS_MAIN_TITLE_WIDTH SCREEN_WIDTH
//labels
#define MPS_LABEL_PLAYER_X iScreenWidthOffset + 80
#define MPS_LABEL_PLAYER_Y iScreenHeightOffset + 80
#define MPS_LABEL_PLAYER_WIDTH 80
#define MPS_LABEL_KILLS_X MPS_LABEL_PLAYER_X + MPS_LABEL_PLAYER_WIDTH + 20
#define MPS_LABEL_KILLS_Y MPS_LABEL_PLAYER_Y
#define MPS_LABEL_KILLS_WIDTH 50
#define MPS_LABEL_DEATHS_X MPS_LABEL_KILLS_X + MPS_LABEL_KILLS_WIDTH + 20
#define MPS_LABEL_DEATHS_Y MPS_LABEL_PLAYER_Y
#define MPS_LABEL_DEATHS_WIDTH 50
#define MPS_LABEL_HITS_X MPS_LABEL_DEATHS_X + MPS_LABEL_DEATHS_WIDTH + 20
#define MPS_LABEL_HITS_Y MPS_LABEL_PLAYER_Y
#define MPS_LABEL_HITS_WIDTH 50
#define MPS_LABEL_MISSES_X MPS_LABEL_HITS_X + MPS_LABEL_HITS_WIDTH + 20
#define MPS_LABEL_MISSES_Y MPS_LABEL_PLAYER_Y
#define MPS_LABEL_MISSES_WIDTH 50
#define MPS_LABEL_ACCURACY_X MPS_LABEL_MISSES_X + MPS_LABEL_MISSES_WIDTH + 20
#define MPS_LABEL_ACCURACY_Y MPS_LABEL_PLAYER_Y
#define MPS_LABEL_ACCURACY_WIDTH 70
#define MPS_PLAYERLIST_Y MPS_LABEL_PLAYER_Y + 30
#define MPS_PLAYER_GAP 17
////////////////////////////////////////////
//
// Global Variables
//
///////////////////////////////////////////
BOOLEAN gfMPSScreenEntry = TRUE;
BOOLEAN gfMPSScreenExit = FALSE;
BOOLEAN gfReRenderMPSScreen=TRUE;
BOOLEAN gfMPSButtonsAllocated = FALSE;
BOOLEAN gfMPSScoreScreenCanContinue = FALSE;
//enum for different states of screen
enum
{
MPS_NOTHING,
MPS_CANCEL,
MPS_CONTINUE,
};
UINT8 gubMPSScreenHandler=MPS_NOTHING; // State changer for HandleMPJScreen()
UINT32 gubMPSExitScreen = MP_SCORE_SCREEN; // The screen that is in control next iteration of the game_loop
UINT32 guiMPSMainBackGroundImage;
////////////////////////////////////////////
//
// Screen Controls
//
///////////////////////////////////////////
// Cancel Button
void BtnMPSCancelCallback(GUI_BUTTON *btn,INT32 reason);
UINT32 guiMPSCancelButton;
INT32 giMPSCancelBtnImage;
// Continue Button
void BtnMPSContinueCallback(GUI_BUTTON *btn,INT32 reason);
UINT32 guiMPSContinueButton;
INT32 giMPSContinueBtnImage;
// Message Box handle
INT8 giMPSMessageBox = -1;
////////////////////////////////////////////
//
// Local Function Prototypes
//
///////////////////////////////////////////
extern void ClearMainMenu();
BOOLEAN EnterMPSScreen();
BOOLEAN ExitMPSScreen();
void HandleMPSScreen();
BOOLEAN RenderMPSScreen();
void GetMPSScreenUserInput();
void DoneFadeOutForExitMPSScreen( void );
void DoneFadeInForExitMPSScreen( void );
UINT32 MPScoreScreenInit( void )
{
return (1);
}
UINT32 MPScoreScreenHandle( void )
{
StartFrameBufferRender();
if( gfMPSScreenEntry )
{
// PauseGame();
EnterMPSScreen();
gfMPSScreenEntry = FALSE;
gfMPSScreenExit = FALSE;
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
}
GetMPSScreenUserInput();
HandleMPSScreen();
// render buttons marked dirty
MarkButtonsDirty( );
RenderButtons( );
// render text boxes
RenderAllTextFields(); // textbox system call
// render help
// RenderFastHelp( );
// RenderButtonsFastHelp( );
ExecuteBaseDirtyRectQueue();
EndFrameBufferRender();
// handle fades in and out
if ( HandleFadeOutCallback( ) )
{
ClearMainMenu();
return( gubMPSExitScreen );
}
if ( HandleBeginFadeOut( gubMPSExitScreen ) )
{
return( gubMPSExitScreen );
}
if ( HandleFadeInCallback( ) )
{
// Re-render the scene!
RenderMPSScreen();
}
if ( HandleBeginFadeIn( gubMPSExitScreen ) )
{
}
if( gfMPSScreenExit ) // we are exiting this screen
{
ExitMPSScreen(); // perform destruction
}
return( gubMPSExitScreen );
} // end MPScoreScreenHandle()
UINT32 MPScoreScreenShutdown( void )
{
return( 1 );
}
BOOLEAN EnterMPSScreen()
{
gfMPSScoreScreenCanContinue = FALSE;
VOBJECT_DESC VObjectDesc;
if( gfMPSButtonsAllocated )
return( TRUE );
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
// load the Main trade screen backgroiund image
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
if (iResolution >= _640x480 && iResolution < _800x600)
FilenameForBPP("INTERFACE\\OptionsScreenBackGround.sti", VObjectDesc.ImageFile);
else if (iResolution < _1024x768)
FilenameForBPP("INTERFACE\\OptionsScreenBackGround_800x600.sti", VObjectDesc.ImageFile);
else
FilenameForBPP("INTERFACE\\OptionsScreenBackGround_1024x768.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiMPSMainBackGroundImage ));
//Cancel button
giMPSCancelBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 );
guiMPSCancelButton = CreateIconAndTextButton( giMPSCancelBtnImage, gzMPSScreenText[MPS_CANCEL_TEXT], OPT_BUTTON_FONT,
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
TEXT_CJUSTIFIED,
MPS_BTN_CANCEL_X, MPS_BTN_CANCEL_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnMPSCancelCallback);
SpecifyButtonSoundScheme( guiMPSCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
SpecifyDisabledButtonStyle( guiMPSCancelButton, DISABLED_STYLE_NONE );
//Continue button
giMPSContinueBtnImage = UseLoadedButtonImage( giMPSCancelBtnImage, -1,1,-1,3,-1 );
guiMPSContinueButton = CreateIconAndTextButton( giMPSContinueBtnImage, gzMPSScreenText[MPS_CONTINUE_TEXT], OPT_BUTTON_FONT,
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
TEXT_CJUSTIFIED,
MPS_BTN_CONTINUE_X, MPS_BTN_CONTINUE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnMPSContinueCallback);
SpecifyButtonSoundScheme( guiMPSContinueButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
SpecifyDisabledButtonStyle( guiMPSContinueButton, DISABLED_STYLE_NONE );
//Reset the exit screen - screen the main game loop will call next iteration
gubMPSExitScreen = MP_SCORE_SCREEN;
//REnder the screen once so we can blt ot to ths save buffer
RenderMPSScreen();
BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
gfMPSButtonsAllocated = TRUE;
return( TRUE );
} // End of EnterMPSScreen()
BOOLEAN ExitMPSScreen()
{
if( !gfMPSButtonsAllocated )
return( TRUE );
//Delete the main options screen background
DeleteVideoObjectFromIndex( guiMPSMainBackGroundImage );
RemoveButton( guiMPSContinueButton );
RemoveButton( guiMPSCancelButton );
UnloadButtonImage( giMPSCancelBtnImage );
UnloadButtonImage( giMPSContinueBtnImage );
// exit text input mode in this screen and clean up text boxes
//KillAllTextInputModes();
SetTextInputCursor( CURSOR_IBEAM );
gfMPSButtonsAllocated = FALSE;
//If we are starting the game stop playing the music
if( gubMPSScreenHandler == MPS_CONTINUE )
SetMusicMode( MUSIC_NONE );
gfMPSScreenExit = FALSE;
gfMPSScreenEntry = TRUE;
return( TRUE );
} // End of ExitMPJScreen()
void HandleMPSScreen()
{
if( gubMPSScreenHandler != MPS_NOTHING )
{
switch( gubMPSScreenHandler )
{
case MPS_CANCEL:
if (is_server)
server_disconnect();
if (is_client)
client_disconnect();
gubMPSExitScreen = MAINMENU_SCREEN;
gfMPSScreenExit = TRUE;
break;
/*case MPJ_HOST:
gubMPJExitScreen = MP_HOST_SCREEN;
gfMPJScreenExit = TRUE;
break;*/
case MPS_CONTINUE:
{
//if we are already fading out, get out of here
if( gFadeOutDoneCallback != DoneFadeOutForExitMPSScreen )
{
//Disable the ok button
DisableButton( guiMPSCancelButton );
DisableButton( guiMPSContinueButton );
gFadeOutDoneCallback = DoneFadeOutForExitMPSScreen;
FadeOutNextFrame( );
}
break;
}
}
gubMPSScreenHandler = MPS_NOTHING;
}
// disable the continue button
if (!is_server)
{
if (gfMPSScoreScreenCanContinue)
ShowButton( guiMPSContinueButton );
else
HideButton( guiMPSContinueButton );
}
if( gfReRenderMPSScreen )
{
RenderMPSScreen();
gfReRenderMPSScreen = FALSE;
}
// <TODO> add restore backgrounds in...
//RestoreGIOButtonBackGrounds();
} // end of HandleMPJScreen
BOOLEAN RenderMPSScreen()
{
HVOBJECT hPixHandle;
UINT16 usPosY;
//Get the main background screen graphic and blt it
GetVideoObject(&hPixHandle, guiMPSMainBackGroundImage );
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,(SCREEN_WIDTH - xResSize)/2,(SCREEN_HEIGHT - yResSize)/2, VO_BLT_SRCTRANSPARENCY,NULL);
//Shade the background
ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 );
//Display the title
DrawTextToScreen( gzMPSScreenText[ MPS_TITLE_TEXT ], MPS_MAIN_TITLE_X, MPS_MAIN_TITLE_Y, MPS_MAIN_TITLE_WIDTH, MPS_TITLE_FONT, MPS_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
// Player Column
DisplayWrappedString( MPS_LABEL_PLAYER_X, MPS_LABEL_PLAYER_Y, MPS_LABEL_PLAYER_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_PLAYER_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Kills Column
DisplayWrappedString( MPS_LABEL_KILLS_X, MPS_LABEL_KILLS_Y, MPS_LABEL_KILLS_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_KILLS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Deaths Column
DisplayWrappedString( MPS_LABEL_DEATHS_X, MPS_LABEL_DEATHS_Y, MPS_LABEL_DEATHS_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_DEATHS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Hits Column
DisplayWrappedString( MPS_LABEL_HITS_X, MPS_LABEL_HITS_Y, MPS_LABEL_HITS_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_HITS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Misses Column
DisplayWrappedString( MPS_LABEL_MISSES_X, MPS_LABEL_MISSES_Y, MPS_LABEL_MISSES_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_MISSES_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Accuracy Column
DisplayWrappedString( MPS_LABEL_ACCURACY_X, MPS_LABEL_ACCURACY_Y, MPS_LABEL_ACCURACY_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_ACCURACY_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw players
wchar_t szPlayerName[30];
wchar_t szPlayerKills[4];
wchar_t szPlayerDeaths[4];
wchar_t szPlayerHits[4];
wchar_t szPlayerMisses[4];
wchar_t szPlayerAccuracy[8];
float flAccuracy = 0;
for(int i=0; i < 4; i++)
{
if (client_names[i] != NULL)
{
if (strcmp(client_names[i],"")!=0)
{
// valid player
usPosY = MPS_PLAYERLIST_Y + (i * MPS_PLAYER_GAP);
// Draw Player Name Column
memset(szPlayerName,0,30*sizeof(wchar_t));
mbstowcs( szPlayerName,client_names[i],30);
DisplayWrappedString( MPS_LABEL_PLAYER_X, usPosY, MPS_LABEL_PLAYER_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerName, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Kills Column
memset(szPlayerKills,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[i].kills,szPlayerKills,10);
DisplayWrappedString( MPS_LABEL_KILLS_X, usPosY, MPS_LABEL_KILLS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerKills, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Deaths Column
memset(szPlayerDeaths,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[i].deaths,szPlayerDeaths,10);
DisplayWrappedString( MPS_LABEL_DEATHS_X, usPosY, MPS_LABEL_DEATHS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerDeaths, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Hits Column
memset(szPlayerHits,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[i].hits,szPlayerHits,10);
DisplayWrappedString( MPS_LABEL_HITS_X, usPosY, MPS_LABEL_HITS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerHits, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Misses Column
memset(szPlayerMisses,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[i].misses,szPlayerMisses,10);
DisplayWrappedString( MPS_LABEL_MISSES_X, usPosY, MPS_LABEL_MISSES_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerMisses, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Accuracy Column
if ( gMPPlayerStats[i].misses + gMPPlayerStats[i].hits > 0 )
flAccuracy = ((float)gMPPlayerStats[i].hits / (float)(gMPPlayerStats[i].misses + gMPPlayerStats[i].hits)) * 100.0f;
else
flAccuracy = 0;
memset(szPlayerAccuracy,0,8*sizeof(wchar_t));
swprintf(szPlayerAccuracy,L"%i%%%%%%%%",(int)flAccuracy); // this thing goes through like three printfs before being rendered....
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 );
}
}
}
if (cGameType==MP_TYPE_COOP)
{
// CO-OP Mode, show stats for queens army
usPosY = MPS_PLAYERLIST_Y + (5 * MPS_PLAYER_GAP); // leave a space between players and AI
// Draw AI Team Name
DisplayWrappedString( MPS_LABEL_PLAYER_X, usPosY, MPS_LABEL_PLAYER_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, gzMPSScreenText[MPS_AITEAM_TEXT], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Kills Column
memset(szPlayerKills,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[4].kills,szPlayerKills,10);
DisplayWrappedString( MPS_LABEL_KILLS_X, usPosY, MPS_LABEL_KILLS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerKills, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Deaths Column
memset(szPlayerDeaths,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[4].deaths,szPlayerDeaths,10);
DisplayWrappedString( MPS_LABEL_DEATHS_X, usPosY, MPS_LABEL_DEATHS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerDeaths, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Hits Column
memset(szPlayerHits,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[4].hits,szPlayerHits,10);
DisplayWrappedString( MPS_LABEL_HITS_X, usPosY, MPS_LABEL_HITS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerHits, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Misses Column
memset(szPlayerMisses,0,4*sizeof(wchar_t));
_itow(gMPPlayerStats[4].misses,szPlayerMisses,10);
DisplayWrappedString( MPS_LABEL_MISSES_X, usPosY, MPS_LABEL_MISSES_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerMisses, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Draw Accuracy Column
if ( gMPPlayerStats[4].misses + gMPPlayerStats[4].hits > 0 )
flAccuracy = ((float)gMPPlayerStats[4].hits / (float)(gMPPlayerStats[4].misses + gMPPlayerStats[4].hits)) * 100.0f;
else
flAccuracy = 0;
memset(szPlayerAccuracy,0,8*sizeof(wchar_t));
swprintf(szPlayerAccuracy,L"%i%%%%%%%%",(int)flAccuracy);
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 );
// Server IP text label
DisplayWrappedString( MPJ_LABEL_IP_X, MPJ_LABEL_IP_Y, MPJ_LABEL_IP_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_SERVERIP_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
// Server Port text label
DisplayWrappedString( MPJ_LABEL_PORT_X, MPJ_LABEL_PORT_Y, MPJ_LABEL_PORT_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_SERVERPORT_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
*/
return( TRUE );
} // end of RenderMPSScreen()
void GetMPSScreenUserInput()
{
InputAtom Event;
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
{
// check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
{
switch( Event.usParam )
{
case ESC:
//Exit out of the screen
gubMPSScreenHandler = MPS_CANCEL;
break;
case ENTER:
gubMPSScreenHandler = MPS_CONTINUE;
break;
}
}
}
} // end of GetMPSScreenUserInput()
void DoneFadeOutForExitMPSScreen( void )
{
// As we bypassed the GIO screen, set up some game options for multiplayer here
// <TODO> most things i have left as thier defaults here for testing.
is_networked = true;
ReStartingGame();
if (is_client)
{
client_disconnect();
}
if(is_server)
{
server_disconnect();
}
//NetworkAutoStart will handle reconnection in Map Screen
// reset client auto_retry for NetworkAutoStart called in MapScreenHandle
auto_retry = true;
giNumTries = 5;
if (is_networked)
gGameOptions.fTurnTimeLimit = TRUE;
else
gGameOptions.fTurnTimeLimit = FALSE;
// Bobby Rays - why would we want anything less than the best
gGameOptions.ubBobbyRay = BR_AWESOME;
gubMPSExitScreen = 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
#ifdef JA2UB
//SetIntroType( INTRO_BEGINNING );
#else
SetIntroType( INTRO_BEGINNING );
#endif
ExitMPSScreen(); // cleanup please, if we called a fadeout then we didnt do it above
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
}
void DoneFadeInForExitMPSScreen( void )
{
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
}
void BtnMPSCancelCallback(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 );
gubMPSScreenHandler = MPS_CANCEL;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
void BtnMPSContinueCallback(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 );
gubMPSScreenHandler = MPS_CONTINUE;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}