diff --git a/Strategic/Game Clock.cpp b/Strategic/Game Clock.cpp index d72d848d..33d0e9b0 100644 --- a/Strategic/Game Clock.cpp +++ b/Strategic/Game Clock.cpp @@ -3,7 +3,7 @@ #else #include "sgp.h" #include "Game Clock.h" - #include "Font Control.h" + #include "Font.h" #include "render dirty.h" #include "Timer Control.h" #include "overhead.h" @@ -60,6 +60,14 @@ BOOLEAN gfJustFinishedAPause = FALSE; // clock mouse region MOUSE_REGION gClockMouseRegion; MOUSE_REGION gClockScreenMaskMouseRegion; + +// Moa: Clock koords moved from Interface Panels.cpp +INT16 INTERFACE_CLOCK_X; +INT16 INTERFACE_CLOCK_Y; +// CHRISL: Added new "TM" variables to allow team and inventory screens to place the clock independantly of each other +INT16 INTERFACE_CLOCK_TM_X; +INT16 INTERFACE_CLOCK_TM_Y; + void AdvanceClock( UINT8 ubWarpCode ); extern BOOLEAN fMapScreenBottomDirty; @@ -68,9 +76,6 @@ extern BOOLEAN fMapScreenBottomDirty; #define SECONDS_PER_COMPRESSION 1 // 1/2 minute passes every 1 second of real time #define SECONDS_PER_COMPRESSION_IN_RTCOMBAT 10 #define SECONDS_PER_COMPRESSION_IN_TBCOMBAT 10 -#define CLOCK_STRING_HEIGHT 13 -#define CLOCK_STRING_WIDTH 66 -#define CLOCK_FONT COMPFONT //These contain all of the information about the game time, rate of time, etc. @@ -303,11 +308,12 @@ BOOLEAN HasTimeCompressOccured( void ) return( fTimeCompressHasOccured ); } - - +// +// \brief renders WORLDTIMESTR or pPausedGameText[0] centered into a box located at sX, sY (top left coords) +// void RenderClock( INT16 sX, INT16 sY ) { - SetFont( CLOCK_FONT ); + SetFont( CLOCKFONT ); SetFontBackground( FONT_MCOLOR_BLACK ); #ifdef CRIPPLED_VERSION @@ -333,15 +339,18 @@ void RenderClock( INT16 sX, INT16 sY ) } // Erase first! - RestoreExternBackgroundRect(sX, sY, CLOCK_STRING_WIDTH, CLOCK_STRING_HEIGHT ); + RestoreExternBackgroundRect(sX, sY, CLOCK_AREA_WIDTH, CLOCK_AREA_HEIGHT ); + INT16 centeredX,centeredY; if( ( gfPauseDueToPlayerGamePause == FALSE ) ) { - mprintf( sX + (CLOCK_STRING_WIDTH - StringPixLength( WORLDTIMESTR, CLOCK_FONT ))/2, sY, WORLDTIMESTR ); + FindFontCenterCoordinates(sX, sY, CLOCK_AREA_WIDTH, CLOCK_AREA_HEIGHT, WORLDTIMESTR, CLOCKFONT, ¢eredX, ¢eredY); + mprintf( centeredX, centeredY, WORLDTIMESTR ); } else { - mprintf( sX + (CLOCK_STRING_WIDTH - StringPixLength( pPausedGameText[ 0 ], CLOCK_FONT ))/2, sY, pPausedGameText[ 0 ] ); + FindFontCenterCoordinates(sX, sY, CLOCK_AREA_WIDTH, CLOCK_AREA_HEIGHT, pPausedGameText[ 0 ], CLOCKFONT, ¢eredX, ¢eredY); + mprintf( centeredX, centeredY, pPausedGameText[ 0 ] ); } } @@ -1038,17 +1047,20 @@ BOOLEAN LoadGameClock( HWFILE hFile ) return( TRUE ); } - +// +// \brief Creates MOUSE_REGION for FastHelpText and PauseOfClockBtnCallback() centered around a box located at sX, sY (top left coords). +// void CreateMouseRegionForPauseOfClock( INT16 sX, INT16 sY ) { if( fClockMouseRegionCreated == FALSE ) { - INT16 sXVal = sX; - INT16 sYVal = sY; - // create a mouse region for pausing of game clock - MSYS_DefineRegion( &gClockMouseRegion, (UINT16)( sXVal ), (UINT16)( sYVal ),(UINT16)( sX + CLOCK_REGION_WIDTH ), (UINT16)( sY + CLOCK_REGION_HEIGHT), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback ); + MSYS_DefineRegion( &gClockMouseRegion, + (UINT16)( sX - CLOCK_REGION_OFFSET_X ), + (UINT16)( sY - CLOCK_REGION_OFFSET_Y ), + (UINT16)( sX + CLOCK_AREA_WIDTH + CLOCK_REGION_OFFSET_X), + (UINT16)( sY + CLOCK_AREA_HEIGHT + CLOCK_REGION_OFFSET_Y), + MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback ); fClockMouseRegionCreated = TRUE; @@ -1184,8 +1196,11 @@ void RenderPausedGameBox( void ) { if( ( gfPauseDueToPlayerGamePause == TRUE ) && ( gfGamePaused == TRUE ) && ( iPausedPopUpBox != -1 ) ) { - RenderMercPopUpBoxFromIndex( iPausedPopUpBox, ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), FRAME_BUFFER ); - InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) ); + //Moa: centered PausedGameBox to Screen + //RenderMercPopUpBoxFromIndex( iPausedPopUpBox, ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), FRAME_BUFFER ); + //InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) ); + RenderMercPopUpBoxFromIndex( iPausedPopUpBox, ( INT16 )( (SCREEN_WIDTH - usPausedActualWidth) / 2 ), ( INT16 )( (SCREEN_HEIGHT - usPausedActualHeight) / 2 ), FRAME_BUFFER ); + InvalidateRegion( ( INT16 )( (SCREEN_WIDTH - usPausedActualWidth) / 2 ), ( INT16 )( (SCREEN_HEIGHT - usPausedActualHeight) / 2 ), ( INT16 )( (SCREEN_WIDTH - usPausedActualWidth) / 2 + usPausedActualWidth ), ( INT16 )( (SCREEN_HEIGHT - usPausedActualHeight) / 2 + usPausedActualHeight ) ); } // reset we've just finished a pause by the player diff --git a/Strategic/Game Clock.h b/Strategic/Game Clock.h index 55a0fb2d..eed8b06e 100644 --- a/Strategic/Game Clock.h +++ b/Strategic/Game Clock.h @@ -1,19 +1,21 @@ #ifndef __WORLD_CLOCK #define __WORLD_CLOCK -#include "FileMan.h" -// where the time string itself is rendered -#define CLOCK_X (SCREEN_WIDTH - xResSize)/2 + (xResSize - 86) -#define CLOCK_REGION_START_X (CLOCK_X + 2) -#define CLOCK_REGION_WIDTH ((xResSize - 20) - CLOCK_REGION_START_X) -#define CLOCK_Y (SCREEN_HEIGHT - 21) +//Moa: renderable area should match the background area where ClockString gets rendered, !use even numbers! +#define CLOCK_AREA_HEIGHT 14 //hight of renderable area should match the background area where ClockString gets rendered +#define CLOCK_AREA_WIDTH 66 //x boundary +//Clock coords moved from Interface Panels.cpp, gets initialized in InitializeSMPanelCoordsNew()/InitializeSMPanelCoordsOld() +extern INT16 INTERFACE_CLOCK_X; // xPos of Left Top edge of boundary +extern INT16 INTERFACE_CLOCK_Y; +//the mouse region around the clock (bigger), actual region position depends on parameters given to CreateMouseRegionForPauseOfClock(INT16,INT16) +#define CLOCK_REGION_OFFSET_X 1 +#define CLOCK_REGION_OFFSET_Y 1 +// CHRISL: Added new "TM" variables to allow team and inventory screens to place the clock independantly of each other @see Interface Panels.cpp->InitializeTEAMPanelCoords() +extern INT16 INTERFACE_CLOCK_TM_X; +extern INT16 INTERFACE_CLOCK_TM_Y; -// the mouse region around the clock (bigger) - -#define CLOCK_REGION_START_Y (SCREEN_HEIGHT - 24) -#define CLOCK_REGION_HEIGHT ((SCREEN_HEIGHT - 12) - CLOCK_REGION_START_Y) #define NUM_SEC_IN_DAY 86400 #define NUM_SEC_IN_HOUR 3600 diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 845891a8..cc006aa8 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -1542,7 +1542,7 @@ void CreateDestroyMouseRegionMasksForTimeCompressionButtons( void ) MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback ); // mask over pause game button - MSYS_DefineRegion( &gTimeCompressionMask[ 2 ], xResOffset + (xResSize - 153), (SCREEN_HEIGHT - 24), xResOffset + (xResSize - 153) - 118, (SCREEN_HEIGHT - 13), MSYS_PRIORITY_HIGHEST - 1, + MSYS_DefineRegion( &gTimeCompressionMask[ 2 ], xResOffset + (xResSize - 153), (SCREEN_HEIGHT - 24), xResOffset + (xResSize - 153) + 118, (SCREEN_HEIGHT - 13), MSYS_PRIORITY_HIGHEST - 1, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, CompressMaskClickCallback ); fCreated = TRUE; diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index 9e621dd2..388379de 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -1168,7 +1168,7 @@ void ExitQuestDebugSystem() //Create the clock mouse region - CreateMouseRegionForPauseOfClock( CLOCK_REGION_START_X, CLOCK_REGION_START_Y ); + CreateMouseRegionForPauseOfClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); giHaveSelectedNPC = gNpcListBox.sCurSelectedItem; giHaveSelectedItem = gItemListBox.sCurSelectedItem; diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index d34cb422..65b08354 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -5129,7 +5129,7 @@ UINT32 MapScreenHandle(void) SpecifyButtonDownTextColors( giMapContractButton, CHAR_TEXT_FONT_COLOR, FONT_BLACK ); // create mouse region for pause clock - CreateMouseRegionForPauseOfClock( CLOCK_REGION_START_X, CLOCK_REGION_START_Y ); + CreateMouseRegionForPauseOfClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); // WANNE: The number of merc we can display in the list, depends on the resolution if (iResolution >= _640x480 && iResolution < _800x600) @@ -5641,7 +5641,7 @@ UINT32 MapScreenHandle(void) // render clock // WANNE: Renders the clock in the strategy screen - RenderClock(CLOCK_X, CLOCK_Y); + RenderClock(INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y); #ifdef JA2TESTVERSION if( !gfWorldLoaded ) diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index d1dafeeb..a9537ec5 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -37,7 +37,7 @@ #include "Interface Items.h" #include "interface control.h" #include "interface utils.h" - #include "game clock.h" + #include "Game Clock.h" #include "mapscreen.h" #include "Soldier Macros.h" #include "strategicmap.h" @@ -330,15 +330,11 @@ TEAM_PANEL_SLOTS_TYPE gTeamPanel[ NUM_TEAM_SLOTS ]; * i will work with radar screen to allow moving it. or maby someone else will do it * any questions? joker */ -int INTERFACE_CLOCK_X; -int INTERFACE_CLOCK_Y; int LOCATION_NAME_X; int LOCATION_NAME_Y; -/* CHRISL: Added new "TM" variables to allow team and inventory screens to place the clock and location name +/* CHRISL: Added new "TM" variables to allow team and inventory screens to place the location name independantly of each other */ -int INTERFACE_CLOCK_TM_X; -int INTERFACE_CLOCK_TM_Y; int LOCATION_NAME_TM_X; int LOCATION_NAME_TM_Y; @@ -1559,8 +1555,13 @@ BOOLEAN InitializeSMPanelCoordsOld() SM_DONE_X = xResOffset + (xResSize - 97); SM_MAPSCREEN_X = xResOffset + (xResSize - 51); - INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); - LOCATION_NAME_X = xResOffset + (xResSize - 92); + +//dnl INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); +//dnl INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); + INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); + INTERFACE_CLOCK_Y = SCREEN_HEIGHT - 24; + LOCATION_NAME_X = xResOffset + (xResSize - 92); + LOCATION_NAME_Y = ( 65 + INTERFACE_START_Y ); SM_DONE_Y = ( 4 + INV_INTERFACE_START_Y ); SM_MAPSCREEN_Y = ( 4 + INV_INTERFACE_START_Y ); @@ -1625,10 +1626,6 @@ BOOLEAN InitializeSMPanelCoordsOld() STATS_TITLE_FONT_COLOR = 6; STATS_TEXT_FONT_COLOR = 5; - // ow and te clock and location i will put it here - INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); - LOCATION_NAME_Y = ( 65 + INTERFACE_START_Y ); - // Keyring 496/106 on Inventory_Bottom_Panel.sti KEYRING_X = xResOffset + 496; KEYRING_Y = (106 + INV_INTERFACE_START_Y); @@ -1918,8 +1915,13 @@ BOOLEAN InitializeSMPanelCoordsNew() SM_ZIPPER_Y = ( 39 + INV_INTERFACE_START_Y ); SM_MAPSCREEN_X = xResOffset + (xResSize - 146); // 152 SM_DONE_X = xResOffset + (xResSize - 146); // 152 + +//dnl INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); +//dnl INTERFACE_CLOCK_Y = ( 119 + INV_INTERFACE_START_Y ); INTERFACE_CLOCK_X = xResOffset + (xResSize - 86); + INTERFACE_CLOCK_Y = SCREEN_HEIGHT - 24; LOCATION_NAME_X = xResOffset + (xResSize - 92); + LOCATION_NAME_Y = ( 89 + INTERFACE_START_Y ); SM_DONE_Y = ( 118 + INV_INTERFACE_START_Y ); SM_MAPSCREEN_Y = ( 140 + INV_INTERFACE_START_Y ); @@ -1997,10 +1999,6 @@ BOOLEAN InitializeSMPanelCoordsNew() STATS_TITLE_FONT_COLOR = 6; STATS_TEXT_FONT_COLOR = 5; - // ow and te clock and location i will put it here - INTERFACE_CLOCK_Y = ( 117 + INV_INTERFACE_START_Y ); - LOCATION_NAME_Y = ( 89 + INTERFACE_START_Y ); - //Keyring 218/5 on Inventory_Bottom_Panel.sti KEYRING_X = xResOffset + 219; //209; KEYRING_Y = (5 + INV_INTERFACE_START_Y); @@ -5102,8 +5100,11 @@ BOOLEAN InitializeTEAMPanelCoords( ) TM_ENDTURN_X = xResOffset + (xResSize - 131); TM_ROSTERMODE_X = xResOffset + (xResSize - 131); TM_DISK_X = xResOffset + (xResSize - 131); + // CHRISL: New definitions for the team panel clock and location coordinates INTERFACE_CLOCK_TM_X = xResOffset + (xResSize - 86 ); - LOCATION_NAME_TM_X = xResOffset + (xResSize - 92 ); + INTERFACE_CLOCK_TM_Y = ( 96 + INTERFACE_START_Y ); + LOCATION_NAME_TM_X = xResOffset + (xResSize - 92 ); + LOCATION_NAME_TM_Y = ( 65 + INTERFACE_START_Y ); TM_ENDTURN_Y = ( 9 + INTERFACE_START_Y ); TM_ROSTERMODE_Y = ( 45 + INTERFACE_START_Y ); @@ -5222,10 +5223,6 @@ BOOLEAN InitializeTEAMPanelCoords( ) sTEAMHandInvXY[10] = ( TM_INV_HAND1STARTX + ( 5 * TM_INV_HAND_SEP )); sTEAMHandInvXY[11] = TM_INV_HAND1STARTY; // ufff to much copy&paste :D */ - // CHRISL: New definitions for the team panel clock and location coordinates - - INTERFACE_CLOCK_TM_Y = ( 99 + INTERFACE_START_Y ); - LOCATION_NAME_TM_Y = ( 65 + INTERFACE_START_Y ); return ( TRUE ); } diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index dbc95584..f002eb65 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -43,8 +43,8 @@ typedef enum #define SHOW_LOCATOR_NORMAL 1 #define SHOW_LOCATOR_FAST 2 -extern int INTERFACE_CLOCK_X; -extern int INTERFACE_CLOCK_Y; +//extern INT16 INTERFACE_CLOCK_X; +//extern INT16 INTERFACE_CLOCK_Y; extern int LOCATION_NAME_X; extern int LOCATION_NAME_Y; diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 59165949..1e8508b6 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -1489,7 +1489,6 @@ void HandleShopKeeperInterface() } // CHRISL: If in NIV mode, don't display the clock - //RenderClock( CLOCK_X, CLOCK_Y ); if( UsingNewInventorySystem() == false ) RenderClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); // CHRISL: Added X,Y parameters to allow control of TownID string placement. @@ -1665,7 +1664,6 @@ BOOLEAN RenderShopKeeperInterface() //Render the clock and the town name // CHRISL: If in NIV mode, don't display the clock - //RenderClock( CLOCK_X, CLOCK_Y ); if( UsingNewInventorySystem() == false ) RenderClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); // CHRISL: Added X,Y parameters to allow control of TownID string placement. diff --git a/Utils/Font Control.h b/Utils/Font Control.h index 11fb7d06..f0c1a6bc 100644 --- a/Utils/Font Control.h +++ b/Utils/Font Control.h @@ -104,7 +104,8 @@ extern BOOLEAN gfFontsInit; #define SMALLFONT1 gpSmallFontType1 #define TINYFONT1 gpTinyFontType1 #define FONT12POINT1 gp12PointFont1 -#define CLOCKFONT gpClockFont +//#define CLOCKFONT gpClockFont //remove comment if change ok! "FONTS\\CLOCKFONT.sti" does not exist in Data Folder! +#define CLOCKFONT gpCompFont #define COMPFONT gpCompFont #define SMALLCOMPFONT gpSmallCompFont #define FONT10ROMAN gp10PointRoman