Beispiel #1
0
void DrawSmartCardCredits( OptionsRefCon *optionGlobals, short numCreds )
{
short			oldFont;
char			buffer[8];
StatTextDesc	*STDPtr;
xyString		*s;

	SetCurrentDevice( kScrollA );
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kSmartCardCredits].objectData);
	
	oldFont = GetCurFont ();
	
	SetCurFont( STDPtr->font );
	SetupTextGDevice( &(optionGlobals->textRect), optionGlobals->textPatterns );
	SetFontColors( STDPtr->color0, STDPtr->color1, STDPtr->color2, STDPtr->color3 );

	if (numCreds >= 0)
	{
		SegaNumToString( numCreds, buffer );
		DrawPaddedClippedSegaText( (STDPtr->animationData).xPos, (STDPtr->animationData).yPos, 
											6*8, kJustifyLeft, buffer );
	}
	else
	{
		s = (xyString *)DBGetItem( kStringType, kNoSmartCardPresentString );
		DrawPaddedClippedSegaText( (STDPtr->animationData).xPos, (STDPtr->animationData).yPos, 
											6*8, kJustifyLeft, s->cString );
	}
	
	SetCurFont ( oldFont );
}
Beispiel #2
0
GraphicReference _DrawDBGraphicAt( long memToUse, DBID theID, short xPos, short yPos, short theScreen )
{
SegaBitMapPtr myGraphic;

	if( theScreen == kScrollB )
		ClearBackdrop( false );		//mark backdrop dirty, but don't erase

//
// Draw the graphic
//

	SetCurrentDevice( theScreen );		// was kScrollB
	myGraphic = GetDBGraphics( theID );

#ifdef SIMULATOR

	if( myGraphic == 0 )
		DebugStr( "\pFailed to load graphic" );
	else

#endif

	{
		return DrawGraphic( myGraphic, xPos, yPos, memToUse, 0, 0 );
	}
}
Beispiel #3
0
static long ChoosePasswordSetup( ScreenParams *params )
{
ChoosePasswordGlobals	*choose;
Point					boxLocation;
segaCharRect			tbRect;

	choose = (ChoosePasswordGlobals *)NewMemory( kTemp, sizeof(ChoosePasswordGlobals));
	
	choose->addPWChar					= (ChoosePasswordProc) _AddPWChar;
	choose->doubleCheckAndSetPassword	= (ChoosePasswordProc) _DoubleCheckAndSetPassword;
	choose->resetEnteredPassword		= (ChoosePasswordProc) _ResetEnteredPassword;
	choose->setupPWChar					= (ChoosePasswordProc) _SetupPWChar;
		
	choose->charSprite = 0;		// zero allocations
	choose->textState = 0;
	
	EraseGDevice ( kScrollA );
	SetBackdropID ( kBlackBackground, true, 0 );
	SetCurrentDevice( kScrollA );
	
	GetScreenLayoutPoint( kChoosePasswordScreen, kLayoutBoxPoint, &boxLocation );
	choose->boxGraphic = DrawDBGraphicAt( 0, kPasswordBox, boxLocation.h>>3, 
		boxLocation.v>>3, kScrollA );

	SetCurrentDevice( kScrollA );
	SetCurFont( kXBandHeavy );
	SetFontColors( 0, 11, 10, 0 );
	choose->titlePatterns = DrawScreenLayoutString( kChoosePasswordScreen, kLayoutTitleString );

	SetCurFont( kXBandLight9Font );
	SetFontColors( 0, 9, 8, 0 );
	choose->descriptionPatterns = BoxScreenLayoutString( kChoosePasswordScreen, kLayoutDescriptionString,
		kLayoutDescriptionRect, kJustLeft );	

	SetFontColors( 0, kDarkPurpleColor, kPurpleColor, 0 );
	choose->donePatterns = DrawScreenLayoutString( kChoosePasswordScreen, kLayoutDoneString );

	GetScreenLayoutCharRect( kChoosePasswordScreen, kLayoutJizzleRect, &tbRect );
	choose->jizzleRef = DrawTextBox( &tbRect, kGreenColor, kScrollA );
	StartTextBoxAnimation( choose->jizzleRef, 10 );
	
	SetupPWChar( choose );

	return (long) choose;
}
Beispiel #4
0
static long ChooseTauntSetup( ScreenParams *params )
{
ChooseTauntGlobals	*choose;
KeyboardEntryLayout *keyLayout;
segaCharRect		tbRect;
Point				boxLocation;
Rect				boxRect;

	DisableDefDialogs();

	choose = (ChooseTauntGlobals *)NewMemory( kTemp, sizeof(ChooseTauntGlobals) );
	
	EraseGDevice ( kScrollA );
	SetBackdropID ( kBlackBackground, true, 0 );

	GetScreenLayoutPoint( kChooseTauntScreen, kTauntEntryBoxLocation, &boxLocation );
	choose->typingBox = DrawDBGraphicAt( 0, kTauntEntryField, boxLocation.h>>3, 
		boxLocation.v>>3, kScrollB );

	SetCurrentDevice( kScrollA );
	SetCurFont( kXBandHeavy );
	SetFontColors( 0, 11, 10, 0 );
	choose->titlePatterns = DrawScreenLayoutString( kChooseTauntScreen, kTauntHeadlineString );

	SetCurFont( kXBandLight9Font );
	SetFontColors( 0, 9, 8, 0 );
	choose->descriptionPatterns = BoxScreenLayoutString( kChooseTauntScreen, kTauntDescriptionString,
		kTauntDescriptionRect, kJustLeft );	

	GetScreenLayoutCharRect( kChooseTauntScreen, kTauntJizzleRect, &tbRect );
	choose->tbRef = DrawTextBox( &tbRect, kGreenColor, kScrollA );
	StartTextBoxAnimation( choose->tbRef, 10 );
	
	keyLayout = SetupKeyboardEntryLayout( kChooseTauntKeyboardEntry );
	choose->keyRef = InitKeyboardEntry( keyLayout, 0 );
	choose->keyLayout = keyLayout;
	SetKeyboardEntryMeasureProc( choose->keyRef, TauntMeasureProc );
	
	/* Place the existing taunt in the entry field */
	{
		char *existingTaunt;
		
		existingTaunt = (char *)GetPersonificationPart( GetCurrentLocalUser()->userID, kPersonificationTauntText );
		StuffCurrentKeyboardField( choose->keyRef, existingTaunt );
	}

	return (long) choose;
}
HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devRec, const hsG3DDeviceMode* devMode)
{

    int i;
    for( i = 0; i < GetNumDrivers(); i++ )
    {
        if( !stricmp(GetDriver(i)->fAdapterInfo.Description, devRec->GetDriverDesc()) )
        {
            int j;
            for( j = 0; j < GetDriver(i)->fDevices.GetCount(); j++ )
            {
                if( !stricmp(GetDriver(i)->fDevices[j].fStrName, devRec->GetDeviceDesc()) )
                {
                    SetCurrentDriver(GetDriver(i));
                    SetCurrentDevice(&GetDriver(i)->fDevices[j]);
                    D3DEnum_SelectDefaultMode(
                        devMode->GetWidth(),
                        devMode->GetHeight(),
                        devMode->GetColorDepth());
                    return false;
                }
            }
        }
    }
    char errStr[256];

    sprintf(errStr, "Can't find requested device - %s:%s:%s:%s:%s",
            devRec->GetG3DDeviceTypeName(),
            devRec->GetDriverDesc(),
            devRec->GetDriverName(),
            devRec->GetDriverVersion(),
            devRec->GetDeviceDesc());

    DWORD enumFlags = 0;
    int width = devMode->GetWidth();
    int height = devMode->GetHeight();
    int colorDepth = devMode->GetColorDepth();
    // for a window, take whatever colordepth we can get.
    if( !colorDepth )
        enumFlags |= D3DENUM_CANWINDOW;
    enumFlags |= D3DENUM_TNLHAL;
#ifdef HS_ALLOW_D3D_REF_DRIVER
    enumFlags |= D3DENUM_REFERENCERAST;
#endif

    D3DEnum_SelectDefaultDriver(enumFlags);

    // If we didn't get what we want, try for anything.
    if( !GetCurrentDriver() || !GetCurrentDevice() )
    {
        enumFlags = colorDepth ? 0 : D3DENUM_CANWINDOW;
        D3DEnum_SelectDefaultDriver(enumFlags);
    }
    if( !GetCurrentDriver() || !GetCurrentDevice() )
        D3DEnum_SelectDefaultDriver(0);
    if( !GetCurrentDriver() || !GetCurrentDevice() )
    {
        if( !*GetEnumeErrorStr() )
            SetEnumeErrorStr("Error finding device");
        return true;
    }
    D3DEnum_SelectDefaultMode(width, height, colorDepth);
    if( !GetCurrentMode() )
    {
        if( !*GetEnumeErrorStr() )
            SetEnumeErrorStr("Error finding mode");
        return true;
    }

    return false;
}
//-----------------------------------------------------------------------------
// Name: D3DEnum_SelectDefaultDriver()
// Desc: Picks a default driver according to the passed in flags.
//-----------------------------------------------------------------------------
HRESULT hsGDirect3DTnLEnumerate::D3DEnum_SelectDefaultDriver( DWORD dwFlags )
{


    // If a specific driver was requested, perform that search here
    if( dwFlags & D3DENUM_MASK )
    {
        int i;
        for( i = 0; i < fDrivers.GetCount(); i++ )
        {
            D3DEnum_DriverInfo* pDriver = &fDrivers[i];
            int j;
            for( j = 0; j < pDriver->fDevices.GetCount(); j++ )
            {
                D3DEnum_DeviceInfo* pDevice = &pDriver->fDevices[j];
                BOOL bFound = FALSE;

                if( pDevice->fDDType == D3DDEVTYPE_REF )
                {
                    if( dwFlags & D3DENUM_REFERENCERAST )
                        bFound = TRUE;
                }
                else if( pDevice->fDDType == D3DDEVTYPE_HAL &&
                         pDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
                {
                    if( dwFlags & D3DENUM_TNLHAL )
                        bFound = TRUE;
                }
                else
                {
                    if( dwFlags & D3DENUM_CANWINDOW )
                    {
                        if( (pDriver == &fDrivers[0])
                                &&( pDevice->fDDCaps.Caps2 & DDCAPS2_CANRENDERWINDOWED ) )
                        {
                            if( ( pDevice->fDDCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
                                    ^ !(dwFlags & D3DENUM_TNLHAL) )
                                bFound = TRUE;
                        }
                    }
                    else if( dwFlags & D3DENUM_PRIMARYHAL )
                    {
                        if( pDriver == &fDrivers[0] )
                            bFound = TRUE;
                    }
                    else if( dwFlags & D3DENUM_SECONDARYHAL )
                    {
                        if( pDriver != &fDrivers[0] )
                            bFound = TRUE;
                    }
                }

                if( bFound )
                {
                    SetCurrentDriver(pDriver);
                    SetCurrentDevice(pDevice);
                    return S_OK;
                }
            }
        }
        return D3DENUMERR_NOTFOUND;
    }

    int i;
    for( i = 0; i < fDrivers.GetCount(); i++ )
    {
        D3DEnum_DriverInfo* pDriver = &fDrivers[i];
        int j;
        for( j = 0; j < pDriver->fDevices.GetCount(); j++ )
        {
            D3DEnum_DeviceInfo* pDevice = &pDriver->fDevices[j];
            if( !pDevice->fIsHardware )
                continue;

            SetCurrentDriver(pDriver);
            SetCurrentDevice(pDevice);

            return S_OK;
        }
    }

    // No compatible devices were found. Return an error code
    return D3DENUMERR_NOCOMPATIBLEDEVICES;
}
Beispiel #7
0
long XSetupSetup( ScreenParams *params )
{
XSetupGlobals	*setup;
Point 			*xPosition;
segaCharRect	jizzleRect;
char			*phoneString;
phoneNumber		*local1, *local2;

	setup = (XSetupGlobals *)NewMemory( kTemp, sizeof(XSetupGlobals) );
	
	EraseGDevice ( kScrollA );
	SetBackdropID ( kBlackBackground, true, 0 );
	SetCurrentDevice( kScrollA );

	SetCurFont( kXBandHeavy );
	SetFontColors( 0, kDarkYellowColor, kYellowColor, 0 );
	setup->titlePatterns = DrawScreenLayoutString( kXBandSetupScreen, kSetupTitleString );
	setup->bgGraphic = DrawDBGraphicAt( 0, kSettingsIcon, 29, 2, kScrollA );
	setup->lineGraphic = DrawDBGraphicAt( 0, kGrayHorizontalLine, 5, 18, kScrollA );
	
	GetScreenLayoutCharRect( kXBandSetupScreen, 0, &jizzleRect );
	setup->jizzle = DrawTextBox( &jizzleRect, 8, kScrollA );
	StartTextBoxAnimation( setup->jizzle, 10 );

	GetScreenLayoutCharRect( kXBandSetupScreen, kSetupDescriptionRect, &setup->descriptionRect );
	setup->descriptionPatterns = LinearizeScreenArea( &setup->descriptionRect, 0 );

// Accept Challenges:
	setup->radioRefs[kAcceptChallengesButton] = SetupRadioButton( kAcceptChallengesButton+1, phoneString );
	RadioButtonSetSelection(setup->radioRefs[kAcceptChallengesButton], GetAcceptChallengesOption( GetCurUserID() ) );
	DrawRadioButton( setup->radioRefs[kAcceptChallengesButton] );

// Call Waiting:
	setup->radioRefs[kCallWaitingButton] = SetupRadioButton( kCallWaitingButton+1, nil );
	RadioButtonSetSelection(setup->radioRefs[kCallWaitingButton], GetCallWaitingOption( GetCurUserID() ) );
	DrawRadioButton(setup->radioRefs[kCallWaitingButton]);

// Calling From:
	phoneString = (char *) GetBoxPhoneNumber()->phoneNumber;
	GetLocalAccessPhoneNumber(&local1, &local2);
	if ( local1->phoneNumber[0] == 0 )
	{
		phoneString = GetSegaString(kBoxPhoneNumber);
		setup->newPhoneNumber = true;
	}
	else
		setup->newPhoneNumber = false;
		
	setup->radioRefs[kIMovedButton] = SetupRadioButton( kIMovedButton+1, phoneString );
	RadioButtonSetSelection(setup->radioRefs[kIMovedButton],
								setup->newPhoneNumber || GetIMovedOption() );
	DrawRadioButton( setup->radioRefs[kIMovedButton] );

// Keyboard Type:
	setup->radioRefs[kKeyboardButton] = SetupRadioButton( kKeyboardButton+1, nil );
	RadioButtonSetSelection(setup->radioRefs[kKeyboardButton], GetQwertyKeyboardOption( GetCurUserID() ) );
	DrawRadioButton( setup->radioRefs[kKeyboardButton] );

// Set active button
	setup->activeButton = kAcceptChallengesButton;
	ActivateRadioButton(setup->radioRefs[setup->activeButton]);
	VDPIdle();

// Set up the DITL
	setup->theDitlList = SetupDITLItemList( kXBandSetupScreen );	
	setup->myControlTable = SetupControlTable( kXBandSetupScreen );
	NewDITL( setup->myControlTable, setup->theDitlList );

// Invalidate the description text
	setup->descriptionInvalid = true;
	
	return (long) setup;
}
Beispiel #8
0
static long OptionsSetup( ScreenParams *params )
{
OptionsRefCon	*optionGlobals;
CreditRecord *cred = (CreditRecord *)DBGetItem( kCreditsDBType, 0 );
RestrictionsRecord *rest = (RestrictionsRecord *)DBGetItem( kRestrictionsDBType, 0 );
char 			acctStr[8];
char 			smartCardStr[8];
char			usedCredStr[8];
StatTextDesc	*STDPtr;
TextButtonDesc	*TBDPtr;
short			screds;
xyString		*s;
segaCharRect 	myRect;

	optionGlobals = (OptionsRefCon *) NewMemory( kTemp, sizeof(OptionsRefCon) );
	
	EraseGDevice ( kScrollA );
	SetBackdropID ( kType2PlainBackground, true, 0 );

	optionGlobals->theDitlList = SetupDITLItemList( kAccountInfoScreen );	
	optionGlobals->myControlTable = SetupControlTable( kAccountInfoScreen );

	optionGlobals->graphRef = DrawDBGraphicAt( 0, kAccountInfoIcon, 30, 3, kScrollB );
// pound Credits Used string
	SegaNumToString( (long)cred->usedCredits, usedCredStr );
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kTotalCreditsUsed].objectData);
	STDPtr->myCString = usedCredStr;

// pound XBand Account string
	SegaNumToString( (long)cred->accountCredits, acctStr );
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kAccountCredits].objectData);
	STDPtr->myCString = acctStr;


// setup for SmartCard Credits AutoPound
	
	optionGlobals->textRect.top = ((optionGlobals->theDitlList)->items[kSmartCardCredits].yPos >> 3);
	optionGlobals->textRect.bottom = optionGlobals->textRect.top + 2;
	optionGlobals->textRect.left = ((optionGlobals->theDitlList)->items[kSmartCardCredits].xPos >> 3);
	optionGlobals->textRect.right = optionGlobals->textRect.left + 6;		// 6 cells wide
	

// pound Playing Field string
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kPlayingField].objectData);
	STDPtr->myCString = rest->playField;

// pound Hours of Play strings
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kHoursOfPlay1].objectData);
	STDPtr->myCString = rest->hours1;
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kHoursOfPlay2].objectData);
	STDPtr->myCString = rest->hours2;

// pound off the Return text
	s = (xyString *)DBGetItem( kStringType, 0 );		// ID 0 is the system null string
	TBDPtr = (TextButtonDesc *)((optionGlobals->theDitlList)->items[kReturnButton].objectData);
	TBDPtr->myCString = s->cString;
	

	NewDITL( optionGlobals->myControlTable, optionGlobals->theDitlList );
			

// finish setup for SmartCard Credits AutoPound

	SetCurrentDevice( kScrollA );
	STDPtr = (StatTextDesc *)((optionGlobals->theDitlList)->items[kSmartCardCredits].objectData);
	optionGlobals->textPatterns = LinearizeScreenArea( &(optionGlobals->textRect), STDPtr->palette );
	
	screds = GetRemainingCredits(0);
	DrawSmartCardCredits( optionGlobals, screds );
	optionGlobals->cardDetected = 0;

// Jizzle

	myRect.left = 3;
	myRect.top = 2;
	myRect.right = 36;
	myRect.bottom = 25;
		
	optionGlobals->myTextBoxMems = DrawTextBox( &myRect, 14, kScrollA );			
	StartTextBoxAnimation( optionGlobals->myTextBoxMems, 20 );

	VDPIdle();							// let the shit update
	
	return (long)optionGlobals;

}
Beispiel #9
0
void RenderDITLTextButton( DITLItem *theItem )
{
short			pixelWidth;
short			clipWidth;
short			xCenter;
short			xLeft;
short			xCharOffset;
short			yCharOffset;
TextButtonDesc	*theTextButt;
segaCharRect	textRect;
short			cellWidth;
short			oldFont;
TextButtGraphicsPriv *	state;
AnimationRef	animation;
short			height;
short			adjheight;
char			*frameSequence;

	state = (TextButtGraphicsPriv *) theItem->refCon;
	if ( !state )
		return;
//
// Draw the bitmap
//
	
	theTextButt = (TextButtonDesc *)theItem->objectData;

	if( theTextButt->animationData.bitmap == 0 )
		return;
	
	state->buttonID = theTextButt->buttonID;
	state->currentFrame = 0;
	state->x = theTextButt->animationData.xPos/8;
	state->y = theTextButt->animationData.yPos/8;
	frameSequence = DBGetItem( kButtonSequenceType, theTextButt->buttonID );
	if (frameSequence)
	{
		state->frameCount = *(short *)frameSequence;
		state->frameSequence = frameSequence+sizeof(short);
	}
	else
	{
		state->frameSequence = nil;
	}
	
	state->fxSequence = DBGetItem( kButtonSequenceFXType, theTextButt->buttonID );
	
	SetCurrentDevice( kScrollA );
	state->buttReference = DrawGraphic( theTextButt->animationData.bitmap, theTextButt->animationData.xPos/8, theTextButt->animationData.yPos/8, 0, 0, 0 );
//
// Figure out how to draw the text using the info in the refCon
//
	
	clipWidth = theTextButt->pixelWidth;

	state->textSprite = 0;
	if( theTextButt->myCString[0] != 0 )
	{

		oldFont = GetCurFont ();
		SetCurFont ( ((TextButtonDesc *) theItem->objectData)->font );

		pixelWidth = MeasureSegaText( theTextButt->myCString );

		if ( theTextButt->textXCenter == 0 )
		{
			xLeft = theTextButt->animationData.bitmap->width << 2;
		}
		else
		{
			xLeft = theTextButt->textXCenter;
		}
			
		xLeft += theItem->xPos;
		xLeft -= (pixelWidth >> 1);

		cellWidth = ( (pixelWidth+7) + (xLeft & 7) ) >> 3;
		cellWidth = (cellWidth+3) & ~3;

		textRect.left = xLeft>>3;
		textRect.right = textRect.left + cellWidth;
		
		if ( theTextButt->textYTop == 0 )
		{
			textRect.top = theTextButt->animationData.bitmap->height;
		}
		else
		{
			textRect.top = ( theTextButt->textYTop + 4 ) >> 3;
		}
			
		textRect.top += (theItem->yPos >> 3);
		height = GetCurFontHeight();
		adjheight = height >> 3;
		if ( (adjheight << 3) < height )
			adjheight++;
		textRect.bottom = textRect.top + adjheight;
		
		SetCurrentDevice( kScrollA );
		state->textSprite = CreateTextSprite( &textRect, 0 );
		
		if (state->textSprite)
		{
			SetFontColors( theTextButt->color0, theTextButt->color1, theTextButt->color2, theTextButt->color3 );
			DrawClippedSegaText( 0, 0, clipWidth, theTextButt->myCString );
			MoveSprite( state->textSprite, xLeft+128, (textRect.top<<3) + 128);
			DrawSprite( state->textSprite );
		}
		
		SetCurFont ( oldFont );
	}