Example #1
0
void DoPitBuilder( vec3_t vMin, vec3_t vMax ){
	// ensure we have something selected
	if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
		DoMessageBox( "Invalid number of brushes selected, chose 1 only", "Error", MB_OK );
		return;
	}

	// tell Radiant we want to access the selected brushes
	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	// get handle to size definition brush
	brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( 0 );
	// cant release until we delete the brush, if we do...

	DShape pit;

	if ( pit.BuildPit( vMin, vMax ) ) {
		pit.Commit();

		g_FuncTable.m_pfnDeleteBrushHandle( brush );
	}
	else{
		DoMessageBox( "Failed To Make Pit\nTry Making The Brush Bigger", "Error", MB_OK );
	}

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();
}
Example #2
0
void DoSplitPatch() {
	DPatch patch;

	// ensure we have something selected
	if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
		DoMessageBox( "Invalid number of objects selected, select 1 patch only", "Error", MB_OK );
		return;
	}

	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( 0 );

	if ( !brush->pPatch ) {
		g_FuncTable.m_pfnReleaseSelectedBrushHandles();
		DoMessageBox( "You must select ONLY patches", "Error", MB_OK );
		return;
	}

	patch.LoadFromBrush_t( brush );

	list<DPatch> patchList = patch.Split( true, true );
	for ( list<DPatch>::iterator patches = patchList.begin(); patches != patchList.end(); patches++ ) {
		( *patches ).BuildInRadiant();
	}

	patch.RemoveFromRadiant();

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();
}
Example #3
0
void DoPathPlotter(){
	PathPlotterRS rs;
	int ret = DoPathPlotterBox( &rs );
	if ( ret == IDCANCEL ) {
		return;
	}
	if ( ret == IDNO ) {
		if ( g_PathView ) {
			delete g_PathView;
		}
		return;
	}

	if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
		DoMessageBox( "Invalid number of brushes selected, chose 1 only", "Error", MB_OK );
		return;
	}

	// tell Radiant we want to access the selected brushes
	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( 0 );
	// should be our trigger brush

	DEntity world;
	world.LoadEPairList( *g_EntityTable.m_pfnGetEntityKeyValList( brush->owner ) );

	DEPair* trigger_ep = world.FindEPairByKey( "targetname" );

	if ( trigger_ep ) {
		if ( !strcmp( world.m_Classname, "trigger_push" ) ) {
			DEPair* target_ep = world.FindEPairByKey( "target" );
			if ( target_ep ) {
				entity_s* entTarget = FindEntityFromTargetname( target_ep->value, NULL );
				if ( entTarget ) {
					if ( g_PathView ) {
						delete g_PathView;
					}
					g_PathView = new DBobView;

					g_PathView->Begin( trigger_ep->value, target_ep->value, rs.fMultiplier, rs.nPoints, rs.fGravity, rs.bNoUpdate, rs.bShowExtra );
				}
				else{
					DoMessageBox( "trigger_push target could not be found.", "Error", MB_OK );
				}
			}
			else{
				DoMessageBox( "trigger_push has no target.", "Error", MB_OK );
			}
		}
		else{
			DoMessageBox( "You must select a 'trigger_push' entity.", "Error", MB_OK );
		}
	}
	else{
		DoMessageBox( "Entity must have a targetname", "Error", MB_OK );
	}

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();
}
Example #4
0
void HandleShortCutExitState( void )
{
	// look at the state of fGameIsRunning, if set false, then prompt user for confirmation

	// use YES/NO Pop up box, settup for particular screen
	SGPRect pCenteringRect= {0, 0, 640, INV_INTERFACE_START_Y };

	if( guiCurrentScreen == ERROR_SCREEN )
	{ //an assert failure, don't bring up the box!
		gfProgramIsRunning = FALSE;
		return;
	}

	if( guiCurrentScreen == AUTORESOLVE_SCREEN )
	{
		DoMessageBox(  MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ],  guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ),  EndGameMessageBoxCallBack,  &pCenteringRect );
		return;
	}

	/// which screen are we in?
	if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
	{
		// set up for mapscreen
		DoMapMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack );

	}
	else if( guiCurrentScreen == LAPTOP_SCREEN )
	{
		// set up for laptop
		DoLapTopSystemMessageBox( MSG_BOX_LAPTOP_DEFAULT, pMessageStrings[ MSG_EXITGAME ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack );
	}
	else if( guiCurrentScreen == SHOPKEEPER_SCREEN )
	{
		DoSkiMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], SHOPKEEPER_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack );
	}
	else
	{

		// check if error or editor
#ifdef JA2BETAVERSION
		if ( guiCurrentScreen == AIVIEWER_SCREEN || guiCurrentScreen == QUEST_DEBUG_SCREEN )
		{
			// then don't prompt
			gfProgramIsRunning = FALSE;
			return;
		}
#endif

		if( ( guiCurrentScreen == ERROR_SCREEN ) || ( guiCurrentScreen == EDIT_SCREEN ) || ( guiCurrentScreen == DEBUG_SCREEN ) )
		{
			// then don't prompt
			gfProgramIsRunning = FALSE;
			return;
		}

		// set up for all otherscreens
		DoMessageBox(  MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ],  guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ),  EndGameMessageBoxCallBack,  &pCenteringRect );
	}
}
Example #5
0
void DoVisAnalyse(){
	char filename[1024];

	if ( g_FuncTable.m_pfnSelectedBrushCount() == 0 ) {
		if ( g_VisView ) {
			delete g_VisView;
			return;
		}
	}

	if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
		DoMessageBox( "Invalid number of objects selected, select 1 only", "Error", MB_OK );
		return;
	}

	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( 0 );

	DBrush orgBrush;
	orgBrush.LoadFromBrush_t( brush, false );

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();

	orgBrush.BuildBounds();
	vec3_t origin;
	origin[0] = ( orgBrush.bbox_max[0] + orgBrush.bbox_min[0] ) / 2.f;
	origin[1] = ( orgBrush.bbox_max[1] + orgBrush.bbox_min[1] ) / 2.f;
	origin[2] = ( orgBrush.bbox_max[2] + orgBrush.bbox_min[2] ) / 2.f;


	char* rad_filename = g_FuncTable.m_pfnGetMapName();
	if ( !rad_filename ) {
		DoMessageBox( "An Error Occurred While Trying\n To Get The Map Filename", "Error", MB_OK );
		return;
	}

	strcpy( filename, rad_filename );

	char* ext = strrchr( filename, '.' ) + 1;
	strcpy( ext, "bsp" ); // rename the extension

	list<DWinding*> *pointList = BuildTrace( filename, origin );

	if ( !g_VisView ) {
		g_VisView = new DVisDrawer;
		g_VisView->Register();
	}

	g_VisView->SetList( pointList );
}
Example #6
0
void DoScreenIndependantMessageBoxWithRect( INT16 *zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect )
{

	/// which screen are we in?

	// Map Screen (excluding AI Viewer)
#ifdef JA2BETAVERSION
	if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) && ( guiCurrentScreen != AIVIEWER_SCREEN ) )
#else
	if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
#endif
	{

		// auto resolve is a special case
		if( guiCurrentScreen == AUTORESOLVE_SCREEN )
		{
			DoMessageBox( MSG_BOX_BASIC_STYLE, zString, AUTORESOLVE_SCREEN, usFlags, ReturnCallback, pCenteringRect );
		}
		else
		{
			// set up for mapscreen
			DoMapMessageBoxWithRect( MSG_BOX_BASIC_STYLE, zString, MAP_SCREEN, usFlags, ReturnCallback, pCenteringRect );
		}
	}

	//Laptop
	else if( guiCurrentScreen == LAPTOP_SCREEN )
	{
		// set up for laptop
		DoLapTopSystemMessageBoxWithRect( MSG_BOX_LAPTOP_DEFAULT, zString, LAPTOP_SCREEN, usFlags, ReturnCallback, pCenteringRect );
	}

	//Save Load Screen
	else if( guiCurrentScreen == SAVE_LOAD_SCREEN )
	{
		DoSaveLoadMessageBoxWithRect( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, usFlags, ReturnCallback, pCenteringRect );
	}

	//Options Screen
	else if( guiCurrentScreen == OPTIONS_SCREEN )
	{
		DoOptionsMessageBoxWithRect( MSG_BOX_BASIC_STYLE, zString, OPTIONS_SCREEN, usFlags, ReturnCallback, pCenteringRect );
	}

	// Tactical
	else if( guiCurrentScreen == GAME_SCREEN )
	{
		DoMessageBox(  MSG_BOX_BASIC_STYLE, zString,  guiCurrentScreen, usFlags,  ReturnCallback,  pCenteringRect );
	}
}
Example #7
0
void DoBuildDoors( vec3_t vMin, vec3_t vMax ){
	// ensure we have something selected
	if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
		DoMessageBox( "Invalid number of brushes selected, chose 1 only", "Error", MB_OK );
		return;
	}

	// tell Radiant we want to access the selected brushes
	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	// get handle to size definition brush
	brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( 0 );
	// cant release until we delete the brush, if we do...

	DoorRS rs;
	strcpy( rs.mainTexture, GetCurrentTexture() );

	if ( DoDoorsBox( &rs ) == IDOK ) {
		g_FuncTable.m_pfnDeleteBrushHandle( brush );

		BuildDoorsX2( vMin, vMax,
					  rs.bScaleMainH, rs.bScaleMainV,
					  rs.bScaleTrimH, rs.bScaleTrimV,
					  rs.mainTexture, rs.trimTexture,
					  rs.nOrientation ); // shapes.cpp
	}

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();
}
Example #8
0
extern "C" void WINAPI QERPlug_Dispatch( LPCSTR p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
	LoadLists();

	if ( !g_bBSPInitDone ) {
		g_BSPTable.m_nSize = sizeof( _QERAppBSPFrontendTable );
		if ( g_FuncTable.m_pfnRequestInterface( QERAppBSPFrontendTable_GUID, static_cast<LPVOID>( &g_BSPTable ) ) ) {
			g_bBSPInitDone = TRUE;
		}
		else
		{
			Sys_ERROR( "_QERAppBSPFrontendTable interface request failed\n" );
			return;
		}
	}

	if ( !strcmp( p, "About..." ) ) {
		DoMessageBox( PLUGIN_ABOUT, "About", IDOK );
	}
	else if ( !strcmp( p, "Colour Changer..." ) ) {
		DoCTFColourChanger();
	}
	else if ( !strcmp( p, "Swap Light Colours" ) ) {
		DoSwapLights();
	}
	else if ( !strcmp( p, "Change Angles 180" ) ) {
		DoChangeAngles();
	}
	else if ( !strcmp( p, "Swap Spawn Points" ) ) {
		DoSwapSpawns();
	}
}
Example #9
0
static bool CanProcess ()
{
  if (!g_bTexViewReady && !g_bClosing)
  {
    InitTexView (g_pToolWnd);

    if (!g_bTexViewReady)
    {
      g_bClosing = true;
      DoMessageBox ("You must have brush primitives activated in your project settings and\n"
                    "have a patch or a single face selected to use the TexTool plugin.\n"
                    "See plugins/TexToolHelp for documentation.", "TexTool plugin", MB_ICONERROR | MB_OK);
      // decref, this will destroy
      g_pToolWnd->DecRef();
      g_pToolWnd = NULL;
      return 0;
    }
    else
      g_bClosing = false;
  }
  else if (!g_bTexViewReady && g_bClosing)
  {
    return 0;
  }

  return 1;
}
Example #10
0
void InitErrorCatchDialog()
{
	SGPRect CenteringRect= {0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 };

	// do message box and return
	giErrorCatchMessageBox = DoMessageBox( MSG_BOX_BASIC_STYLE, gzErrorCatchString, 
											EDIT_SCREEN, MSG_BOX_FLAG_OK, NULL, &CenteringRect );
	gfErrorCatch = FALSE;
}
// ---------------------------------------------------------------------
MessageBoxProvider::Button WinMessageBoxProvider::DoMessageBox(
	SInt32 messageId,							//!< message id of the text
	ButtonType buttonType,						//!< button type
	AlertType alertType,						//!< alert type
	Button defaultButton /* = Button_None */	//!< default button
)
{
	MBCString message = CoveredCalcApp::GetInstance()->LoadNativeString(messageId);	
	return DoMessageBox(message, buttonType, alertType, defaultButton);
}
Example #12
0
//-----------------------------------------------------------------------------
// Word-wrap the string for our message box appropriately, and then display
// that string.
//-----------------------------------------------------------------------------
static void DoStringForMessageBox(const char *str, va_list f, bool error)
{
    char inBuf[1024*50];
    vsprintf(inBuf, str, f);

    char outBuf[1024*50];
    int i = 0, j = 0, len = 0, longestLen = 47;
    int rows = 0, cols = 0;

    // Count the width of the longest line that starts with spaces; those
    // are list items, that should not be split in the middle.
    bool listLine = false;
    while(inBuf[i]) {
        if(inBuf[i] == '\r') {
            // ignore these
        } else if(inBuf[i] == ' ' && len == 0) {
            listLine = true;
        } else if(inBuf[i] == '\n') {
            if(listLine) longestLen = max(longestLen, len);
            len = 0;
        } else {
            len++;
        }
        i++;
    }
    if(listLine) longestLen = max(longestLen, len);

    // Word wrap according to our target line length longestLen.
    len = 0;
    i = 0;
    while(inBuf[i]) {
        if(inBuf[i] == '\r') {
            // ignore these
        } else if(inBuf[i] == '\n') {
            outBuf[j++] = '\n';
            if(len == 0) rows++;
            len = 0;
        } else if(inBuf[i] == ' ' && len > longestLen) {
            outBuf[j++] = '\n';
            len = 0;
        } else {
            outBuf[j++] = inBuf[i];
            // Count rows when we draw the first character; so an empty
            // row doesn't end up counting.
            if(len == 0) rows++;
            len++;
        }
        cols = max(cols, len);
        i++;
    }
    outBuf[j++] = '\0';

    // And then display the text with our actual longest line length.
    DoMessageBox(outBuf, rows, cols, error);
}
Example #13
0
// Sets the string for a message box and shows it on the screen.  The message box receives
// input until KillMessageBox is called.  All current key bindings are removed.
void CMainMenus::DoMessageBox(int messageCode, CLTGUICommandHandler *pCommandHandler)
{
	// Get the string
	HSTRING hMessage=m_pClientDE->FormatString(messageCode);

	// Call the message box function
	DoMessageBox(hMessage, pCommandHandler);

	// Free the string
	m_pClientDE->FreeString(hMessage);
}
Example #14
0
bool DEntity::LoadFromEntity( entity_t* ent, bool bLoadPatches ) {
	ClearPatches();
	ClearBrushes();
	ClearEPairs();

	QER_Entity = ent;

	epair_t* epl = *g_EntityTable.m_pfnGetEntityKeyValList( QER_Entity );
	LoadEPairList( epl );

	bool keep = FALSE;
	int i;
	for ( i = 0; brushEntityList[i]; i++ )
	{
		if ( !stricmp( brushEntityList[i], m_Classname ) ) {
			keep = TRUE;
			break;
		}
	}

	if ( !keep ) {
		return FALSE;
	}

	int count = g_FuncTable.m_pfnAllocateEntityBrushHandles( QER_Entity );

	for ( i = 0; i < count; i++ )
	{

		brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetEntityBrushHandle( i );

		if ( brush == NULL ) {
			DoMessageBox( "GTKRadiant returned a NULL pointer, NOT a good sign", "WARNING!!!", MB_OK );
			continue;
		}

		if ( brush->pPatch ) {
			if ( bLoadPatches ) {
				DPatch* loadPatch = NewPatch();
				loadPatch->LoadFromBrush_t( brush );
			}
		}
		else
		{
			DBrush* loadBrush = NewBrush( i );
			loadBrush->LoadFromBrush_t( brush, TRUE );
		}
	}

	g_FuncTable.m_pfnReleaseEntityBrushHandles();

	return TRUE;
}
Example #15
0
// Displays a message and returns after it is drawn onto the screen.
// This works good for "Please Wait" messages
void CMainMenus::ShowSyncMessage(HSTRING hMessage)
{
	// Start the message box
	DoMessageBox(hMessage, DNULL);

	// Render the screen
	Draw();
	m_pClientDE->FlipScreen(FLIPSCREEN_CANDRAWCONSOLE);
	Draw();

	KillMessageBox();
}
Example #16
0
BOOLEAN DoGioMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback )
{
  SGPRect CenteringRect= {0, 0, 639, 479 };
  
	// reset exit mode
//	gfExitGioDueToMessageBox = TRUE;

	// do message box and return
  giGioMessageBox = DoMessageBox(  ubStyle,  zString,  uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ),  ReturnCallback,  &CenteringRect );

	// send back return state
	return( ( giGioMessageBox != -1 ) );
}
Example #17
0
/*
=============
LoadBSPFile
=============
*/
bool	LoadBSPFile( const char *filename ) {
	dheader_t	*header;

	// load the file header
	if(!LoadFile (filename, (byte **)&header))
		return false;

	// swap the header
	SwapBlock( (int *)header, sizeof(*header) );

	if ( header->ident != BSP_IDENT ) {
		DoMessageBox( "Cant find a valid IBSP file", "Error", eMB_OK);
		return false;
	}
	if ( (header->version != Q3_BSP_VERSION) &&
																			(header->version != WOLF_BSP_VERSION) ) {
		DoMessageBox( "File is incorrect version", "Error", eMB_OK);
		return false;
	}

	numbrushsides =		CopyLump( header, LUMP_BRUSHES,			(void**)&dbrushsides,	sizeof(dbrushside_t) );
	numbrushes =		CopyLump( header, LUMP_BRUSHES,			(void**)&dbrushes,		sizeof(dbrush_t) );
	numplanes =			CopyLump( header, LUMP_PLANES,			(void**)&dplanes,		sizeof(dplane_t) );
	numleafs =			CopyLump( header, LUMP_LEAFS,			(void**)&dleafs,		sizeof(dleaf_t) );
	numnodes =			CopyLump( header, LUMP_NODES,			(void**)&dnodes,		sizeof(dnode_t) );
	numDrawVerts =		CopyLump( header, LUMP_DRAWVERTS,		(void**)&drawVerts,		sizeof(qdrawVert_t) );
	numDrawSurfaces =	CopyLump( header, LUMP_SURFACES,		(void**)&drawSurfaces,	sizeof(dsurface_t) );
	numleafsurfaces =	CopyLump( header, LUMP_LEAFSURFACES,	(void**)&dleafsurfaces, sizeof(int) );
	numVisBytes =		CopyLump( header, LUMP_VISIBILITY,		(void**)&visBytes,		1 );
	numleafbrushes =	CopyLump( header, LUMP_LEAFBRUSHES,		(void**)&dleafbrushes,	sizeof(int) );

	delete header;		// everything has been copied out
		
	// swap everything
	SwapBSPFile();

	return true;
}
Example #18
0
void HandleInterfaceMessageForCostOfTrainingMilitia( SOLDIERTYPE *pSoldier )
{
	CHAR16 sString[ 128 ];
	SGPRect pCenteringRect= {0, 0, 640, INV_INTERFACE_START_Y };
	INT32 iNumberOfSectors = 0;

	pMilitiaTrainerSoldier = pSoldier;

	// grab total number of sectors
	iNumberOfSectors = GetNumberOfUnpaidTrainableSectors( );
	Assert( iNumberOfSectors > 0 );

	// get total cost
	giTotalCostOfTraining = MILITIA_TRAINING_COST * iNumberOfSectors; 
	Assert( giTotalCostOfTraining > 0 );

	gfYesNoPromptIsForContinue = FALSE;

	if( LaptopSaveInfo.iCurrentBalance < giTotalCostOfTraining )
	{
		swprintf( sString, pMilitiaConfirmStrings[ 8 ], giTotalCostOfTraining );
		DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback );
		return;
	}

	// ok to start training, ask player


	if( iNumberOfSectors > 1 )
	{
		swprintf( sString, pMilitiaConfirmStrings[ 7 ], iNumberOfSectors, giTotalCostOfTraining, pMilitiaConfirmStrings[ 1 ] );
	}
	else
	{
		swprintf( sString, L"%s%d. %s", pMilitiaConfirmStrings[ 0 ], giTotalCostOfTraining, pMilitiaConfirmStrings[ 1 ] );
	}

	// if we are in mapscreen, make a pop up
	if( guiCurrentScreen == MAP_SCREEN )
	{
		DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_YESNO, PayMilitiaTrainingYesNoBoxCallback );
	}
	else
	{
		DoMessageBox( MSG_BOX_BASIC_STYLE, sString, GAME_SCREEN, MSG_BOX_FLAG_YESNO, PayMilitiaTrainingYesNoBoxCallback, &pCenteringRect );
	}

	return;
}
Example #19
0
/**
 * @brief	Take actions specified by global error mode.
 *
 * e.g. if EM_MESSAGE_BOX is enabled DoMessageBox() will be called.\n\n
 *
 * Multiple error modes will be taken into account, so more than one action
 * can occur in one call to this method.
 */
void ErrorReport::DoErrorModeEvent() const
{
	if(IsErrorModeEnabled(EM_MESSAGE_BOX) == true)
	{
		DoMessageBox();
	}

	if(IsErrorModeEnabled(EM_SAVE) == true)
	{
		DoSave();
	}

	if(IsErrorModeEnabled(EM_EXCEPTION) == true)
	{
		DoRethrow();
	}
}
Example #20
0
void DoIntersect(){
	IntersectRS rs;

	if ( DoIntersectBox( &rs ) == IDCANCEL ) {
		return;
	}

	if ( rs.nBrushOptions == BRUSH_OPT_SELECTED ) {
		if ( g_FuncTable.m_pfnSelectedBrushCount() < 2 ) {
			DoMessageBox( "Invalid number of brushes selected, choose at least 2", "Error", MB_OK );
			return;
		}
	}

	DEntity world;

	switch ( rs.nBrushOptions )
	{
	case BRUSH_OPT_SELECTED:
	{
		world.LoadSelectedBrushes();
		break;
	}
	case BRUSH_OPT_WHOLE_MAP:
	{
		world.LoadFromEntity( 0, FALSE );
		break;
	}
	}

	world.RemoveNonCheckBrushes( &exclusionList, rs.bUseDetail );

	bool* pbSelectList;
	if ( rs.bDuplicateOnly ) {
		pbSelectList = world.BuildDuplicateList();
	}
	else{
		pbSelectList = world.BuildIntersectList();
	}

	world.SelectBrushes( pbSelectList );

	delete[] pbSelectList;
}
Example #21
0
void DoPolygons( vec3_t vMin, vec3_t vMax ){
	// ensure we have something selected
	if ( g_FuncTable.m_pfnSelectedBrushCount() != 1 ) {
		DoMessageBox( "Invalid number of brushes selected, choose 1 only", "Error", MB_OK );
		return;
	}

	// tell Radiant we want to access the selected brushes
	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	// get handle to size definition brush
	brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( 0 );
	// cant release until we delete the brush, if we do...

	PolygonRS rs;

	// ask user for type, size, etc....
	if ( DoPolygonBox( &rs ) == IDOK ) {
		g_FuncTable.m_pfnDeleteBrushHandle( brush );

		DShape poly;

		if ( rs.bInverse ) {
			poly.BuildInversePrism( vMin, vMax, rs.nSides, rs.bAlignTop );
		}
		else
		{
			if ( rs.bUseBorder ) {
				poly.BuildBorderedPrism( vMin, vMax, rs.nSides, rs.nBorderWidth, rs.bAlignTop );
			}
			else{
				poly.BuildRegularPrism( vMin, vMax, rs.nSides, rs.bAlignTop );
			}

		}

		poly.Commit();
	}


	g_FuncTable.m_pfnReleaseSelectedBrushHandles();
}
void DoCTFColourChanger(){
	if ( !clrLst1Loaded || !clrLst2Loaded ) {
		DoMessageBox( "CTF texture lists not found, this function will terminate.", "Error", MB_OK );
		return;
	}

	int ret = DoCTFColourChangeBox();
	if ( ret == IDCANCEL ) {
		return;
	}

	int cnt = Min( clrList_Blue.size(), clrList_Red.size() );

	list<Str>::const_iterator Texture_change;
	list<Str>::const_iterator Texture_new;

	float fDummy[2];

	int eCnt = g_FuncTable.m_pfnGetEntityCount();

	DMap world;
	world.LoadAll( TRUE );

	if ( ret == IDYES ) {
		Texture_change =    clrList_Blue.begin();
		Texture_new =       clrList_Red.begin();
	}
	else
	{
		Texture_change =    clrList_Red.begin();
		Texture_new =       clrList_Blue.begin();
	}

	for ( int i = 0; i < cnt; i++ )
	{
		world.ResetTextures( ( *Texture_change ).c_str(), fDummy, fDummy, 0, ( *Texture_new ).c_str(), TRUE );

		Texture_change++;
		Texture_new++;
	}
}
Example #23
0
void DBrush::LoadFromBrush(scene::Node* brush, bool textured)
{
    ClearFaces();
    ClearPoints();

#if 0
    for(int i = g_FuncTable.m_pfnGetFaceCount(brush)-1; i >= 0 ; i--)
    {   // running backwards so i dont have to use the count function each time (OPT)
        _QERFaceData* faceData = g_FuncTable.m_pfnGetFaceData(brush, i);

        if(faceData == NULL)
            DoMessageBox("Null pointer returned", "WARNING!", MB_OK);

        if(textured)
            AddFace(faceData->m_v1, faceData->m_v2, faceData->m_v3, faceData);
        else
            AddFace(faceData->m_v1, faceData->m_v2, faceData->m_v3, NULL);
    }
#endif

    QER_brush = brush;
}
Example #24
0
void AddCluster( std::list<DWinding*> *pointlist, dleaf_t    *cl, bool* repeatlist, vec3_t clr ){
	DWinding*   w;

	int* leafsurf = &dleafsurfaces[cl->firstLeafSurface];
	for ( int k = 0; k < cl->numLeafSurfaces; k++, leafsurf++ )
	{
		if ( repeatlist[*leafsurf] ) {
			continue;
		}

		dsurface_t* surf = &drawSurfaces[*leafsurf];
		if ( surf->surfaceType != MST_PLANAR ) {
			continue;
		}

		qdrawVert_t* vert = &drawVerts[surf->firstVert];
		if ( surf->firstVert + surf->numVerts > numDrawVerts ) {
			DoMessageBox( "Warning", "Warning", eMB_OK );
		}

		w = new DWinding();
		w->AllocWinding( surf->numVerts );

		for ( int l = 0; l < surf->numVerts; l++, vert++ )
		{
			( w->p[l] )[0] = vert->xyz[0];
			( w->p[l] )[1] = vert->xyz[1];
			( w->p[l] )[2] = vert->xyz[2];

			w->clr[0] = clr[0];
			w->clr[1] = clr[1];
			w->clr[2] = clr[2];
		}
		pointlist->push_back( w );

		repeatlist[*leafsurf] = true;
	}
}
Example #25
0
void DoFlipTerrain( void ) {
	vec3_t vUp = { 0.f, 0.f, 1.f };
	int i;

	// ensure we have something selected
	if ( g_FuncTable.m_pfnSelectedBrushCount() != 2 ) {
		DoMessageBox( "Invalid number of objects selected, chose 2 only", "Error", MB_OK );
		return;
	}

	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	brush_t* brushes[2];
	for ( i = 0; i < 2; i++ ) {
		brushes[i] = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( i );
	}

	DBrush Brushes[2];
	DPlane* Planes[2];
	pntTripple Points[2];
	for ( i = 0; i < 2; i++ ) {
		Brushes[i].LoadFromBrush_t( brushes[i], false );
		if ( !( Planes[i] = Brushes[i].FindPlaneWithClosestNormal( vUp ) ) || Brushes[i].FindPointsForPlane( Planes[i], Points[i], 3 ) != 3 ) {
			g_FuncTable.m_pfnReleaseSelectedBrushHandles();
			DoMessageBox( "Error", "Error", MB_OK );
			return;
		}
	}

	vec3_t mins1, mins2, maxs1, maxs2;
	Brushes[0].GetBounds( mins1, maxs1 );
	Brushes[1].GetBounds( mins2, maxs2 );

	entity_t* ents[2];
	for ( i = 0; i < 2; i++ ) {
		ents[i] = brushes[i]->owner;
		Brushes[i].RemoveFromRadiant();
	}

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();




	int dontmatch[2] = { -1, -1 };
	bool found = false;
	for ( i = 0; i < 3; i++ ) {
		for ( int j = 0; j < 3 && !found; j++ ) {
			if ( VectorCompare( ( Points[0] )[i]->_pnt, ( Points[1] )[j]->_pnt ) ) {
				found = true;
				break;
			}
		}
		if ( !found ) {
			dontmatch[0] = i;
			break;
		}
		found = false;
	}
	if ( dontmatch[0] == -1 ) {
		DoMessageBox( "Error", "Error", MB_OK );
		return;
	}

	for ( i = 0; i < 3; i++ ) {
		for ( int j = 0; j < 3 && !found; j++ ) {
			if ( VectorCompare( ( Points[1] )[i]->_pnt, ( Points[0] )[j]->_pnt ) ) {
				found = true;
				break;
			}
		}
		if ( !found ) {
			dontmatch[1] = i;
			break;
		}
		found = false;
	}
	if ( dontmatch[1] == -1 ) {
		DoMessageBox( "Error", "Error", MB_OK );
		return;
	}

	vec3_t plnpnts1[3];
	vec3_t plnpnts2[3];
	vec3_t plnpntsshr[3];

	VectorCopy( ( Points[0] )[dontmatch[0]]->_pnt, plnpnts1[0] );
	for ( i = 0; i < 3; i++ ) {
		if ( dontmatch[0] != i ) {
			VectorCopy( ( Points[0] )[i]->_pnt, plnpnts1[1] );
			break;
		}
	}
	VectorCopy( ( Points[1] )[dontmatch[1]]->_pnt, plnpnts1[2] );

	VectorCopy( ( Points[1] )[dontmatch[1]]->_pnt, plnpnts2[0] );
	for ( i = 0; i < 3; i++ ) {
		if ( dontmatch[1] != i && !VectorCompare( ( Points[1] )[i]->_pnt, plnpnts1[1] ) ) {
			VectorCopy( ( Points[1] )[i]->_pnt, plnpnts2[1] );
			break;
		}
	}
	VectorCopy( ( Points[0] )[dontmatch[0]]->_pnt, plnpnts2[2] );

	VectorCopy( ( Points[0] )[dontmatch[0]]->_pnt, plnpntsshr[0] );
	VectorCopy( ( Points[1] )[dontmatch[1]]->_pnt, plnpntsshr[1] );
	if ( ( Points[1] )[dontmatch[1]]->_pnt[2] < ( Points[0] )[dontmatch[0]]->_pnt[2] ) {
		VectorCopy( ( Points[1] )[dontmatch[1]]->_pnt, plnpntsshr[2] );
	}
	else {
		VectorCopy( ( Points[0] )[dontmatch[0]]->_pnt, plnpntsshr[2] );
	}
	plnpntsshr[2][2] -= 16;

	for ( i = 0; i < 3; i++ ) {
		if ( mins2[i] < mins1[i] ) {
			mins1[i] = mins2[i];
		}
		if ( maxs2[i] > maxs1[i] ) {
			maxs1[i] = maxs2[i];
		}
	}

	DBrush* newBrushes[2];
	newBrushes[0] = DShape::GetBoundingCube_Ext( mins1, maxs1, "textures/common/caulk", bFacesAll, true );
	newBrushes[1] = DShape::GetBoundingCube_Ext( mins1, maxs1, "textures/common/caulk", bFacesAll, true );

	vec3_t normal;
	MakeNormal( plnpnts1[0], plnpnts1[1], plnpnts1[2], normal );
	if ( normal[2] >= 0 ) {
		newBrushes[0]->AddFace( plnpnts1[0], plnpnts1[1], plnpnts1[2], "textures/common/terrain", true );
	}
	else {
		newBrushes[0]->AddFace( plnpnts1[2], plnpnts1[1], plnpnts1[0], "textures/common/terrain", true );
	}

	MakeNormal( plnpnts2[0], plnpnts2[1], plnpnts2[2], normal );
	if ( normal[2] >= 0 ) {
		newBrushes[1]->AddFace( plnpnts2[0], plnpnts2[1], plnpnts2[2], "textures/common/terrain", true );
	}
	else {
		newBrushes[1]->AddFace( plnpnts2[2], plnpnts2[1], plnpnts2[0], "textures/common/terrain", true );
	}

	vec3_t vec;
	MakeNormal( plnpntsshr[0], plnpntsshr[1], plnpntsshr[2], normal );

	VectorSubtract( plnpnts1[2], plnpnts1[1], vec );
	if ( DotProduct( vec, normal ) >= 0 ) {
		newBrushes[0]->AddFace( plnpntsshr[0], plnpntsshr[1], plnpntsshr[2], "textures/common/caulk", true );
	}
	else {
		newBrushes[0]->AddFace( plnpntsshr[2], plnpntsshr[1], plnpntsshr[0], "textures/common/caulk", true );
	}

	VectorSubtract( plnpnts2[2], plnpnts2[1], vec );
	if ( DotProduct( vec, normal ) >= 0 ) {
		newBrushes[1]->AddFace( plnpntsshr[0], plnpntsshr[1], plnpntsshr[2], "textures/common/caulk", true );
	}
	else {
		newBrushes[1]->AddFace( plnpntsshr[2], plnpntsshr[1], plnpntsshr[0], "textures/common/caulk", true );
	}

	for ( i = 0; i < 2; i++ ) {
		newBrushes[i]->RemoveRedundantPlanes();
		newBrushes[i]->BuildInRadiant( false, NULL, ents[i] );
		delete newBrushes[i];
	}

}
Example #26
0
extern "C" void QERPlug_Dispatch(const char* p, vec3_t vMin, vec3_t vMax, bool bSingleBrush)
{
  #if 0
  // if it's the first call, perhaps we need some additional init steps
  if (!g_bQglInitDone)
  {
    g_QglTable.m_nSize = sizeof(_QERQglTable);
    if ( g_FuncTable.m_pfnRequestInterface( QERQglTable_GUID, static_cast<LPVOID>(&g_QglTable) ) )
    {
      g_bQglInitDone = true;
    }
    else
    {
      Sys_Printf("TexTool plugin: _QERQglTable interface request failed\n");
      return;
    }
  }

  if (!g_bSelectedFaceInitDone)
  {
    g_SelectedFaceTable.m_nSize = sizeof(_QERSelectedFaceTable);
    if (g_FuncTable.m_pfnRequestInterface (QERSelectedFaceTable_GUID,
					   static_cast<LPVOID>(&g_SelectedFaceTable)))
    {
      g_bSelectedFaceInitDone = true;
    }
    else
    {
      Sys_Printf("TexTool plugin: _QERSelectedFaceTable interface request failed\n");
      return;
    }
  }

  if (!g_bSurfaceTableInitDone)
  {
    g_SurfaceTable.m_nSize = sizeof(_QERAppSurfaceTable);
    if ( g_FuncTable.m_pfnRequestInterface( QERAppSurfaceTable_GUID, static_cast<LPVOID>(&g_SurfaceTable) ) )
    {
      g_bSurfaceTableInitDone = true;
    }
    else
    {
      Sys_Printf("TexTool plugin: _QERAppSurfaceTable interface request failed\n");
      return;
    }
  }

  if (!g_bUITable)
  {
    g_UITable.m_nSize = sizeof(_QERUITable);
    if ( g_FuncTable.m_pfnRequestInterface( QERUI_GUID, static_cast<LPVOID>(&g_UITable) ) )
    {
      g_bUITable = true;
    }
    else
    {
      Sys_Printf("TexTool plugin: _QERUITable interface request failed\n");
      return;
    }
  }
  #endif

  if (!strcmp(p, "About..."))
  {
    DoMessageBox (PLUGIN_ABOUT, "About ...", MB_OK );
  }
  else if (!strcmp(p, "Go..."))
  {
    if (!g_pToolWnd)
    {
      g_pToolWnd = g_UITable.m_pfnCreateGLWindow();
      g_pToolWnd->setSizeParm(300,300);
      g_pToolWnd->setName("TexTool");
      // g_Listener is a static class, we need to bump the refCount to avoid premature release problems
      g_Listen.IncRef();
      // setListener will incRef on the listener too
      g_pToolWnd->setListener(&g_Listen);
      if (!g_pToolWnd->Show())
      {
        DoMessageBox ("Error creating texture tools window!", "TexTool plugin", MB_ICONERROR | MB_OK);
        return;
      }
    }
    
    g_bTexViewReady = false;
    g_bClosing = false;
  }
  else if (!strcmp(p, "Help..."))
  {
    if (!g_bHelp)
      DoMessageBox ("Select a brush face (ctrl+shift+left mouse) or a patch, and hit Go...\n"
		    "See tutorials for more", "TexTool plugin", MB_OK );
    else
      DoMessageBox ("Are you kidding me ?", "TexTool plugin", MB_OK );
    g_bHelp = true;
  }
}
Example #27
0
// you could load a dialog here if you want, I went the easy/lazy route
void CMFCPlugInApp::About(void)
{
	DoMessageBox("About!", MB_OK, 0);
}
Example #28
0
void DoMergePatches(){
	patch_merge_t merge_info;
	DPatch mrgPatches[2];
	int i;

	// ensure we have something selected
	if ( g_FuncTable.m_pfnSelectedBrushCount() != 2 ) {
		DoMessageBox( "Invalid number of objects selected, chose 2 only", "Error", MB_OK );
		return;
	}


	g_FuncTable.m_pfnAllocateSelectedBrushHandles();

	for ( i = 0; i < 2; i++ )
	{
		brush_t *brush = (brush_t*)g_FuncTable.m_pfnGetSelectedBrushHandle( i );

		if ( !brush->pPatch ) {
			g_FuncTable.m_pfnReleaseSelectedBrushHandles();
			DoMessageBox( "You must select ONLY patches", "Error", MB_OK );
			return;
		}

		mrgPatches[i].LoadFromBrush_t( brush );
	}

	/*  mrgPatches[0].Transpose();
	    mrgPatches[0].RemoveFromRadiant();
	    mrgPatches[0].BuildInRadiant();*/

	merge_info = mrgPatches[0].IsMergable( &mrgPatches[1] );

	if ( merge_info.mergable ) {
		Sys_Printf( "%i %i", merge_info.pos1, merge_info.pos2 );

		Sys_Printf( "Patches Mergable\n" );
		DPatch* newPatch = mrgPatches[0].MergePatches( merge_info, &mrgPatches[0], &mrgPatches[1] );

		/*                mrgPatches[0].RemoveFromRadiant();
		   mrgPatches[0].BuildInRadiant();

		   mrgPatches[1].RemoveFromRadiant();
		   mrgPatches[1].BuildInRadiant();


		   delete newPatch;*/

		if ( !newPatch ) {
		}
		else
		{
			mrgPatches[0].RemoveFromRadiant();
			mrgPatches[1].RemoveFromRadiant();

			newPatch->BuildInRadiant();
			delete newPatch;
		}
	}

	g_FuncTable.m_pfnReleaseSelectedBrushHandles();
}
// ---------------------------------------------------------------------
BOOL WinCoveredCalcApp::initInstance()
{
	bool langFileLoaded = false;

	if (!base::initInstance())
	{
		return FALSE;
	}

	// コモンコントロール初期化
	::InitCommonControls();

	// レイヤードウィンドウ関連の API
	apiLayeredWindow.Initialize();
	
	// ウェイトカーソルを取得しておく
	waitCursor = ::LoadCursor(NULL, IDC_WAIT);

	// モニタ情報を取得しておく
	monitorInfo.Update();

	// ベースクラス初期化
	if (!init())
	{
		return FALSE;
	}

	// コマンドラインパラメータ解析
	CommandLineParam* clParam = GetCommandLineParam();
	clParam->SetParameter(__argc, __targv);

	// 言語ファイルの読み込み
	if (clParam->IsLangFileSpecified())
	{
		try
		{
			loadLangFile(clParam->GetLangFile());
			langFileLoaded = true;
		}
		catch (Exception* ex)
		{
			ex->Delete();

			// コマンドラインパラメータで指定された言語ファイルが読み込めなかったので無視します。
			DoMessageBox(NSID_EMSG_LOAD_COMMANDLINE_LANGFILE, MessageBoxProvider::ButtonType_OK, MessageBoxProvider::AlertType_Warning);
		}
	}

	// ウィンドウクラスの登録
	WinMainWindow::RegisterClass();

	//設定ファイルを準備
	Path settingFile;
	if (clParam->IsSettingFileSpecified())
	{
		// コマンドラインで設定ファイルが指定されていればそれを使う
		settingFile.Assign(clParam->GetSettingFile());
	}
	else
	{
		// デフォルト設定ファイルを使う
		try
		{
			readyDefaultSettingFilePath(settingFile);
		}
		catch (Exception* ex)
		{
			ExceptionMessageUtils::DoExceptionMessageBoxWithText(this, ex, NSID_EMSG_READY_DEFAULT_SETTING_FILE,
											MessageBoxProvider::ButtonType_OK, MessageBoxProvider::AlertType_Stop);
			ex->Delete();
			return FALSE;
		}
	}
	
	// 設定の読み込み
	try
	{
		loadSettings(settingFile);
	}
	catch (Exception* ex)
	{
		ex->Delete();
		return FALSE;
	}

	// 設定に保存された言語ファイルを読み込む
	if (!langFileLoaded)
	{
		AppSettings* appSettings = GetAppSettings();
		const Path settingPath = appSettings->GetLanguageFilePath();
		if (!settingPath.IsEmpty()) {
			Path langFileFullPath = MakeAbsoluteLangFilePath(settingPath);
			if (!langFileFullPath.IsEmpty())
			{
				try
				{
					loadLangFile(langFileFullPath);
					langFileLoaded = true;
				}
				catch (Exception* ex)
				{
					ex->Delete();

					// 設定ファイルに書かれた言語ファイルが読めません。
					DoMessageBox(NSID_EMSG_LOAD_SETTING_LANGFILE, MessageBoxProvider::ButtonType_OK, MessageBoxProvider::AlertType_Warning);
				}
			}
		}
	}
	
	if (!langFileLoaded)
	{
		// 設定に保存されていなければ、ユーザーに問い合わせる
		WinSelectLanguageDlg selectLangDlg;
		try
		{
			selectLangDlg.SetRelativeLangFilePath(Path(ALITERAL("enUS.cclxw")));
			int dlgResult = selectLangDlg.DoModal(NULL);
			if (IDOK != dlgResult)
			{
				return FALSE;
			}
		}
		catch (Exception* ex)
		{
			ExceptionMessageUtils::DoExceptionMessageBox(this, ex);
			ex->Delete();
			return FALSE;
		}

		Path langFilePath = selectLangDlg.GetRelativeLangFilePath();
		Path langFileFullPath = MakeAbsoluteLangFilePath(langFilePath);
		if (!langFileFullPath.IsEmpty())
		{
			try
			{
				loadLangFile(langFileFullPath);
				langFileLoaded = true;
				GetAppSettings()->SetLanguageFilePath(langFilePath);

			}
			catch (Exception* ex)
			{
				ex->Delete();

				// 言語ファイルが読めません。
				DoMessageBox(NSID_EMSG_LOAD_LANGFILE, MessageBoxProvider::ButtonType_OK, MessageBoxProvider::AlertType_Warning);
			}
		}
	}

	// キー定義名 DB のロード
	loadKeyNameDB();
	
	// キーマッピング読み込み
	loadKeyMappingsOnInit();
	
	// カバー読み込み
	try
	{
		AppSettings* appSettings = GetAppSettings();
		loadCoverDef(appSettings->GetBaseFolder(), appSettings->GetLastCoverDef(), appSettings->GetLastCoverNo());
	}
	catch (Exception* ex)
	{
		ExceptionMessageUtils::DoExceptionMessageBox(this, ex);
		ex->Delete();

		// デフォルトカバーで復活を試みる
		if (!restoreByDefaultCoverDef())
		{
			// ダメでした…。
			return FALSE;
		}
	}

	// メインウィンドウ生成
	DWORD exStyle = 0;
	if (GetAppSettings()->IsMainWindowAlwaysOnTop())
	{
		exStyle = WS_EX_TOPMOST;
	}
	const Point32& lastMainWindowPos = GetAppSettings()->GetLastMainWindowPos();
	if (!mainWindow.CreateEx(exStyle, WinMainWindow::GetWindowClassName(), ALITERAL("CoveredCalc"), WS_SYSMENU | WS_POPUP | WS_MINIMIZEBOX, lastMainWindowPos.x, lastMainWindowPos.y, 0, 0, NULL, NULL))
	{
		// デフォルトカバーにして再チャレンジ
		bool restored = false;
		if (restoreByDefaultCoverDef())
		{
			if (mainWindow.CreateEx(exStyle, WinMainWindow::GetWindowClassName(), ALITERAL("CoveredCalc"), WS_SYSMENU | WS_POPUP | WS_MINIMIZEBOX, lastMainWindowPos.x, lastMainWindowPos.y, 0, 0, NULL, NULL))
			{
				restored = true;
			}
		}
		
		if (!restored)
		{
			DoMessageBox(NSID_EMSG_CREATE_MAIN_WINDOW, MessageBoxProvider::ButtonType_OK, MessageBoxProvider::AlertType_Stop);
			return FALSE;
		}
	}
	::ShowWindow(mainWindow.m_hWnd, SW_SHOW);

	// カバーブラウザ生成
	Path baseFolderPath = GetAppSettings()->GetBaseFolder();
	if (baseFolderPath.IsEmpty())
	{
		baseFolderPath = getAppFolderPath();
	}
	coverBrowser.SetCoversFolderPath(baseFolderPath.Append(ALITERAL("Covers")));
	if (!coverBrowser.Create(NULL))
	{
		DoMessageBox(NSID_EMSG_CREATE_COVER_BROWSER, MessageBoxProvider::ButtonType_OK, MessageBoxProvider::AlertType_Stop);
	}

	::ShowWindow(mainWindow.m_hWnd, SW_SHOW);
	if (GetAppSettings()->IsCoverBrowserVisible())
	{
		::ShowWindow(coverBrowser.m_hWnd, SW_SHOW);
	}

	::SetForegroundWindow(mainWindow.m_hWnd);

	return TRUE;
}
Example #30
0
void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldier, BOOLEAN fAddRehireButton )
{
	// will tell player this character is leaving and ask where they want the equipment left
	CHAR16 sString[ 1024 ];
	BOOLEAN fInSector = FALSE;
//	INT16					zTownIDString[50];
	CHAR16				zShortTownIDString[ 50 ], zShortDropOffString[ 50 ], zDropOffString[ 50 ];

	// use YES/NO Pop up box, settup for particular screen
	SGPRect pCenteringRect= {0 + xResOffset, 0, SCREEN_WIDTH - xResOffset, SCREEN_HEIGHT};

	//GetSectorIDString( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, zTownIDString, TRUE );

	GetShortSectorString( pSoldier->sSectorX ,pSoldier->sSectorY, zShortTownIDString );

	// Set string for generic button
	swprintf( gzUserDefinedButton1, L"%s", zShortTownIDString );


	pLeaveSoldier = pSoldier;

	if( pSoldier->flags.fSignedAnotherContract == TRUE )
	{
		fAddRehireButton = FALSE;
	}

	if( pSoldier->flags.fSignedAnotherContract == TRUE )
	{
		fAddRehireButton = FALSE;
	}

	if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC )
	{
		fAddRehireButton = FALSE;
	}

	//if the character is an RPC
	//if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC )
	//new profiles by Jazz
	if ( gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile )
	{
		if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE )
		{
			swprintf( sString, pMercHeLeaveString[ 1 ], pSoldier->GetName(), zShortTownIDString );
		}
		else
		{
			swprintf( sString, pMercSheLeaveString[ 1 ], pSoldier->GetName(), zShortTownIDString );
		}
		fInSector = TRUE;
	}

	// check if drassen controlled
	else if( StrategicMap[	( AIRPORT_X + ( MAP_WORLD_X * AIRPORT_Y ) ) ].fEnemyControlled == FALSE )
	{
		GetSectorIDString( AIRPORT_X, AIRPORT_Y, 0, zDropOffString, FALSE );

		if( ( pSoldier->sSectorX == AIRPORT_X ) && ( pSoldier->sSectorY == AIRPORT_Y ) && ( pSoldier->bSectorZ == 0 ) )
		{
			if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE )
			{
				swprintf( sString, pMercHeLeaveString[ 1 ], pSoldier->GetName(), zDropOffString );
			}
			else
			{
				swprintf( sString, pMercSheLeaveString[ 1 ], pSoldier->GetName(), zDropOffString );
			}
			fInSector = TRUE;
		}
		else
		{
			// Set string for generic button
			GetShortSectorString( AIRPORT_X, AIRPORT_Y, zShortDropOffString );
			swprintf( gzUserDefinedButton2, L"%s", zShortDropOffString ); //B13

			if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE )
			{
				swprintf( sString, pMercHeLeaveString[ 0 ], pSoldier->GetName(), zShortTownIDString, zDropOffString );
			}
			else
			{
				swprintf( sString, pMercSheLeaveString[ 0 ], pSoldier->GetName(), zShortTownIDString, zDropOffString );
			}

		}
	}
	else
	{
		GetSectorIDString( OMERTA_LEAVE_EQUIP_SECTOR_X, OMERTA_LEAVE_EQUIP_SECTOR_Y, 0, zDropOffString, FALSE );

		if( ( pSoldier->sSectorX == OMERTA_LEAVE_EQUIP_SECTOR_X ) && ( pSoldier->sSectorY == OMERTA_LEAVE_EQUIP_SECTOR_Y ) && ( pSoldier->bSectorZ == 0 ) )
		{
			if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE )
			{
				swprintf( sString, pMercHeLeaveString[ 1 ], pSoldier->GetName(), zDropOffString );
			}
			else
			{
				swprintf( sString, pMercSheLeaveString[ 1 ], pSoldier->GetName() , zDropOffString );
			}
			fInSector = TRUE;
		}
		else
		{
			// Set string for generic button
			GetShortSectorString( OMERTA_LEAVE_EQUIP_SECTOR_X, OMERTA_LEAVE_EQUIP_SECTOR_Y, zShortDropOffString );
			swprintf( gzUserDefinedButton2, L"%s", zShortDropOffString ); //A9

			if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE )
			{
				swprintf( sString, pMercHeLeaveString[ 0 ], pSoldier->GetName(), zShortTownIDString, zDropOffString );
			}
			else
			{
				swprintf( sString, pMercSheLeaveString[ 0 ], pSoldier->GetName(), zShortTownIDString, zDropOffString );
			}
		}
	}

	/// which screen are we in?
	if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
	{
		if( fInSector == FALSE )
		{
			// set up for mapscreen
			DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC_TWO_BUTTONS ) ), MercDepartEquipmentBoxCallBack );
		}
		else
		{
			DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK	) ), MercDepartEquipmentBoxCallBack );
		}

	}
	else
	{
		if( fInSector == FALSE )
		{
			// set up for all otherscreens
			DoMessageBox(	MSG_BOX_BASIC_STYLE, sString,	guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC_TWO_BUTTONS ) ),	MercDepartEquipmentBoxCallBack,	&pCenteringRect );
		}
		else
		{
			DoMessageBox(	MSG_BOX_BASIC_STYLE, sString,	guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK	) ) ,	MercDepartEquipmentBoxCallBack,	&pCenteringRect );
		}
	}

	if( pSoldier->flags.fSignedAnotherContract == TRUE )
	{
		//fCurrentMercFired = FALSE;
	}

}