void DropDownBase::Create_Drop() { Destroy_Drop(); Init_Drop(); UINT16 i; UINT16 usPosX = musStartX_Drop; UINT16 usPosY = musStartY_Drop; UINT16 usHeight = 0; for( i=0; i< DROPDOWN_REGIONS; ++i) { MSYS_DefineRegion( &mDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+musWidth-6), (UINT16)(usPosY+musFontHeight+7), MSYS_PRIORITY_HIGH, CURSOR_WWW, CallBackWrapper((void*) this, DROPDOWN_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_REGION, &DropDownBase::Dummyfunc)); MSYS_AddRegion(&mDropDownRegion[i]); MSYS_SetRegionUserData( &mDropDownRegion[ i ], 0, i); usPosY += musFontHeight + 2; } usHeight = usPosY - musStartY_Drop + 10; //create the scroll bars regions //up arrow usPosX = musUpArrowX; usPosY = musUpArrowY; for(i=0; i<2; ++i) { MSYS_DefineRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i], usPosX, usPosY, (UINT16)(usPosX+musWidth), (UINT16)(usPosY+DEF_SCROLL_ARROW_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_ARROW, &DropDownBase::Dummyfunc)); MSYS_AddRegion(&mgSelectedUpDownArrowOnScrollAreaRegion[i]); MSYS_SetRegionUserData( &mgSelectedUpDownArrowOnScrollAreaRegion[ i ], 0, i); usPosX = musDownArrowX; usPosY = musDownArrowY; } //the scroll area itself usPosX = musUpArrowX; usPosY = musUpArrowY + DEF_SCROLL_ARROW_HEIGHT; usHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - 4 ) / (mNumDisplayedEntries); for(i=0; i<DROPDOWN_REGIONS - 1; ++i) { MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX+musWidth), (UINT16)(usPosY+usHeight), MSYS_PRIORITY_HIGH+1, CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc)); MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]); MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i); usPosY += usHeight; } //put the last one down to cover the remaining area MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX+musWidth), musDownArrowY, MSYS_PRIORITY_HIGH+1, CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc)); MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]); MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i); MSYS_EnableRegion(&mSelectedCloseDropDownRegion); mfMouseRegionsCreated_Drop = TRUE; }
void InitEditorRegions() { INT32 x; //By doing this, all of the buttons underneath are blanketed and can't be used anymore. //Any new buttons will cover this up as well. Think of it as a barrier between the editor buttons, //and the game's interface panel buttons and regions. MSYS_DefineRegion( &EditorRegion, 0, 360, 640, 480, MSYS_PRIORITY_NORMAL, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); //Create the regions for the terrain tile selections for( x = 0; x < NUM_TERRAIN_TILE_REGIONS; x++ ) { MSYS_DefineRegion(&TerrainTileButtonRegion[x],(INT16)(261+x*42),369,(INT16)(303+x*42),391, MSYS_PRIORITY_NORMAL, 0, MSYS_NO_CALLBACK,(MOUSE_CALLBACK)TerrainTileButtonRegionCallback); MSYS_SetRegionUserData( &TerrainTileButtonRegion[x], 0, x ); MSYS_DisableRegion( &TerrainTileButtonRegion[x] ); } gfShowTerrainTileButtons=FALSE; //Create the region for the items selection window. MSYS_DefineRegion( &ItemsRegion, 100, 360, 540, 440, MSYS_PRIORITY_NORMAL, 0, (MOUSE_CALLBACK)MouseMovedInItemsRegion, (MOUSE_CALLBACK)MouseClickedInItemsRegion ); MSYS_DisableRegion( &ItemsRegion ); //Create the region for the merc inventory panel. MSYS_DefineRegion( &MercRegion, 175, 361, 450, 460, MSYS_PRIORITY_NORMAL, 0, MouseMovedInMercRegion, MouseClickedInMercRegion ); MSYS_DisableRegion( &MercRegion ); }
BOOLEAN InitAimPolicyTocMenu(void) { UINT16 i, usPosY; UINT16 usHeight; UINT32 uiStartLoc=0; if(gfInPolicyToc) return(TRUE); usHeight = GetFontHeight(AIM_POLICY_TOC_FONT); usPosY = AIM_POLICY_TOC_Y; for(i=0; i<NUM_AIM_POLICY_TOC_BUTTONS; i++) { //Mouse region for the toc buttons MSYS_DefineRegion( &gSelectedPolicyTocMenuRegion[i], AIM_POLICY_TOC_X, usPosY, (UINT16)(AIM_POLICY_TOC_X + AIM_CONTENTBUTTON_WIDTH), (UINT16)(usPosY + AIM_CONTENTBUTTON_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectPolicyTocMenuRegionCallBack); MSYS_AddRegion(&gSelectedPolicyTocMenuRegion[i]); MSYS_SetRegionUserData( &gSelectedPolicyTocMenuRegion[i], 0, i+2); usPosY += AIM_POLICY_TOC_GAP_Y; } gfInPolicyToc = TRUE; return(TRUE); }
void InitAlumniFaceRegions() { UINT16 usPosX, usPosY,i,x,y, usNumRows; if(gfFaceMouseRegionsActive) return; if( gubPageNum == 2 ) usNumRows = 2; else usNumRows = AIM_ALUMNI_NUM_FACE_ROWS; usPosX = AIM_ALUMNI_START_GRID_X; usPosY = AIM_ALUMNI_START_GRID_Y; i=0; for(y=0; y<usNumRows; y++) { for(x=0; x<AIM_ALUMNI_NUM_FACE_COLS; x++) { MSYS_DefineRegion( &gMercAlumniFaceMouseRegions[ i ], usPosX, usPosY, (INT16)(usPosX + AIM_ALUMNI_ALUMNI_FACE_WIDTH), (INT16)(usPosY + AIM_ALUMNI_ALUMNI_FACE_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectAlumniFaceRegionCallBack); // Add region MSYS_AddRegion( &gMercAlumniFaceMouseRegions[ i ] ); MSYS_SetRegionUserData( &gMercAlumniFaceMouseRegions[ i ], 0, i+(20*gubPageNum)); usPosX += AIM_ALUMNI_GRID_OFFSET_X; i++; } usPosX = AIM_ALUMNI_START_GRID_X; usPosY += AIM_ALUMNI_GRID_OFFSET_Y; } //the 3rd page now has an additional row with 1 merc on it, so add a new row if( gubPageNum == 2 ) { MSYS_DefineRegion( &gMercAlumniFaceMouseRegions[ i ], usPosX, usPosY, (INT16)(usPosX + AIM_ALUMNI_ALUMNI_FACE_WIDTH), (INT16)(usPosY + AIM_ALUMNI_ALUMNI_FACE_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectAlumniFaceRegionCallBack); // Add region MSYS_AddRegion( &gMercAlumniFaceMouseRegions[ i ] ); MSYS_SetRegionUserData( &gMercAlumniFaceMouseRegions[ i ], 0, i+(20*gubPageNum)); } gfFaceMouseRegionsActive = TRUE; }
BOOLEAN InitTocMenu() { UINT16 i, usPosY; UINT16 usHeight; UINT16 usWidth=0; CHAR16 sText[400]; UINT8 ubLocInFile[] = { IN_THE_BEGINNING, THE_ISLAND_METAVIRA, GUS_TARBALLS, WORD_FROM_FOUNDER, INCORPORATION}; HVOBJECT hContentButtonHandle; GetVideoObject(&hContentButtonHandle, guiContentButton); usHeight = GetFontHeight(AIM_HISTORY_TOC_TEXT_FONT); usPosY = AIM_HISTORY_CONTENTBUTTON_Y; for(i=0; i<NUM_AIM_HISTORY_PAGES; i++) { if(!g_bUseXML_Strings) { UINT32 uiStartLoc = AIM_HISTORY_LINE_SIZE * ubLocInFile[i]; LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); } else { Loc::GetString(Loc::AIM_HISTORY, L"Line", ubLocInFile[i], sText, 400); } usWidth = StringPixLength(sText, AIM_HISTORY_TOC_TEXT_FONT); //if the mouse regions havent been inited, init them if( !gfInToc ) { //Mouse region for the history toc buttons MSYS_DefineRegion( &gSelectedHistoryTocMenuRegion[i], AIM_HISTORY_TOC_X, usPosY, (UINT16)(AIM_HISTORY_TOC_X + AIM_CONTENTBUTTON_WIDTH), (UINT16)(usPosY + AIM_CONTENTBUTTON_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectHistoryTocMenuRegionCallBack); MSYS_AddRegion(&gSelectedHistoryTocMenuRegion[i]); MSYS_SetRegionUserData( &gSelectedHistoryTocMenuRegion[i], 0, i+1); } BltVideoObject(FRAME_BUFFER, hContentButtonHandle, 0,AIM_HISTORY_TOC_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); DrawTextToScreen(sText, AIM_HISTORY_TOC_X, (UINT16)(usPosY + AIM_HISTORY_TOC_Y), AIM_CONTENTBUTTON_WIDTH, AIM_HISTORY_TOC_TEXT_FONT, AIM_HISTORY_TOC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); usPosY += AIM_HISTORY_TOC_GAP_Y; } gfInToc = TRUE; return(TRUE); }
BOOLEAN EnterFloristCards() { UINT16 i, j, usPosX, usPosY; VOBJECT_DESC VObjectDesc; UINT8 ubCount; InitFloristDefaults(); // load the Flower Account Box graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\CardBlank.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiCardBackground)); ubCount = 0; usPosY = FLORIST_CARD_FIRST_POS_Y; for(j=0; j<3; j++) { usPosX = FLORIST_CARD_FIRST_POS_X; for(i=0; i<3; i++) { MSYS_DefineRegion( &gSelectedFloristCardsRegion[ubCount], usPosX, usPosY, (UINT16)(usPosX + FLORIST_CARD_CARD_WIDTH), (UINT16)(usPosY + FLORIST_CARD_CARD_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardsRegionCallBack ); MSYS_AddRegion(&gSelectedFloristCardsRegion[ubCount]); MSYS_SetRegionUserData( &gSelectedFloristCardsRegion[ubCount], 0, ubCount ); ubCount++; usPosX += FLORIST_CARD_FIRST_OFFSET_X; } usPosY += FLORIST_CARD_FIRST_OFFSET_Y; } guiFlowerCardsButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); guiFlowerCardsBackButton = CreateIconAndTextButton( guiFlowerCardsButtonImage, sFloristCards[FLORIST_CARDS_BACK], FLORIST_BUTTON_TEXT_FONT, FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, TEXT_CJUSTIFIED, FLORIST_CARD_BACK_BUTTON_X, FLORIST_CARD_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnFlowerCardsBackButtonCallback); SetButtonCursor(guiFlowerCardsBackButton, CURSOR_WWW ); //passing the currently selected card to -1, so it is not used gbCurrentlySelectedCard = -1; RenderFloristCards(); return(TRUE); }
void CreateMouseRegionsForLevelMarkers( void ) { INT16 sCounter = 0; CHAR16 sString[ 64 ]; for( sCounter = 0; sCounter < 4 ; sCounter++ ) { MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, LevelMarkerBtnCallback ); MSYS_SetRegionUserData(&LevelMouseRegions[sCounter],0,sCounter); swprintf( sString, L"%s %d", zMarksMapScreenText[ 0 ], sCounter + 1 ); SetRegionFastHelpText( &LevelMouseRegions[ sCounter ], sString ); } }
INT32 AddSlider( UINT8 ubStyle, UINT16 usCursor, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usNumberOfIncrements, INT8 sPriority, SLIDER_CHANGE_CALLBACK SliderChangeCallback, UINT32 uiFlags ) { SLIDER *pTemp = NULL; SLIDER *pNewSlider = NULL; AssertMsg( gfSliderInited, "Trying to Add a Slider Bar when the Slider System was never inited"); //checks if( ubStyle >= NUM_SLIDER_STYLES ) return( -1 ); pNewSlider = (SLIDER *) MemAlloc( sizeof( SLIDER ) ); if( pNewSlider == NULL ) { return( -1 ); } memset( pNewSlider, 0, sizeof( SLIDER ) ); //Assign the settings to the current slider pNewSlider->ubStyle = ubStyle; pNewSlider->usPosX = usPosX; pNewSlider->usPosY = usPosY; // pNewSlider->usWidth = usWidth; pNewSlider->usNumberOfIncrements = usNumberOfIncrements; pNewSlider->SliderChangeCallback = SliderChangeCallback; pNewSlider->usCurrentIncrement = 0; pNewSlider->usBackGroundColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); pNewSlider->uiFlags = uiFlags; //Get a new Identifier for the slider //Temp just increment for now pNewSlider->uiSliderID = guiCurrentSliderID; //increment counter guiCurrentSliderID++; // // Create the mouse regions for each increment in the slider // //add the region usPosX = pNewSlider->usPosX; usPosY = pNewSlider->usPosY; //Add the last one, the width will be whatever is left over switch( ubStyle ) { case SLIDER_VERTICAL_STEEL: pNewSlider->uiFlags |= SLIDER_VERTICAL; pNewSlider->usWidth = STEEL_SLIDER_WIDTH; pNewSlider->usHeight = usWidth; pNewSlider->ubSliderWidth = STEEL_SLIDER_WIDTH; pNewSlider->ubSliderHeight = STEEL_SLIDER_HEIGHT; MSYS_DefineRegion( &pNewSlider->ScrollAreaMouseRegion, (UINT16)(usPosX-pNewSlider->usWidth/2), usPosY, (UINT16)(usPosX+pNewSlider->usWidth/2), (UINT16)(pNewSlider->usPosY+pNewSlider->usHeight), sPriority, usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack ); MSYS_SetRegionUserData( &pNewSlider->ScrollAreaMouseRegion, 1, pNewSlider->uiSliderID ); break; case SLIDER_DEFAULT_STYLE: default: pNewSlider->uiFlags |= SLIDER_HORIZONTAL; pNewSlider->usWidth = usWidth; pNewSlider->usHeight = DEFUALT_SLIDER_SIZE; MSYS_DefineRegion( &pNewSlider->ScrollAreaMouseRegion, usPosX, (UINT16)(usPosY-DEFUALT_SLIDER_SIZE), (UINT16)(pNewSlider->usPosX+pNewSlider->usWidth), (UINT16)(usPosY+DEFUALT_SLIDER_SIZE), sPriority, usCursor, SelectedSliderMovementCallBack, SelectedSliderButtonCallBack ); MSYS_SetRegionUserData( &pNewSlider->ScrollAreaMouseRegion, 1, pNewSlider->uiSliderID ); break; } // // Load the graphic image for the slider box // //add the slider into the list pTemp = pSliderHead; //if its the first time in if( pSliderHead == NULL ) { pSliderHead = pNewSlider; pNewSlider->pNext = NULL; } else { while( pTemp->pNext != NULL ) { pTemp = pTemp->pNext; } pTemp->pNext = pNewSlider; pNewSlider->pPrev = pTemp; pNewSlider->pNext = NULL; } CalculateNewSliderBoxPosition( pNewSlider ); return( pNewSlider->uiSliderID ); }
BOOLEAN EnterCreditsScreen() { UINT32 uiCnt; VOBJECT_DESC VObjectDesc; gfModCredits = TRUE; ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; if (iResolution >= _640x480 && iResolution < _800x600) { FilenameForBPP("INTERFACE\\Credits.sti", VObjectDesc.ImageFile); } else if (iResolution < _1024x768) { FilenameForBPP("INTERFACE\\Credits_800x600.sti", VObjectDesc.ImageFile); } else { FilenameForBPP("INTERFACE\\Credits_1024x768.sti", VObjectDesc.ImageFile); } CHECKF(AddVideoObject(&VObjectDesc, &guiCreditBackGroundImage )); VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\Credit Faces.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiCreditFaces )); //Initialize the root credit node InitCreditNode( ); guiCreditsExitScreen = CREDIT_SCREEN; gfCrdtHaveRenderedFirstFrameToSaveBuffer = FALSE; guiCreditScreenActiveFont = FONT12ARIAL; gubCreditScreenActiveColor = FONT_MCOLOR_DKWHITE; guiCreditScreenTitleFont = FONT14ARIAL; gubCreditScreenTitleColor = FONT_MCOLOR_RED; guiCrdtNodeScrollSpeed = CRDT_NODE_DELAY_AMOUNT; gubCrdtJustification = CENTER_JUSTIFIED; guiCurrentCreditRecord = 0; guiCrdtLastTimeUpdatingNode = GetJA2Clock(); guiGapBetweenCreditSections = CRDT_SPACE_BN_SECTIONS; guiGapBetweenCreditNodes = CRDT_SPACE_BN_NODES; guiGapTillReadNextCredit = CRDT_SPACE_BN_NODES; for( uiCnt=0; uiCnt < NUM_PEOPLE_IN_CREDITS; uiCnt++) { // Make a mouse region MSYS_DefineRegion( &gCrdtMouseRegions[uiCnt], gCreditFaces[uiCnt].sX + xResOffset, gCreditFaces[uiCnt].sY + yResOffset, (INT16)(gCreditFaces[uiCnt].sX + gCreditFaces[uiCnt].sWidth + xResOffset), (INT16)(gCreditFaces[uiCnt].sY + gCreditFaces[uiCnt].sHeight + yResOffset), MSYS_PRIORITY_NORMAL, CURSOR_WWW, SelectCreditFaceMovementRegionCallBack, SelectCreditFaceRegionCallBack ); // Add region MSYS_AddRegion( &gCrdtMouseRegions[uiCnt] ); MSYS_SetRegionUserData( &gCrdtMouseRegions[uiCnt], 0, uiCnt ); } giCurrentlySelectedFace = -1; gfPauseCreditScreen = FALSE; InitCreditEyeBlinking(); return( TRUE ); }