18 #include "FredRender.h"
19 #include "Management.h"
25 #include "CampaignTreeWnd.h"
26 #include "CampaignTreeView.h"
27 #include "CampaignEditorDlg.h"
34 #error macro FRED is not defined when trying to build release Fred. Please define FRED macro in build settings in all Fred projects
40 static char THIS_FILE[] = __FILE__;
82 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
83 ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
88 ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
90 ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
136 Enable3dControlsStatic();
139 LoadStdProfileSettings(9);
169 read_window(
"Waypoint window", &Waypoint_wnd_data);
171 read_window(
"Mission goals window", &Mission_goals_wnd_data);
172 read_window(
"Messages window", &Messages_wnd_data);
176 read_window(
"Briefing window", &Briefing_wnd_data);
177 read_window(
"Reinforcement window", &Reinforcement_wnd_data);
178 read_window(
"Starfield window", &Starfield_wnd_data);
179 read_window(
"Asteroid window", &Asteroid_wnd_data);
180 read_window(
"Mission notes window", &Mission_notes_wnd_data);
186 CSingleDocTemplate* pDocTemplate;
187 pDocTemplate =
new CSingleDocTemplate(
192 AddDocTemplate(pDocTemplate);
217 Assert( strlen(__argv[0]) > 2 );
220 if (__argv[0][1] !=
':') {
232 while (*str_end !=
'//' && *str_end !=
'\\')
238 if ((m_pRecentFileList != NULL) && (m_pRecentFileList->GetSize() > 0))
241 m_sInitialDir = m_pRecentFileList->operator[](0);
247 m_sInitialDir +=
"\\data\\missions";
252 CCommandLineInfo cmdInfo;
253 ParseCommandLine(cmdInfo);
255 m_nCmdShow = Main_wnd_data.
p.showCmd;
259 if(m_pMainWnd == NULL)
return FALSE;
262 m_pMainWnd->DragAcceptFiles();
291 afx_msg
void OnBug();
294 DECLARE_MESSAGE_MAP()
305 CDialog::DoDataExchange(pDX);
331 if(!DoPromptFileName(m_sInitialDir, AFX_IDS_OPENFILE, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,
TRUE, NULL))
336 AfxGetApp()->OpenDocumentFile(m_sInitialDir);
340 m_sInitialDir.Empty();
373 str.Format(
"Marked: %d",
Marked);
376 pStatus->SetPaneText(1, str);
381 str.Format(
"Viewpoint: Camera");
383 pStatus->SetPaneText(2, str);
386 pStatus->SetPaneText(3,
"MODIFIED");
388 pStatus->SetPaneText(3,
"");
391 pStatus->SetPaneText(4, str);
399 #define MAX_PENDING_MESSAGES 16
413 if (Pending_messages[i].frame_to_process != -1)
414 if (Pending_messages[i].frame_to_process <=
FrameCount) {
428 if (Pending_messages[i].frame_to_process == -1) {
429 Pending_messages[
i].
hwnd = (
int) hwnd;
430 Pending_messages[
i].
id =
id;
431 Pending_messages[
i].
wparam = wparam;
432 Pending_messages[
i].
lparam = lparam;
442 Pending_messages[i].frame_to_process = -1;
447 void win32_blit(
void *xx,
void *yy,
int x,
int y,
int w,
int h )
449 HPALETTE hOldPalette = NULL;
450 HDC hdc = GetDC(hwndApp);
453 if ( !fAppActive )
return;
456 hOldPalette = SelectPalette(hdc, hPalette,
FALSE);
457 RealizePalette( hdc );
460 BitBlt(hdc, 0, 0, w, h, hSrcDC, x, y, SRCCOPY);
463 SelectPalette(hdc, hOldPalette,
FALSE);
465 ReleaseDC( hwndApp, hdc );
479 theApp.
init_window(&Ship_wnd_data, &Ship_editor_dialog, adjust, 1);
480 theApp.
init_window(&Wing_wnd_data, &Wing_editor_dialog, adjust, 1);
481 theApp.
init_window(&Waypoint_wnd_data, &Waypoint_editor_dialog, 0, 1);
483 Fred_main_wnd->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
489 CWinApp::OnIdle(lCount);
507 wnd = wnd->GetParent();
555 WriteProfileInt(
"Preferences",
"Show stars",
Show_stars);
558 WriteProfileInt(
"Preferences",
"Show compass",
Show_compass);
561 WriteProfileInt(
"Preferences",
"Show outlines",
Show_outlines);
562 WriteProfileInt(
"Preferences",
"Physics speed",
physics_speed);
563 WriteProfileInt(
"Preferences",
"Physics rotation",
physics_rot);
570 WriteProfileInt(
"Preferences",
"Anti aliased gridlines",
Aa_gridlines);
573 WriteProfileInt(
"Preferences",
"Lighting On",
Lighting_on);
591 write_window(
"Mission goals window", &Mission_goals_wnd_data);
597 write_window(
"Reinforcement window", &Reinforcement_wnd_data);
600 write_window(
"Mission notes window", &Mission_notes_wnd_data);
606 WriteProfileInt(name,
"valid", wndd->
valid);
607 WriteProfileInt(name,
"length", wndd->
p.length);
608 WriteProfileInt(name,
"flags", wndd->
p.flags);
609 WriteProfileInt(name,
"showCmd", wndd->
p.showCmd);
610 WriteProfileInt(name,
"ptMinPosition.x", wndd->
p.ptMinPosition.x);
611 WriteProfileInt(name,
"ptMinPosition.y", wndd->
p.ptMinPosition.y);
612 WriteProfileInt(name,
"ptMaxPosition.x", wndd->
p.ptMaxPosition.x);
613 WriteProfileInt(name,
"ptMaxPosition.y", wndd->
p.ptMaxPosition.y);
614 WriteProfileInt(name,
"rcNormalPosition.left", wndd->
p.rcNormalPosition.left);
615 WriteProfileInt(name,
"rcNormalPosition.top", wndd->
p.rcNormalPosition.top);
616 WriteProfileInt(name,
"rcNormalPosition.right", wndd->
p.rcNormalPosition.right);
617 WriteProfileInt(name,
"rcNormalPosition.bottom", wndd->
p.rcNormalPosition.bottom);
618 WriteProfileInt(name,
"Visible", wndd->
visible);
624 wndd->
valid = GetProfileInt(name,
"valid",
FALSE);
625 wndd->
p.length = GetProfileInt(name,
"length", 0);
626 wndd->
p.flags = GetProfileInt(name,
"flags", 0);
627 wndd->
p.showCmd = GetProfileInt(name,
"showCmd", SW_SHOWMAXIMIZED);
628 wndd->
p.ptMinPosition.x = GetProfileInt(name,
"ptMinPosition.x", 0);
629 wndd->
p.ptMinPosition.y = GetProfileInt(name,
"ptMinPosition.y", 0);
630 wndd->
p.ptMaxPosition.x = GetProfileInt(name,
"ptMaxPosition.x", 0);
631 wndd->
p.ptMaxPosition.y = GetProfileInt(name,
"ptMaxPosition.y", 0);
632 wndd->
p.rcNormalPosition.left = GetProfileInt(name,
"rcNormalPosition.left", 0);
633 wndd->
p.rcNormalPosition.top = GetProfileInt(name,
"rcNormalPosition.top", 0);
634 wndd->
p.rcNormalPosition.right = GetProfileInt(name,
"rcNormalPosition.right", 0);
635 wndd->
p.rcNormalPosition.bottom = GetProfileInt(name,
"rcNormalPosition.bottom", 0);
636 wndd->
visible = GetProfileInt(name,
"Visible", 1);
650 Assert(wnd->GetSafeHwnd());
651 wnd->GetWindowPlacement(&p);
652 width = p.rcNormalPosition.right - p.rcNormalPosition.left;
653 height = p.rcNormalPosition.bottom - p.rcNormalPosition.top + adjust;
654 wndd->
p.rcNormalPosition.right = wndd->
p.rcNormalPosition.left +
width;
655 wndd->
p.rcNormalPosition.bottom = wndd->
p.rcNormalPosition.top +
height;
658 wnd->SetWindowPlacement(&wndd->
p);
672 wnd->GetWindowPlacement(&wndd->
p);
673 wndd->
visible = wnd->IsWindowVisible();
679 char *
path =
"http://scp.indiegames.us/mantis/";
682 sprintf(buffer,
"explorer.exe \"%s\"", path);
684 WinExec(buffer,SW_SHOW);
689 char *
path =
"http://www.hard-light.net/forums/";
692 sprintf(buffer,
"explorer.exe \"%s\"", path);
694 WinExec(buffer,SW_SHOW);
700 return CWinApp::ExitInstance();
void record_window_data(window_data *wndd, CWnd *wnd)
void show_control_mode(void)
window_data Main_wnd_data
window_data Reinforcement_wnd_data
void init_pending_messages(void)
GLfloat GLfloat GLfloat GLfloat h
void outwnd_init(int display_under_freespace_window)
window_data Object_wnd_data
CShipEditorDlg Ship_editor_dialog
window_data Waypoint_wnd_data
char * object_name(int obj)
int init_window(window_data *wndd, CWnd *wnd, int adjust=0, int pre=0)
#define HOFFOSS_INTERFACE
void write_ini_file(int degree=0)
afx_msg void OnFileOpen()
window_data Starfield_wnd_data
CMainFrame * Fred_main_wnd
void game_start_subspace_ambient_sound()
void SCP_mspdbcs_Initialise()
bg_bitmap_dlg * Bg_bitmap_dialog
int double_fine_gridlines
window_data Mission_notes_wnd_data
virtual void DoDataExchange(CDataExchange *pDX)
window_data Messages_wnd_data
void process_pending_messages(void)
void SCP_mspdbcs_Cleanup()
window_data Mission_goals_wnd_data
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
window_data Asteroid_wnd_data
virtual BOOL OnIdle(LONG lCount)
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
#define MAX_PENDING_MESSAGES
CStatusBar m_wndStatusBar
void initialize_data(int full)
campaign_tree_wnd * Campaign_wnd
GLint GLint GLint GLint GLint x
virtual int ExitInstance()
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
virtual BOOL InitInstance()
window_data Briefing_wnd_data
char * control_mode_text[]
wing_editor Wing_editor_dialog
GLuint const GLchar * name
void write_window(char *name, window_data *wndd)
#define GetCurrentDirectory(i, s)
GLint GLsizei GLsizei height
GLubyte GLubyte GLubyte GLubyte w
pending_message Pending_messages[MAX_PENDING_MESSAGES]
GLsizei const GLchar ** path
waypoint_path_dlg Waypoint_editor_dialog
window_data Ship_wnd_data
window_data Events_wnd_data
window_data Wing_wnd_data
void game_stop_subspace_ambient_sound()
void read_window(char *name, window_data *wndd)
briefing_editor_dlg * Briefing_dialog
void add_pending_message(HWND hwnd, int id, int wparam, int lparam, int skip_count)
#define SEXP_HELP_BOX_SIZE
GLdouble GLdouble GLdouble GLdouble top
window_data Player_wnd_data
void initialize_data(int full)