Ejemplo n.º 1
0
/////////////////////////////////////////////////////////////////////
// TPreferencesDialog
// ------------------
//
void TPreferencesDialog::CmOk ()
{
	char str[MAX_BITMAPNAME + 1];

	if ( !CanClose() )
		return;

	// Get MAX UNDO
	int max_undo;
	pMaxUndoEdit->GetText(str, MAX_BITMAPNAME + 1);
	max_undo = atoi(str);
	if ( max_undo != MaxUndo )
	{
		if ( (GetUndoName() == NULL && GetRedoName() == NULL) ||
			 Confirm("WARNING: Changing the maximum number of UNDO/REDO "
					 "will free up current UNDO/REDO structure(s).\n"
					 "Are you sure you want to do this ?") )
		{
			CleanupUndo();
			MaxUndo = max_undo;
			InitUndo();
		}
		else
		{
			wsprintf(str, "%d", MaxUndo);
			pMaxUndoEdit->SetText(str);
			return;
		}
	}


	// Floor/Ceiling Texture
	pAboveText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultUpperTexture);
	DefaultUpperTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultUpperTexture, str);

	pNormalText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultWallTexture);
	DefaultWallTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultWallTexture, str);

	pBelowText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultLowerTexture);
	DefaultLowerTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultLowerTexture, str);

	pFloorText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultFloorTexture);
	DefaultFloorTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultFloorTexture, str);

	pCeilingText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultCeilingTexture);
	DefaultCeilingTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultCeilingTexture, str);

	// Floor/Ceiling height
	pFloorHeight->GetText (str, 6);
	DefaultFloorHeight = (SHORT)atoi(str);

	pCeilingHeight->GetText (str, 6);
	DefaultCeilingHeight = (SHORT)atoi(str);

#if (COOPERATION_VERSION == 1)
	BuildCoopExecTab();
#endif	// COOPERATION_VERSION


	// Check grid size value
	/*
	if ( GridScale >= 256 ) 		GridScale = 256;
	else if ( GridScale >= 128 ) 	GridScale = 128;
	else if ( GridScale >= 64 ) 	GridScale = 64;
	else if ( GridScale >= 32 ) 	GridScale = 32;
	else if ( GridScale >= 16 ) 	GridScale = 16;
	else if ( GridScale >= 8 ) 		GridScale = 8;
	else                        	GridScale = 0;
	*/

	// Misc boolean options
	AdditiveSelBox  = (pAddSelBoxCheck->GetCheck()  == BF_CHECKED);
	Debug           = (pDebugCheck->GetCheck()      == BF_CHECKED);
	DrawLineDefsLen = (pDrawLengthCheck->GetCheck() == BF_CHECKED);
	Expert          = (pExpertCheck->GetCheck()     == BF_CHECKED);
	Quiet           = (pQuietCheck->GetCheck()      == BF_CHECKED);
	Quieter         = (pQuiterCheck->GetCheck()     == BF_CHECKED);
	Select0         = (pSelect0Check->GetCheck()    == BF_CHECKED);
	AutoScroll      = (pAutoScrollCheck->GetCheck() == BF_CHECKED);

	// Toggle status bar if
	if ( InfoShown != (pInfoBarCheck->GetCheck() == BF_CHECKED) )
		TYPESAFE_DOWNCAST(GetApplication()->GetMainWindow(),
						  TMainFrame)->ToggleStatusBar();
	InfoShown       = (pInfoBarCheck->GetCheck()    == BF_CHECKED);

	// Close Dialog box
	TDialog::CmOk();
}
Ejemplo n.º 2
0
/*
	Windeu initialization
*/
void InitWindeu (int argc, char **argv, char *init_level)
{
	TRACE ("InitWindeu(): start");
	argv++;
	argc--;

	// Initialize graphics data (GDI pen cache, ...)
	// InitGfxData();

	// Init. MainWad file name to default (DOOM.WAD)
	MainWad = (char *)GetMemory (strlen(DEFAULT_MAIN_WAD)+1);
	strcpy (MainWad, DEFAULT_MAIN_WAD);

	// Init. default texture strings
	DefaultWallTexture = (char *)GetMemory (strlen(DEFAULT_WALL_TEXTURE)+1);
	strcpy (DefaultWallTexture, DEFAULT_WALL_TEXTURE);

	DefaultUpperTexture = (char *)GetMemory (strlen(DEFAULT_UPPER_TEXTURE)+1);
	strcpy (DefaultUpperTexture, DEFAULT_UPPER_TEXTURE);

	DefaultLowerTexture = (char *)GetMemory (strlen(DEFAULT_LOWER_TEXTURE)+1);
	strcpy (DefaultLowerTexture, DEFAULT_LOWER_TEXTURE);

	DefaultFloorTexture = (char *)GetMemory (strlen(DEFAULT_FLOOR_TEXTURE)+1);
	strcpy (DefaultFloorTexture, DEFAULT_FLOOR_TEXTURE);

	DefaultCeilingTexture = (char *)GetMemory (strlen(DEFAULT_CEILING_TEXTURE)+1);
	strcpy (DefaultCeilingTexture, DEFAULT_CEILING_TEXTURE);

	// Init bitmap dir & filespec ARK
	BitmapDir = (char *)GetMemory (strlen(DEFAULT_BITMAP_DIR)+1);
	strcpy (BitmapDir, DEFAULT_BITMAP_DIR);
	BitmapSpec = (char *)GetMemory (strlen(DEFAULT_BITMAP_SPEC)+1);
	strcpy (BitmapSpec, DEFAULT_BITMAP_SPEC);

	KodDir = (char *)GetMemory (strlen(DEFAULT_KOD_DIR)+1);
	strcpy (KodDir, DEFAULT_KOD_DIR);
	ServerDir = (char *)GetMemory (strlen(DEFAULT_SERVER_DIR)+1);
	strcpy (ServerDir, DEFAULT_SERVER_DIR);
	EntranceData = (char*)GetMemory(strlen(DEFAULT_ENTRANCE_FILE)+1);
	strcpy (EntranceData, DEFAULT_ENTRANCE_FILE);

	/* quick and dirty check for a "-config" option */
	for (int i = 0; i < argc - 1; i++)
		if (!strcmp(argv[i], "-config"))
		{
			CfgFile = argv[i + 1];
			break;
		}

	/* read config file and command line options */
	ParseConfigFileOptions(CfgFile);
	ParseCommandLineOptions(argc, argv, init_level);

	// Setup builder priority vars.
	if ( BuildPriority < BUILD_PRIORITY_MIN )
		BuildPriority = BUILD_PRIORITY_MIN;
	if ( BuildPriority > BUILD_PRIORITY_MAX )
		BuildPriority = BUILD_PRIORITY_MAX;

	// Check grid size value
	if ( GridScale >= 256 ) 		GridScale = 256;
	else if ( GridScale >= 128 ) 	GridScale = 128;
	else if ( GridScale >= 64 ) 	GridScale = 64;
	else if ( GridScale >= 32 ) 	GridScale = 32;
	else if ( GridScale >= 16 ) 	GridScale = 16;
	else if ( GridScale >= 8 ) 		GridScale = 8;
	else                        	GridScale = 0;

#if (COOPERATION_VERSION == 1)
	BuildCoopExecTab();
#endif	// COOPERATION_VERSION

	ReadWTextureInfo();
	ReadFTextureInfo();

  // Disabled 7/04 ARK
//	char buffer[_MAX_PATH];
//	strcpy(buffer,KodDir);
//	strcat(buffer,"Objects.txt");
//	LoadKodObjects(buffer);
//	strcpy(buffer,KodDir);
//	strcat(buffer,"RoomID.txt");
//	LoadKodRooms(buffer);
//	RoomID = 0;
//	OpenEntrances(EntranceData);

	LogMessage(": Starting roomedit\n");
}