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
+126 -127
View File
@@ -80,59 +80,59 @@ BOOLEAN fNewCharInActivationString = FALSE;
void EnterImpHomePage( void )
{
// upon entry to Imp home page
memset(pPlayerActivationString, 0, sizeof(pPlayerActivationString));
// reset string position
iStringPos =0;
// upon entry to Imp home page
memset(pPlayerActivationString, 0, sizeof(pPlayerActivationString));
// reset activation cursor position
uiCursorPosition = IMP_PLAYER_ACTIVATION_STRING_X;
// reset string position
iStringPos =0;
// load buttons
CreateIMPHomePageButtons( );
// reset activation cursor position
uiCursorPosition = IMP_PLAYER_ACTIVATION_STRING_X;
// we have now vsisited IMP, reset fact we haven't
fNotVistedImpYet = FALSE;
// render screen once
RenderImpHomePage( );
return;
// load buttons
CreateIMPHomePageButtons( );
// we have now vsisited IMP, reset fact we haven't
fNotVistedImpYet = FALSE;
// render screen once
RenderImpHomePage( );
return;
}
void RenderImpHomePage( void )
{
// the background
// the background
RenderProfileBackGround( );
// the IMP symbol
RenderIMPSymbol( 107, 45 );
// the second button image
// the second button image
RenderButton2Image( 134, 314);
// render the indents
//activation indents
RenderActivationIndent( 257, 328 );
// the two font page indents
RenderFrontPageIndent( 3, 64 );
RenderFrontPageIndent( 396,64 );
RenderFrontPageIndent( 396,64 );
// render the activation string
// render the activation string
DisplayPlayerActivationString( );
return;
}
void ExitImpHomePage( void )
{
// remove buttons
RemoveIMPHomePageButtons( );
RemoveIMPHomePageButtons( );
return;
}
@@ -142,26 +142,25 @@ void HandleImpHomePage( void )
{
// handle keyboard input for this screen
GetPlayerKeyBoardInputForIMPHomePage( );
GetPlayerKeyBoardInputForIMPHomePage( );
// has a new char been added to activation string
if( fNewCharInActivationString )
if( fNewCharInActivationString )
{
// display string
DisplayPlayerActivationString( );
// display string
DisplayPlayerActivationString( );
}
// render the cursor
DisplayActivationStringCursor( );
return;
return;
}
void DisplayPlayerActivationString( void )
{
// this function will grab the string that the player will enter for activation
INT32 iCounter=0;
// player gone too far, move back
if(iStringPos > 64)
@@ -172,19 +171,19 @@ void DisplayPlayerActivationString( void )
// restore background
RenderActivationIndent( 257, 328 );
// setup the font stuff
// setup the font stuff
SetFont( FONT14ARIAL );
SetFontForeground( 184 );
SetFontForeground( 184 );
SetFontBackground(FONT_BLACK);
// reset shadow
SetFontShadow(DEFAULT_SHADOW);
mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerActivationString);
// reset shadow
SetFontShadow(DEFAULT_SHADOW);
mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerActivationString);
fNewCharInActivationString = FALSE;
fReDrawScreenFlag = TRUE;
fReDrawScreenFlag = TRUE;
return;
}
@@ -192,27 +191,27 @@ void DisplayPlayerActivationString( void )
void DisplayActivationStringCursor( void )
{
// this procdure will draw the activation string cursor on the screen at position cursorx cursory
UINT32 uiDestPitchBYTES;
UINT32 uiDestPitchBYTES;
static UINT32 uiBaseTime = 0;
UINT32 uiDeltaTime = 0;
UINT8 *pDestBuf;
static UINT32 iCurrentState = 0;
static BOOLEAN fIncrement = TRUE;
static UINT32 iCurrentState = 0;
static BOOLEAN fIncrement = TRUE;
if(uiBaseTime == 0)
{
uiBaseTime = GetJA2Clock();
}
// get difference
uiDeltaTime = GetJA2Clock() - uiBaseTime;
// if difference is long enough, rotate colors
if(uiDeltaTime > MIN_GLOW_DELTA)
{
{
if( iCurrentState == 10)
{
// start rotating downward
// start rotating downward
fIncrement = FALSE;
}
if( iCurrentState == 0)
@@ -221,7 +220,7 @@ void DisplayActivationStringCursor( void )
fIncrement = TRUE;
}
// if increment upward, increment iCurrentState
if(fIncrement)
if(fIncrement)
{
iCurrentState++;
}
@@ -230,24 +229,24 @@ void DisplayActivationStringCursor( void )
// else downwards
iCurrentState--;
}
// reset basetime to current clock
// reset basetime to current clock
uiBaseTime = GetJA2Clock( );
}
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
// draw line in current state
LineDraw(TRUE, (UINT16) uiCursorPosition, CURSOR_Y, (UINT16)uiCursorPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ),
pDestBuf );
// draw line in current state
LineDraw(TRUE, (UINT16) uiCursorPosition, CURSOR_Y, (UINT16)uiCursorPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ),
pDestBuf );
// unlock frame buffer
UnLockVideoSurface( FRAME_BUFFER );
InvalidateRegion((UINT16) uiCursorPosition , CURSOR_Y , (UINT16)uiCursorPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1);
InvalidateRegion((UINT16) uiCursorPosition , CURSOR_Y , (UINT16)uiCursorPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1);
return;
}
@@ -256,17 +255,17 @@ void DisplayActivationStringCursor( void )
void GetPlayerKeyBoardInputForIMPHomePage( void )
{
InputAtom InputEvent;
POINT MousePos;
POINT MousePos;
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
ScreenToClient(ghWindow, &MousePos); // In window coords!
while (DequeueEvent(&InputEvent) == TRUE)
{
while (DequeueEvent(&InputEvent) == TRUE)
{
// HOOK INTO MOUSE HOOKS
/*
switch(InputEvent.usEvent)
{
{
case LEFT_BUTTON_DOWN:
MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
@@ -276,26 +275,26 @@ void GetPlayerKeyBoardInputForIMPHomePage( void )
case RIGHT_BUTTON_DOWN:
MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
case RIGHT_BUTTON_UP:
case RIGHT_BUTTON_UP:
MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
}
}
*/
if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) )
{
switch( InputEvent.usParam )
switch( InputEvent.usParam )
{
case (( ENTER ) ):
case (( ENTER ) ):
if(( InputEvent.usEvent == KEY_UP ) )
{
// return hit, check to see if current player activation string is a valid one
// return hit, check to see if current player activation string is a valid one
ProcessPlayerInputActivationString( );
fNewCharInActivationString = TRUE;
fNewCharInActivationString = TRUE;
}
break;
case (( ESC )):
LeaveLapTopScreen( );
LeaveLapTopScreen( );
break;
default:
if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT )
@@ -313,12 +312,12 @@ void GetPlayerKeyBoardInputForIMPHomePage( void )
void HandleTextEvent( UINT32 uiKey )
{
// this function checks to see if a letter or a backspace was pressed, if so, either put char to screen
// or delete it
switch( uiKey )
// this function checks to see if a letter or a backspace was pressed, if so, either put char to screen
// or delete it
switch( uiKey )
{
case ( BACKSPACE ):
case ( BACKSPACE ):
if( iStringPos >= 0 )
{
@@ -327,31 +326,31 @@ void HandleTextEvent( UINT32 uiKey )
// decrement iStringPosition
iStringPos-=1;
}
// null out char
pPlayerActivationString[iStringPos ] = 0;
pPlayerActivationString[iStringPos ] = 0;
// move back cursor
uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X;
uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X;
// string has been altered, redisplay
fNewCharInActivationString = TRUE;
}
fNewCharInActivationString = TRUE;
}
break;
default:
if( uiKey >= 'A' && uiKey <= 'Z' ||
default:
if( uiKey >= 'A' && uiKey <= 'Z' ||
uiKey >= 'a' && uiKey <= 'z' ||
uiKey >= '0' && uiKey <= '9' ||
uiKey == '_' || uiKey == '.' || uiKey ==' ')
{
{
// if the current string position is at max or great, do nothing
if( iStringPos >= 8 )
{
if( iStringPos >= 8 )
{
break;
}
else
@@ -360,27 +359,27 @@ void HandleTextEvent( UINT32 uiKey )
{
iStringPos = 0;
}
// valid char, capture and convert to CHAR16
pPlayerActivationString[iStringPos] = ( CHAR16 )uiKey;
// valid char, capture and convert to CHAR16
pPlayerActivationString[iStringPos] = ( CHAR16 )uiKey;
// null out next char position
pPlayerActivationString[iStringPos + 1] = 0;
// move cursor position ahead
uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X;
uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X;
// increment string position
iStringPos +=1;
// string has been altered, redisplay
fNewCharInActivationString = TRUE;
// string has been altered, redisplay
fNewCharInActivationString = TRUE;
}
}
break;
}
@@ -390,14 +389,14 @@ void HandleTextEvent( UINT32 uiKey )
void ProcessPlayerInputActivationString( void )
{
// prcess string to see if it matches activation string
// prcess string to see if it matches activation string
char charPlayerActivationString[32];
wcstombs(charPlayerActivationString,pPlayerActivationString,32);
BOOLEAN freeMercSlot = TRUE;
// WANNE: Check total number of hired mercs
if( NumberOfMercsOnPlayerTeam() >= 18 )
if( NumberOfMercsOnPlayerTeam() >= 18 )
{
freeMercSlot = FALSE;
}
@@ -406,7 +405,7 @@ void ProcessPlayerInputActivationString( void )
if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) )
{
// WANNE: Check total number of hired mercs
if( freeMercSlot == FALSE )
if( freeMercSlot == FALSE )
{
DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL);
return;
@@ -428,7 +427,7 @@ void ProcessPlayerInputActivationString( void )
else if( wcscmp(pPlayerActivationString, L"90210") == 0 )
{
// WANNE: Check total number of hired mercs
if( freeMercSlot == FALSE )
if( freeMercSlot == FALSE )
{
DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL);
return;
@@ -454,7 +453,7 @@ void ProcessPlayerInputActivationString( void )
else if ( ImpExists( charPlayerActivationString ) )
{
// WANNE: Check total number of hired mercs
if( freeMercSlot == FALSE )
if( freeMercSlot == FALSE )
{
DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_18_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL);
return;
@@ -466,7 +465,7 @@ void ProcessPlayerInputActivationString( void )
{
// Reset activation text box
ResetActivationStringTextBox();
//DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 11 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL);
AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), LaptopSaveInfo.iIMPIndex );
}
@@ -500,7 +499,7 @@ void ResetActivationStringTextBox(void)
}
iStringPos = 0;
uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X;
DisplayPlayerActivationString();
DisplayActivationStringCursor();
@@ -508,25 +507,25 @@ void ResetActivationStringTextBox(void)
void CreateIMPHomePageButtons( void )
{
// this procedure will create the buttons needed for the IMP homepage
// this procedure will create the buttons needed for the IMP homepage
// ths about us button
giIMPHomePageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_1.sti" ,-1,0,-1,1,-1 );
/* giIMPHomePageButton[0] = QuickCreateButton( giIMPHomePageButtonImage[0], LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48 ),
giIMPHomePageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_1.sti" ,-1,0,-1,1,-1 );
/* giIMPHomePageButton[0] = QuickCreateButton( giIMPHomePageButtonImage[0], LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48 ),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback);
*/
giIMPHomePageButton[0] = CreateIconAndTextButton( giIMPHomePageButtonImage[0], pImpButtonText[ 0 ], FONT12ARIAL,
FONT_WHITE, DEFAULT_SHADOW,
FONT_WHITE, DEFAULT_SHADOW,
TEXT_CJUSTIFIED,
LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback);
*/
giIMPHomePageButton[0] = CreateIconAndTextButton( giIMPHomePageButtonImage[0], pImpButtonText[ 0 ], FONT12ARIAL,
FONT_WHITE, DEFAULT_SHADOW,
FONT_WHITE, DEFAULT_SHADOW,
TEXT_CJUSTIFIED,
LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback);
SetButtonCursor(giIMPHomePageButton[ 0 ], CURSOR_WWW);
return;
}
@@ -535,12 +534,12 @@ void CreateIMPHomePageButtons( void )
void RemoveIMPHomePageButtons( void )
{
// this procedure will destroy the already created buttosn for the IMP homepage
// this procedure will destroy the already created buttosn for the IMP homepage
// the about us button
RemoveButton(giIMPHomePageButton[0] );
UnloadButtonImage(giIMPHomePageButtonImage[0] );
// the about us button
RemoveButton(giIMPHomePageButton[0] );
UnloadButtonImage(giIMPHomePageButtonImage[0] );
return;
}
@@ -555,15 +554,15 @@ void BtnIMPAboutUsCallback(GUI_BUTTON *btn,INT32 reason)
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
iCurrentImpPage = IMP_ABOUT_US;
btn->uiFlags&=~(BUTTON_CLICKED_ON);
iCurrentImpPage = IMP_ABOUT_US;
fButtonPendingFlag = TRUE;
}
}
}
}
}