Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+51 -49
View File
@@ -47,9 +47,9 @@ BOOLEAN fClockMouseRegionCreated = FALSE;
BOOLEAN fTimeCompressHasOccured = FALSE;
//This value represents the time that the sector was loaded. If you are in sector A9, and leave
//the game clock at that moment will get saved into the temp file associated with it. The next time you
//enter A9, this value will contain that time. Used for scheduling purposes.
//This value represents the time that the sector was loaded. If you are in sector A9, and leave
//the game clock at that moment will get saved into the temp file associated with it. The next time you
//enter A9, this value will contain that time. Used for scheduling purposes.
UINT32 guiTimeCurrentSectorWasLastLoaded = 0;
// did we JUST finish up a game pause by the player
@@ -63,7 +63,7 @@ void AdvanceClock( UINT8 ubWarpCode );
extern BOOLEAN fMapScreenBottomDirty;
#define SECONDS_PER_COMPRESSION 1 // 1/2 minute passes every 1 second of real time
#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
@@ -77,19 +77,19 @@ INT32 giTimeCompressMode = TIME_COMPRESS_X0;
UINT8 gubClockResolution = 1;
BOOLEAN gfGamePaused = TRUE;
BOOLEAN gfTimeInterrupt = FALSE;
BOOLEAN gfTimeInterruptPause = FALSE;
BOOLEAN gfTimeInterruptPause = FALSE;
BOOLEAN fSuperCompression = FALSE;
UINT32 guiGameClock = gGameExternalOptions.iGameStartingTime;
UINT32 guiPreviousGameClock = 0; // used only for error-checking purposes
UINT32 guiGameSecondsPerRealSecond;
UINT32 guiTimesThisSecondProcessed = 0;
INT32 iPausedPopUpBox = -1;
INT32 iPausedPopUpBox = -1;
UINT32 guiDay;
UINT32 guiHour;
UINT32 guiMin;
CHAR16 gswzWorldTimeStr[20];
INT32 giTimeCompressSpeeds[ NUM_TIME_COMPRESS_SPEEDS ] = { 0, 1, 5 * 60, 30 * 60, 60 * 60 };
UINT16 usPausedActualWidth;
UINT16 usPausedActualWidth;
UINT16 usPausedActualHeight;
UINT32 guiTimeOfLastEventQuery = 0;
BOOLEAN gfLockPauseState = FALSE;
@@ -98,7 +98,7 @@ BOOLEAN gfResetAllPlayerKnowsEnemiesFlags = FALSE;
BOOLEAN gfTimeCompressionOn = FALSE;
UINT32 guiLockPauseStateLastReasonId = 0;
//***When adding new saved time variables, make sure you remove the appropriate amount from the paddingbytes and
// more IMPORTANTLY, add appropriate code in Save/LoadGameClock()!
// more IMPORTANTLY, add appropriate code in Save/LoadGameClock()!
#define TIME_PADDINGBYTES 20
UINT8 gubUnusedTimePadding[TIME_PADDINGBYTES];
@@ -151,23 +151,23 @@ UINT32 GetWorldDay( )
UINT32 GetWorldDayInSeconds( )
{
return( guiDay * NUM_SEC_IN_DAY );
return( guiDay * NUM_SEC_IN_DAY );
}
UINT32 GetWorldDayInMinutes( )
{
return( ( guiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
return( ( guiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
}
UINT32 GetFutureDayInMinutes( UINT32 uiDay )
{
return( ( uiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
return( ( uiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
}
//this function returns the amount of minutes there has been from start of game to midnight of the uiDay.
//this function returns the amount of minutes there has been from start of game to midnight of the uiDay.
UINT32 GetMidnightOfFutureDayInMinutes( UINT32 uiDay )
{
return( GetWorldTotalMin() + ( uiDay * 1440 ) - GetWorldMinutesInDay( ) );
return( GetWorldTotalMin() + ( uiDay * 1440 ) - GetWorldMinutesInDay( ) );
}
// Not to be used too often by things other than internally
@@ -208,14 +208,14 @@ void AdvanceClock( UINT8 ubWarpCode )
if( ubWarpCode != WARPTIME_NO_PROCESSING_OF_EVENTS )
{
guiTimeOfLastEventQuery = guiGameClock;
//First of all, events are posted for movements, pending attacks, equipment arrivals, etc. This time
//adjustment using time compression can possibly pass one or more events in a single pass. So, this list
//First of all, events are posted for movements, pending attacks, equipment arrivals, etc. This time
//adjustment using time compression can possibly pass one or more events in a single pass. So, this list
//is looked at and processed in sequential order, until the uiAdjustment is fully applied.
if( GameEventsPending( guiGameSecondsPerRealSecond ) )
{
//If a special event, justifying the cancellation of time compression is reached, the adjustment
//will be shortened to the time of that event, and will stop processing events, otherwise, all
//of the events in the time slice will be processed. The time is adjusted internally as events
//of the events in the time slice will be processed. The time is adjusted internally as events
//are processed.
ProcessPendingGameEvents( guiGameSecondsPerRealSecond, ubWarpCode );
}
@@ -265,9 +265,9 @@ void AdvanceClock( UINT8 ubWarpCode )
void AdvanceToNextDay()
{
INT32 uiDiff;
INT32 uiDiff;
UINT32 uiTomorrowTimeInSec;
uiTomorrowTimeInSec = (guiDay+1)*NUM_SEC_IN_DAY + 8*NUM_SEC_IN_HOUR + 15*NUM_SEC_IN_MIN;
uiDiff = uiTomorrowTimeInSec - guiGameClock;
WarpGameTime( uiDiff, WARPTIME_PROCESS_EVENTS_NORMALLY );
@@ -294,7 +294,7 @@ void ResetTimeCompressHasOccured( void )
// has time compress occured?
BOOLEAN HasTimeCompressOccured( void )
{
return( fTimeCompressHasOccured );
return( fTimeCompressHasOccured );
}
@@ -328,7 +328,7 @@ void RenderClock( INT16 sX, INT16 sY )
// Erase first!
RestoreExternBackgroundRect(sX, sY, CLOCK_STRING_WIDTH, CLOCK_STRING_HEIGHT );
if( ( gfPauseDueToPlayerGamePause == FALSE ) )
{
mprintf( sX + (CLOCK_STRING_WIDTH - StringPixLength( WORLDTIMESTR, CLOCK_FONT ))/2, sY, WORLDTIMESTR );
@@ -348,7 +348,7 @@ void ToggleSuperCompression()
// Display message
if ( gTacticalStatus.uiFlags & INCOMBAT )
{
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Cannot toggle compression in Combat Mode." );
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Cannot toggle compression in Combat Mode." );
return;
}
@@ -360,16 +360,16 @@ void ToggleSuperCompression()
giTimeCompressMode = TIME_SUPER_COMPRESS;
guiGameSecondsPerRealSecond = giTimeCompressSpeeds[ giTimeCompressMode ] * SECONDS_PER_COMPRESSION;
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression ON." );
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression ON." );
}
else
{
giTimeCompressMode = uiOldTimeCompressMode;
guiGameSecondsPerRealSecond = giTimeCompressSpeeds[ giTimeCompressMode ] * SECONDS_PER_COMPRESSION;
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression OFF." );
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression OFF." );
}
}
}
BOOLEAN DidGameJustStart()
@@ -393,7 +393,7 @@ void StopTimeCompression( void )
void StartTimeCompression( void )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartTimeCompression");
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartTimeCompression");
if ( !gfTimeCompressionOn )
{
@@ -645,7 +645,7 @@ BOOLEAN PauseStateLocked()
void PauseGame()
{
// always allow pausing, even if "locked". Locking applies only to trying to compress time, not to pausing it
// always allow pausing, even if "locked". Locking applies only to trying to compress time, not to pausing it
if( !gfGamePaused )
{
gfGamePaused = TRUE;
@@ -702,9 +702,9 @@ void PauseTimeForInterupt()
}
//USING CLOCK RESOLUTION
//Note, that changing the clock resolution doesn't affect the amount of game time that passes per
//real second, but how many times per second the clock is updated. This rate will break up the actual
//time slices per second into smaller chunks. This is useful for animating strategic movement under
//Note, that changing the clock resolution doesn't effect the amount of game time that passes per
//real second, but how many times per second the clock is updated. This rate will break up the actual
//time slices per second into smaller chunks. This is useful for animating strategic movement under
//fast time compression, so objects don't warp around.
void SetClockResolutionToDefault()
{
@@ -726,11 +726,11 @@ UINT8 ClockResolution()
//There are two factors that influence the flow of time in the game.
//-Speed: The speed is the amount of game time passes per real second of time. The higher this
// value, the faster the game time flows.
//-Resolution: The higher the resolution, the more often per second the clock is actually updated.
// This value doesn't affect how much game time passes per real second, but allows for
// a more accurate representation of faster time flows.
//-Speed: The speed is the amount of game time passes per real second of time. The higher this
// value, the faster the game time flows.
//-Resolution: The higher the resolution, the more often per second the clock is actually updated.
// This value doesn't affect how much game time passes per real second, but allows for
// a more accurate representation of faster time flows.
void UpdateClock()
{
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"UpdateClock");
@@ -788,7 +788,7 @@ void UpdateClock()
#endif
//Because we debug so much, breakpoints tend to break the game, and cause unnecessary headaches.
//This line ensures that no more than 1 real-second passes between frames. This otherwise has
//This line ensures that no more than 1 real-second passes between frames. This otherwise has
//no effect on anything else.
uiLastSecondTime = max( uiNewTime - 1000, uiLastSecondTime );
@@ -799,7 +799,7 @@ void UpdateClock()
{
uiLastSecondTime = uiNewTime;
guiTimesThisSecondProcessed = uiLastTimeProcessed = 0;
AdvanceClock( WARPTIME_PROCESS_EVENTS_NORMALLY );
AdvanceClock( WARPTIME_PROCESS_EVENTS_NORMALLY );
}
else if( gubClockResolution > 1 )
{
@@ -830,7 +830,7 @@ void UpdateClock()
WarpGameTime( uiNewTimeProcessed - uiLastTimeProcessed, WARPTIME_PROCESS_EVENTS_NORMALLY );
if( uiNewTimeProcessed < guiGameSecondsPerRealSecond )
{ //Processed the same real second
uiLastTimeProcessed = uiNewTimeProcessed;
uiLastTimeProcessed = uiNewTimeProcessed;
}
else
{ //We have moved into a new real second.
@@ -1027,7 +1027,7 @@ BOOLEAN LoadGameClock( HWFILE hFile )
swprintf( WORLDTIMESTR, L"%s %d, %02d:%02d", pDayStrings[ 0 ], guiDay, guiHour, guiMin );
if( !gfBasement && !gfCaves )
gfDoLighting = TRUE;
gfDoLighting = TRUE;
return( TRUE );
}
@@ -1039,8 +1039,8 @@ void CreateMouseRegionForPauseOfClock( INT16 sX, INT16 sY )
{
// create a mouse region for pausing of game clock
MSYS_DefineRegion( &gClockMouseRegion, (UINT16)( sX ), (UINT16)( sY ),(UINT16)( sX + CLOCK_REGION_WIDTH ), (UINT16)( sY + CLOCK_REGION_HEIGHT ), MSYS_PRIORITY_HIGHEST,
MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback );
MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback );
fClockMouseRegionCreated = TRUE;
if ( gfGamePaused == FALSE )
@@ -1071,7 +1071,7 @@ void PauseOfClockBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
HandlePlayerPauseUnPauseOfGame( );
HandlePlayerPauseUnPauseOfGame( );
}
}
@@ -1139,13 +1139,13 @@ void CreateDestroyScreenMaskForPauseGame( void )
{
// create a mouse region for pausing of game clock
MSYS_DefineRegion( &gClockScreenMaskMouseRegion, 0, 0 ,SCREEN_WIDTH, SCREEN_HEIGHT , MSYS_PRIORITY_HIGHEST,
0, MSYS_NO_CALLBACK, ScreenMaskForGamePauseBtnCallBack );
0, MSYS_NO_CALLBACK, ScreenMaskForGamePauseBtnCallBack );
fCreated = TRUE;
// get region x and y values
sX = ( &gClockMouseRegion ) -> RegionTopLeftX;
sY = ( &gClockMouseRegion ) -> RegionTopLeftY;
sX = ( &gClockMouseRegion )->RegionTopLeftX;
sY = ( &gClockMouseRegion )->RegionTopLeftY;
//re create region on top of this
RemoveMouseRegionForPauseOfClock( );
CreateMouseRegionForPauseOfClock( sX, sY );
@@ -1176,7 +1176,7 @@ 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 ) );
InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) );
}
// reset we've just finished a pause by the player
@@ -1184,12 +1184,14 @@ void RenderPausedGameBox( void )
}
BOOLEAN DayTime()
{ //between 7AM and 9PM
{
//between 7AM and 9PM
return ( guiHour >= 7 && guiHour < 21 );
}
BOOLEAN NightTime()
{ //before 7AM or after 9PM
{
//before 7AM or after 9PM
return ( guiHour < 7 || guiHour >= 21 );
}
@@ -1197,7 +1199,7 @@ BOOLEAN NightTime()
void ClearTacticalStuffDueToTimeCompression( void )
{
// is this test the right thing? ARM
// is this test the right thing? ARM
if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN )
{
// clear tactical event queue