mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
enhance jump node handling
This commit is contained in:
1 parent
29f82cb5d7
commit
78b957982b
24 files changed
+673
-182
No files matched your search
@@ -676,7 +676,7 @@ void HudGaugeBrackets::renderBoundingBrackets(int x1, int y1, int x2, int y2, in
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy_s(temp_name, jnp->GetName());
|
||||
strcpy_s(temp_name, jnp->GetDisplayName());
|
||||
end_string_at_first_hash_symbol(temp_name);
|
||||
tinfo_name = temp_name;
|
||||
break;
|
||||
|
||||
@@ -1320,7 +1320,7 @@ void HudGaugeTargetBox::renderTargetJumpNode(object *target_objp)
|
||||
renderTargetIntegrity(1);
|
||||
setGaugeColor();
|
||||
|
||||
strcpy_s(outstr, jnp->GetName());
|
||||
strcpy_s(outstr, jnp->GetDisplayName());
|
||||
end_string_at_first_hash_symbol(outstr);
|
||||
renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, outstr);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ CJumpNode::CJumpNode()
|
||||
gr_init_alphacolor(&m_display_color, 0, 255, 0, 255);
|
||||
|
||||
m_name[0] = '\0';
|
||||
m_display[0] = '\0';
|
||||
|
||||
m_pos.xyz.x = 0.0f;
|
||||
m_pos.xyz.y = 0.0f;
|
||||
@@ -40,9 +41,12 @@ CJumpNode::CJumpNode(const vec3d* position)
|
||||
|
||||
// Set m_name
|
||||
sprintf(m_name, XSTR( "Jump Node %d", 632), Jump_nodes.size());
|
||||
|
||||
// Set m_display
|
||||
sprintf(m_display, XSTR("Jump Node %d", 632), Jump_nodes.size());
|
||||
|
||||
// Set m_modelnum and m_radius
|
||||
m_modelnum = model_load(NOX("subspacenode.pof"), 0, NULL, 0);
|
||||
m_modelnum = model_load(NOX(JN_DEFAULT_MODEL), 0, NULL, 0);
|
||||
if (m_modelnum == -1) {
|
||||
Warning(LOCATION, "Could not load default model for %s", m_name);
|
||||
} else {
|
||||
@@ -81,6 +85,7 @@ CJumpNode::CJumpNode(CJumpNode&& other) noexcept
|
||||
m_pos = other.m_pos;
|
||||
|
||||
strcpy_s(m_name, other.m_name);
|
||||
strcpy_s(m_display, other.m_display);
|
||||
}
|
||||
|
||||
CJumpNode& CJumpNode::operator=(CJumpNode&& other) noexcept
|
||||
@@ -103,6 +108,7 @@ CJumpNode& CJumpNode::operator=(CJumpNode&& other) noexcept
|
||||
m_pos = other.m_pos;
|
||||
|
||||
strcpy_s(m_name, other.m_name);
|
||||
strcpy_s(m_display, other.m_display);
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -134,6 +140,14 @@ const char *CJumpNode::GetName()
|
||||
return m_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Display Name of jump node
|
||||
*/
|
||||
const char* CJumpNode::GetDisplayName()
|
||||
{
|
||||
return m_display;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Handle to model
|
||||
*/
|
||||
@@ -256,6 +270,18 @@ void CJumpNode::SetName(const char *new_name)
|
||||
strcpy_s(m_name, new_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set jump node name
|
||||
*
|
||||
* @param new_name New name to set
|
||||
*/
|
||||
void CJumpNode::SetDisplayName(const char* new_name)
|
||||
{
|
||||
Assert(new_name != NULL);
|
||||
|
||||
strcpy_s(m_display, new_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set appearance, hidden or not
|
||||
*
|
||||
|
||||
@@ -28,10 +28,13 @@ class model_draw_list;
|
||||
#define JN_HIDE (1<<2) //Hides a jump node
|
||||
#define JN_SPECIAL_MODEL (1<<3) //If non-default model
|
||||
|
||||
#define JN_DEFAULT_MODEL "subspacenode.pof"
|
||||
|
||||
class CJumpNode
|
||||
{
|
||||
private:
|
||||
char m_name[NAME_LENGTH];
|
||||
char m_display[NAME_LENGTH];
|
||||
float m_radius {0.0f};
|
||||
|
||||
int m_modelnum {-1};
|
||||
@@ -57,6 +60,7 @@ public:
|
||||
|
||||
//Getting
|
||||
const char *GetName();
|
||||
const char* GetDisplayName();
|
||||
int GetModelNumber();
|
||||
int GetSCPObjectNumber();
|
||||
int GetPolymodelInstanceNum();
|
||||
@@ -68,6 +72,7 @@ public:
|
||||
void SetAlphaColor(int r, int g, int b, int alpha);
|
||||
void SetModel(const char *model_name, bool show_polys=false);
|
||||
void SetName(const char *new_name);
|
||||
void SetDisplayName(const char* new_name);
|
||||
void SetVisibility(bool enabled);
|
||||
|
||||
//Query
|
||||
|
||||
@@ -5270,6 +5270,7 @@ void parse_waypoints_and_jumpnodes(mission *pm)
|
||||
|
||||
char file_name[MAX_FILENAME_LEN] = { 0 };
|
||||
char jump_name[NAME_LENGTH] = { 0 };
|
||||
char jump_display_name[NAME_LENGTH] = {0};
|
||||
|
||||
while (optional_string("$Jump Node:")) {
|
||||
stuff_vec3d(&pos);
|
||||
@@ -5280,6 +5281,13 @@ void parse_waypoints_and_jumpnodes(mission *pm)
|
||||
jnp.SetName(jump_name);
|
||||
}
|
||||
|
||||
if (optional_string("+Display Name:")) {
|
||||
stuff_string(jump_display_name, F_NAME, NAME_LENGTH);
|
||||
jnp.SetDisplayName(jump_display_name);
|
||||
} else {
|
||||
jnp.SetDisplayName(jump_name);
|
||||
}
|
||||
|
||||
if(optional_string("+Model File:")){
|
||||
stuff_string(file_name, F_NAME, MAX_FILENAME_LEN);
|
||||
jnp.SetModel(file_name);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "io/key.h"
|
||||
#include "io/mouse.h"
|
||||
#include "io/timer.h"
|
||||
#include "jumpnode/jumpnode.h"
|
||||
#include "lighting/lighting.h"
|
||||
#include "menuui/snazzyui.h"
|
||||
#include "mission/missionbriefcommon.h"
|
||||
@@ -1345,7 +1346,7 @@ int brief_setup_closeup(brief_icon *bi, bool api_access)
|
||||
break;
|
||||
|
||||
case ICON_JUMP_NODE:
|
||||
strcpy_s(pof_filename, NOX("subspacenode.pof"));
|
||||
strcpy_s(pof_filename, NOX(JN_DEFAULT_MODEL));
|
||||
if (Closeup_icon->closeup_label[0] == '\0') {
|
||||
strcpy_s(Closeup_icon->closeup_label, XSTR("Jump Node", 432));
|
||||
}
|
||||
|
||||
+55
-1
@@ -753,6 +753,7 @@ SCP_vector<sexp_oper> Operators = {
|
||||
|
||||
//Jump Node Sub-Category
|
||||
{ "set-jumpnode-name", OP_JUMP_NODE_SET_JUMPNODE_NAME, 2, 2, SEXP_ACTION_OPERATOR, }, //CommanderDJ
|
||||
{ "set-jumpnode-display-name", OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME, 2, 2, SEXP_ACTION_OPERATOR, }, //MjnMixael
|
||||
{ "set-jumpnode-color", OP_JUMP_NODE_SET_JUMPNODE_COLOR, 5, 5, SEXP_ACTION_OPERATOR, },
|
||||
{ "set-jumpnode-model", OP_JUMP_NODE_SET_JUMPNODE_MODEL, 3, 3, SEXP_ACTION_OPERATOR, },
|
||||
{ "show-jumpnode", OP_JUMP_NODE_SHOW_JUMPNODE, 1, INT_MAX, SEXP_ACTION_OPERATOR, },
|
||||
@@ -25131,6 +25132,25 @@ void sexp_set_jumpnode_name(int n) //CommanderDJ
|
||||
Current_sexp_network_packet.end_callback();
|
||||
}
|
||||
|
||||
void sexp_set_jumpnode_display_name(int n) //MjnMixael
|
||||
{
|
||||
auto node = CTEXT(n);
|
||||
n = CDR(n);
|
||||
|
||||
auto jnp = jumpnode_get_by_name(node);
|
||||
if (!jnp)
|
||||
return;
|
||||
|
||||
auto display_name = CTEXT(n);
|
||||
jnp->SetDisplayName(display_name);
|
||||
|
||||
//multiplayer callback
|
||||
Current_sexp_network_packet.start_callback();
|
||||
Current_sexp_network_packet.send_string(node);
|
||||
Current_sexp_network_packet.send_string(display_name);
|
||||
Current_sexp_network_packet.end_callback();
|
||||
}
|
||||
|
||||
void multi_sexp_set_jumpnode_name() //CommanderDJ
|
||||
{
|
||||
char old_name[TOKEN_LENGTH];
|
||||
@@ -25146,6 +25166,21 @@ void multi_sexp_set_jumpnode_name() //CommanderDJ
|
||||
jnp->SetName(new_name);
|
||||
}
|
||||
|
||||
void multi_sexp_set_jumpnode_display_name()
|
||||
{
|
||||
char node[TOKEN_LENGTH];
|
||||
char display_name[TOKEN_LENGTH];
|
||||
|
||||
Current_sexp_network_packet.get_string(node);
|
||||
Current_sexp_network_packet.get_string(display_name);
|
||||
|
||||
CJumpNode* jnp = jumpnode_get_by_name(node);
|
||||
if (jnp == nullptr)
|
||||
return;
|
||||
|
||||
jnp->SetDisplayName(display_name);
|
||||
}
|
||||
|
||||
void sexp_set_jumpnode_color(int n)
|
||||
{
|
||||
auto jumpnode_name = CTEXT(n);
|
||||
@@ -28403,6 +28438,11 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_set_jumpnode_name(node);
|
||||
break;
|
||||
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME:
|
||||
sexp_val = SEXP_TRUE;
|
||||
sexp_set_jumpnode_display_name(node);
|
||||
break;
|
||||
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_COLOR:
|
||||
sexp_val = SEXP_TRUE;
|
||||
sexp_set_jumpnode_color(node);
|
||||
@@ -28885,6 +28925,10 @@ void multi_sexp_eval()
|
||||
multi_sexp_set_jumpnode_name();
|
||||
break;
|
||||
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME:
|
||||
multi_sexp_set_jumpnode_display_name();
|
||||
break;
|
||||
|
||||
case OP_IGNORE_KEY:
|
||||
multi_sexp_ignore_key();
|
||||
break;
|
||||
@@ -29631,6 +29675,7 @@ int query_operator_return_type(int op)
|
||||
case OP_CUTSCENES_FORCE_PERSPECTIVE:
|
||||
case OP_SET_CAMERA_SHUDDER:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_NAME:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_COLOR:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_MODEL:
|
||||
case OP_JUMP_NODE_SHOW_JUMPNODE:
|
||||
@@ -32187,6 +32232,7 @@ int query_operator_argument_type(int op, int argnum)
|
||||
//</Cutscenes>
|
||||
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_NAME: //CommanderDJ
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME:
|
||||
if(argnum==0)
|
||||
return OPF_JUMP_NODE_NAME;
|
||||
else if (argnum==1)
|
||||
@@ -34414,6 +34460,7 @@ int get_category(int op_id)
|
||||
case OP_CUTSCENES_RESET_TIME_COMPRESSION:
|
||||
case OP_CUTSCENES_FORCE_PERSPECTIVE:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_NAME:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_COLOR:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_MODEL:
|
||||
case OP_JUMP_NODE_SHOW_JUMPNODE:
|
||||
@@ -35057,7 +35104,8 @@ int get_subcategory(int op_id)
|
||||
case OP_SET_MOTION_DEBRIS:
|
||||
return CHANGE_SUBCATEGORY_BACKGROUND_AND_NEBULA;
|
||||
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_NAME: //CommanderDJ
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_NAME: //
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_COLOR:
|
||||
case OP_JUMP_NODE_SET_JUMPNODE_MODEL:
|
||||
case OP_JUMP_NODE_SHOW_JUMPNODE:
|
||||
@@ -39384,6 +39432,12 @@ SCP_vector<sexp_help_struct> Sexp_help = {
|
||||
"\tNote: SEXPs referencing the old name will not work after the name change.\r\n"
|
||||
},
|
||||
|
||||
{ OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME, "set-jumpnode-display-name\r\n"
|
||||
"\tSets the display name of a jump node. Takes 2 arguments...\r\n"
|
||||
"\t1: Name of jump node to change display name for\r\n"
|
||||
"\t2: New display name for jump node\r\n"
|
||||
},
|
||||
|
||||
{ OP_JUMP_NODE_SET_JUMPNODE_COLOR, "set-jumpnode-color\r\n"
|
||||
"\tSets the color of a jump node. "
|
||||
"Takes 5 arguments...\r\n"
|
||||
|
||||
@@ -647,6 +647,7 @@ enum : int {
|
||||
OP_CUTSCENES_RESET_TIME_COMPRESSION, // WMC
|
||||
OP_CUTSCENES_FORCE_PERSPECTIVE, // WMC
|
||||
OP_JUMP_NODE_SET_JUMPNODE_NAME, // CommanderDJ
|
||||
OP_JUMP_NODE_SET_JUMPNODE_DISPLAY_NAME,
|
||||
OP_JUMP_NODE_SET_JUMPNODE_COLOR, // WMC
|
||||
OP_JUMP_NODE_SET_JUMPNODE_MODEL, // WMC
|
||||
OP_JUMP_NODE_SHOW_JUMPNODE, // WMC
|
||||
|
||||
+1
-1
@@ -8486,7 +8486,7 @@ void ship_cleanup(int shipnum, int cleanup_mode)
|
||||
// the secondary mission log field
|
||||
auto jnp = jumpnode_get_which_in(objp);
|
||||
if (jnp)
|
||||
jumpnode_name = jnp->GetName();
|
||||
jumpnode_name = jnp->GetDisplayName();
|
||||
|
||||
mission_log_add_entry(LOG_SHIP_DEPARTED, shipp->ship_name, jumpnode_name, shipp->wingnum);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ set(FRED2_SOURCES
|
||||
initialships.h
|
||||
initialstatus.cpp
|
||||
initialstatus.h
|
||||
jumpnodedlg.cpp
|
||||
jumpnodedlg.h
|
||||
listitemchooser.cpp
|
||||
listitemchooser.h
|
||||
mainfrm.cpp
|
||||
|
||||
@@ -118,6 +118,7 @@ CWnd* Prev_window;
|
||||
CShipEditorDlg Ship_editor_dialog;
|
||||
wing_editor Wing_editor_dialog;
|
||||
waypoint_path_dlg Waypoint_editor_dialog;
|
||||
jumpnode_dlg Jumpnode_editor_dialog;
|
||||
music_player_dlg Music_player_dialog;
|
||||
bg_bitmap_dlg* Bg_bitmap_dialog = NULL;
|
||||
briefing_editor_dlg* Briefing_dialog = NULL;
|
||||
@@ -134,6 +135,7 @@ window_data Bg_wnd_data;
|
||||
window_data Briefing_wnd_data;
|
||||
window_data Reinforcement_wnd_data;
|
||||
window_data Waypoint_wnd_data;
|
||||
window_data Jumpnode_wnd_data;
|
||||
window_data MusPlayer_wnd_data;
|
||||
window_data Starfield_wnd_data;
|
||||
window_data Asteroid_wnd_data;
|
||||
@@ -244,6 +246,7 @@ BOOL CFREDApp::InitInstance() {
|
||||
read_window("Ship window", &Ship_wnd_data);
|
||||
read_window("Wing window", &Wing_wnd_data);
|
||||
read_window("Waypoint window", &Waypoint_wnd_data);
|
||||
read_window("Jumpnode window", &Jumpnode_wnd_data);
|
||||
read_window("Musicplayer window", &MusPlayer_wnd_data);
|
||||
read_window("Object window", &Object_wnd_data);
|
||||
read_window("Mission goals window", &Mission_goals_wnd_data);
|
||||
@@ -384,6 +387,7 @@ BOOL CFREDApp::OnIdle(LONG lCount) {
|
||||
theApp.init_window(&Wing_wnd_data, &Wing_editor_dialog, 0, 1);
|
||||
theApp.init_window(&MusPlayer_wnd_data, &Music_player_dialog, 0, 1);
|
||||
theApp.init_window(&Waypoint_wnd_data, &Waypoint_editor_dialog, 0, 1);
|
||||
theApp.init_window(&Jumpnode_wnd_data, &Jumpnode_editor_dialog, 0, 1);
|
||||
init_window(&Main_wnd_data, Fred_main_wnd);
|
||||
Fred_main_wnd->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
|
||||
@@ -517,6 +521,7 @@ void CFREDApp::write_ini_file(int degree) {
|
||||
|
||||
if (!degree) {
|
||||
record_window_data(&Waypoint_wnd_data, &Waypoint_editor_dialog);
|
||||
record_window_data(&Jumpnode_wnd_data, &Jumpnode_editor_dialog);
|
||||
record_window_data(&MusPlayer_wnd_data, &Music_player_dialog);
|
||||
record_window_data(&Wing_wnd_data, &Wing_editor_dialog);
|
||||
record_window_data(&Ship_wnd_data, &Ship_editor_dialog);
|
||||
@@ -526,6 +531,7 @@ void CFREDApp::write_ini_file(int degree) {
|
||||
write_window("Ship window", &Ship_wnd_data);
|
||||
write_window("Wing window", &Wing_wnd_data);
|
||||
write_window("Waypoint window", &Waypoint_wnd_data);
|
||||
write_window("Jumpnode window", &Jumpnode_wnd_data);
|
||||
write_window("Musicplayer window", &MusPlayer_wnd_data);
|
||||
write_window("Object window", &Object_wnd_data);
|
||||
write_window("Mission goals window", &Mission_goals_wnd_data);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "resource.h"
|
||||
#include "ShipEditorDlg.h"
|
||||
#include "WaypointPathDlg.h"
|
||||
#include "JumpNodeDlg.h"
|
||||
#include "wing_editor.h"
|
||||
#include "musicplayerdlg.h"
|
||||
|
||||
@@ -179,6 +180,7 @@ extern CWnd* Prev_window; //!< The currently active wi
|
||||
extern CShipEditorDlg Ship_editor_dialog; //!< The ship editor instance
|
||||
extern wing_editor Wing_editor_dialog; //!< The wing editor instance
|
||||
extern waypoint_path_dlg Waypoint_editor_dialog; //!< The waypoint editor instance
|
||||
extern jumpnode_dlg Jumpnode_editor_dialog; //!< The jumpnode editor instance
|
||||
extern music_player_dlg Music_player_dialog; //!< The music player instance
|
||||
extern bg_bitmap_dlg* Bg_bitmap_dialog; //!< The bitmap dialog instance
|
||||
extern briefing_editor_dlg* Briefing_dialog; //!< The briefing editor instance
|
||||
@@ -197,6 +199,7 @@ extern window_data Bg_wnd_data;
|
||||
extern window_data Briefing_wnd_data;
|
||||
extern window_data Reinforcement_wnd_data;
|
||||
extern window_data Waypoint_wnd_data;
|
||||
extern window_data Jumpnode_wnd_data;
|
||||
extern window_data MusPlayer_wnd_data;
|
||||
extern window_data Starfield_wnd_data;
|
||||
extern window_data Asteroid_wnd_data;
|
||||
|
||||
+47
-1
@@ -551,6 +551,14 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_JUMPNODE_EDIT_MENU MENU
|
||||
BEGIN
|
||||
POPUP "&Select Jump Node"
|
||||
BEGIN
|
||||
MENUITEM "PlaceHolder", ID_SELECTSHIP_PLACEHOLDER
|
||||
END
|
||||
END
|
||||
|
||||
IDR_ASTEROID_FIELD_MENU MENU
|
||||
BEGIN
|
||||
POPUP "Select Field"
|
||||
@@ -611,6 +619,7 @@ BEGIN
|
||||
"R", ID_EDITORS_REINFORCEMENT, VIRTKEY, SHIFT, NOINVERT
|
||||
"S", ID_EDITORS_SHIPS, VIRTKEY, SHIFT, NOINVERT
|
||||
"Y", ID_EDITORS_WAYPOINT, VIRTKEY, SHIFT, NOINVERT
|
||||
"J", ID_EDITORS_JUMPNODE, VIRTKEY, SHIFT, NOINVERT
|
||||
"W", ID_EDITORS_WING, VIRTKEY, SHIFT, NOINVERT
|
||||
"H", ID_ERROR_CHECKER, VIRTKEY, SHIFT, NOINVERT
|
||||
"N", ID_FILE_MISSIONNOTES, VIRTKEY, SHIFT, NOINVERT
|
||||
@@ -1538,7 +1547,7 @@ END
|
||||
|
||||
IDD_WAYPOINT_PATH_EDITOR DIALOG 0, 0, 145, 29
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Waypoint Path/Jump Node Editor"
|
||||
CAPTION "Waypoint Path Editor"
|
||||
MENU IDR_WAYPOINT_PATH_EDIT_MENU
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
@@ -1546,6 +1555,30 @@ BEGIN
|
||||
EDITTEXT IDC_NAME,32,7,106,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
IDD_JUMPNODE_EDITOR DIALOGEX 0, 0, 145, 120
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Jump Node Editor"
|
||||
MENU IDR_JUMPNODE_EDIT_MENU
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Name",IDC_STATIC,7,9,20,8
|
||||
EDITTEXT IDC_NAME,32,7,106,14,ES_AUTOHSCROLL
|
||||
LTEXT "Display Name",IDC_STATIC,7,25,48,8
|
||||
EDITTEXT IDC_ALT_NAME,54,22,84,14,ES_AUTOHSCROLL
|
||||
LTEXT "Model File",IDC_STATIC,7,46,48,8
|
||||
EDITTEXT IDC_MODEL_FILENAME,44,43,94,14,ES_AUTOHSCROLL
|
||||
LTEXT "R",IDC_STATIC,9,78,8,8
|
||||
EDITTEXT IDC_NODE_R,16,75,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "G",IDC_STATIC,42,78,8,8
|
||||
EDITTEXT IDC_NODE_G,49,75,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "B",IDC_STATIC,76,78,8,8
|
||||
EDITTEXT IDC_NODE_B,82,75,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "A",IDC_STATIC,108,78,8,8
|
||||
EDITTEXT IDC_NODE_A,115,75,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Hidden By Default",IDC_NODE_HIDDEN,"Button",BS_3STATE | WS_TABSTOP,7,97,70,10
|
||||
LTEXT "Node Color",IDC_STATIC,7,65,48,8
|
||||
END
|
||||
|
||||
IDD_WING_CREATE DIALOG 0, 0, 119, 68
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Create Wing"
|
||||
@@ -2610,6 +2643,14 @@ BEGIN
|
||||
BOTTOMMARGIN, 22
|
||||
END
|
||||
|
||||
IDD_JUMPNODE_EDITOR, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 138
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 113
|
||||
END
|
||||
|
||||
IDD_WING_CREATE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
@@ -3204,6 +3245,11 @@ BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
IDD_JUMPNODE_EDITOR AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -542,7 +542,8 @@ void display_ship_info() {
|
||||
strcpy_s(buf, "Briefing icon");
|
||||
|
||||
} else if (objp->type == OBJ_JUMP_NODE) {
|
||||
strcpy_s(buf, "Jump Node");
|
||||
CJumpNode* jnp = jumpnode_get_by_objnum(OBJ_INDEX(objp));
|
||||
sprintf(buf, "%s\n%s", jnp->GetName(), jnp->GetDisplayName());
|
||||
} else
|
||||
Assert(0);
|
||||
}
|
||||
|
||||
+17
-2
@@ -258,6 +258,7 @@ BEGIN_MESSAGE_MAP(CFREDView, CView)
|
||||
ON_COMMAND(ID_EDITORS_REINFORCEMENT, OnEditorsReinforcement)
|
||||
ON_COMMAND(ID_ERROR_CHECKER, OnErrorChecker)
|
||||
ON_COMMAND(ID_EDITORS_WAYPOINT, OnEditorsWaypoint)
|
||||
ON_COMMAND(ID_EDITORS_JUMPNODE, OnEditorsJumpnode)
|
||||
ON_COMMAND(ID_VIEW_OUTLINES, OnViewOutlines)
|
||||
ON_UPDATE_COMMAND_UI(ID_VIEW_OUTLINES, OnUpdateViewOutlines)
|
||||
ON_COMMAND(ID_VIEW_OUTLINES_ON_SELECTED, OnViewOutlinesOnSelected)
|
||||
@@ -1443,7 +1444,7 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
|
||||
str.Format("Edit %s", Ships[Objects[objnum].instance].ship_name);
|
||||
|
||||
else if (Objects[objnum].type == OBJ_JUMP_NODE) {
|
||||
id = ID_EDITORS_WAYPOINT;
|
||||
id = ID_EDITORS_JUMPNODE;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[objnum])
|
||||
break;
|
||||
@@ -1963,9 +1964,12 @@ void CFREDView::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||
break;
|
||||
|
||||
case OBJ_WAYPOINT:
|
||||
case OBJ_JUMP_NODE:
|
||||
OnEditorsWaypoint();
|
||||
break;
|
||||
|
||||
case OBJ_JUMP_NODE:
|
||||
OnEditorsJumpnode();
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (Briefing_dialog)
|
||||
@@ -3389,6 +3393,17 @@ void CFREDView::OnEditorsWaypoint()
|
||||
Waypoint_editor_dialog.ShowWindow(SW_RESTORE);
|
||||
}
|
||||
|
||||
void CFREDView::OnEditorsJumpnode()
|
||||
{
|
||||
Assert(Jumpnode_editor_dialog.GetSafeHwnd());
|
||||
|
||||
if (!theApp.init_window(&Jumpnode_wnd_data, &Jumpnode_editor_dialog))
|
||||
return;
|
||||
|
||||
Jumpnode_editor_dialog.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
Jumpnode_editor_dialog.ShowWindow(SW_RESTORE);
|
||||
}
|
||||
|
||||
char *error_check_initial_orders(ai_goal *goals, int ship, int wing)
|
||||
{
|
||||
char *source;
|
||||
|
||||
@@ -217,6 +217,7 @@ protected:
|
||||
afx_msg void OnEditorsReinforcement();
|
||||
afx_msg void OnErrorChecker();
|
||||
afx_msg void OnEditorsWaypoint();
|
||||
afx_msg void OnEditorsJumpnode();
|
||||
afx_msg void OnViewOutlines();
|
||||
afx_msg void OnUpdateViewOutlines(CCmdUI* pCmdUI);
|
||||
afx_msg void OnViewOutlinesOnSelected();
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "JumpnodeDlg.h"
|
||||
#include "Management.h"
|
||||
#include "MainFrm.h"
|
||||
#include "object/object.h"
|
||||
#include "jumpnode/jumpnode.h"
|
||||
|
||||
#define ID_JUMP_NODE_MENU 8000
|
||||
#define ID_WAYPOINT_MENU 9000
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// waypoint_path_dlg dialog
|
||||
|
||||
jumpnode_dlg::jumpnode_dlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(jumpnode_dlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(jumpnode_dlg)
|
||||
m_name = _T("");
|
||||
m_display = _T("");
|
||||
m_filename = _T("");
|
||||
m_color_r = 0;
|
||||
m_color_g = 0;
|
||||
m_color_b = 0;
|
||||
m_color_a = 0;
|
||||
m_hidden = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
bypass_errors = 0;
|
||||
}
|
||||
|
||||
void jumpnode_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(jumpnode_dlg)
|
||||
DDX_Text(pDX, IDC_NAME, m_name);
|
||||
DDX_Text(pDX, IDC_ALT_NAME, m_display);
|
||||
DDX_Text(pDX, IDC_MODEL_FILENAME, m_filename);
|
||||
DDX_Text(pDX, IDC_NODE_R, m_color_r);
|
||||
DDV_MinMaxInt(pDX, m_color_r, 0, 255);
|
||||
DDX_Text(pDX, IDC_NODE_G, m_color_g);
|
||||
DDV_MinMaxInt(pDX, m_color_g, 0, 255);
|
||||
DDX_Text(pDX, IDC_NODE_B, m_color_b);
|
||||
DDV_MinMaxInt(pDX, m_color_b, 0, 255);
|
||||
DDX_Text(pDX, IDC_NODE_A, m_color_a);
|
||||
DDV_MinMaxInt(pDX, m_color_a, 0, 255);
|
||||
DDX_Check(pDX, IDC_NODE_HIDDEN, m_hidden);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(jumpnode_dlg, CDialog)
|
||||
//{{AFX_MSG_MAP(jumpnode_dlg)
|
||||
ON_BN_CLICKED(IDC_NODE_HIDDEN, OnHidden)
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_INITMENU()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// jumpnode_dlg message handlers
|
||||
|
||||
BOOL jumpnode_dlg::Create()
|
||||
{
|
||||
BOOL r;
|
||||
r = CDialog::Create(IDD, Fred_main_wnd);
|
||||
initialize_data(1);
|
||||
return r;
|
||||
}
|
||||
|
||||
void jumpnode_dlg::OnInitMenu(CMenu* pMenu)
|
||||
{
|
||||
int i;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
CMenu *m;
|
||||
|
||||
m = pMenu->GetSubMenu(0);
|
||||
clear_menu(m);
|
||||
|
||||
i = 0;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
m->AppendMenu(MF_ENABLED | MF_STRING, ID_JUMP_NODE_MENU + i, jnp->GetName());
|
||||
if (jnp->GetSCPObjectNumber() == cur_object_index) {
|
||||
m->CheckMenuItem(ID_JUMP_NODE_MENU + i, MF_BYCOMMAND | MF_CHECKED);
|
||||
}
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
m->DeleteMenu(ID_PLACEHOLDER, MF_BYCOMMAND);
|
||||
|
||||
CDialog::OnInitMenu(pMenu);
|
||||
}
|
||||
|
||||
void jumpnode_dlg::OnOK() {
|
||||
}
|
||||
|
||||
void jumpnode_dlg::OnClose()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (update_data()) {
|
||||
SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
bypass_errors = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
SetWindowPos(Fred_main_wnd, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
|
||||
Fred_main_wnd->SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
void jumpnode_dlg::initialize_data(int full_update)
|
||||
{
|
||||
int enable = TRUE;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
|
||||
if (!GetSafeHwnd())
|
||||
return;
|
||||
|
||||
if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[cur_object_index])
|
||||
break;
|
||||
}
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_display = _T(jnp->GetDisplayName());
|
||||
|
||||
int model = jnp->GetModelNumber();
|
||||
polymodel* pm = model_get(model);
|
||||
m_filename = _T(pm->filename);
|
||||
|
||||
color jn_color = jnp->GetColor();
|
||||
m_color_r = jn_color.red;
|
||||
m_color_g = jn_color.green;
|
||||
m_color_b = jn_color.blue;
|
||||
m_color_a = jn_color.alpha;
|
||||
|
||||
m_hidden = (int)jnp->IsHidden();
|
||||
|
||||
} else {
|
||||
m_name = _T("");
|
||||
m_display = _T("");
|
||||
m_filename = _T("");
|
||||
m_color_r = 0;
|
||||
m_color_g = 0;
|
||||
m_color_b = 0;
|
||||
m_color_a = 0;
|
||||
m_hidden = FALSE;
|
||||
enable = FALSE;
|
||||
}
|
||||
|
||||
if (full_update)
|
||||
UpdateData(FALSE);
|
||||
|
||||
GetDlgItem(IDC_NAME)->EnableWindow(enable);
|
||||
}
|
||||
|
||||
int jumpnode_dlg::update_data()
|
||||
{
|
||||
const char *str;
|
||||
char old_name[255];
|
||||
int i, z;
|
||||
object *ptr;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
|
||||
if (!GetSafeHwnd())
|
||||
return 0;
|
||||
|
||||
if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[cur_object_index])
|
||||
break;
|
||||
}
|
||||
|
||||
for (i=0; i<MAX_WINGS; i++)
|
||||
{
|
||||
if (!stricmp(Wings[i].name, m_name)) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a wing\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) {
|
||||
if (!stricmp(m_name, Ships[ptr->instance].ship_name)) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a ship\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
// We don't need to check teams. "Unknown" is a valid name and also an IFF.
|
||||
|
||||
for ( i=0; i < (int)Ai_tp_list.size(); i++) {
|
||||
if (!stricmp(m_name, Ai_tp_list[i].name)) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a target priority group.\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list((LPCSTR) m_name) != NULL)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a waypoint path\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
if (!stricmp(m_name.Left(1), "<")) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("Jump node names not allowed to begin with <\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
CJumpNode* found = jumpnode_get_by_name(m_name);
|
||||
if(found != NULL && &(*jnp) != found)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by another jump node\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
strcpy_s(old_name, jnp->GetName());
|
||||
jnp->SetName((LPCSTR) m_name);
|
||||
jnp->SetDisplayName((LPCSTR) m_display);
|
||||
|
||||
int model = jnp->GetModelNumber();
|
||||
polymodel* pm = model_get(model);
|
||||
CString old_filename = _T(pm->filename);
|
||||
|
||||
// Does that pof file exist?
|
||||
if (cf_exists_full((LPCSTR)m_filename, CF_TYPE_MODELS)) {
|
||||
if (stricmp((LPCSTR)m_filename, JN_DEFAULT_MODEL)) {
|
||||
jnp->SetModel((LPCSTR)m_filename);
|
||||
}
|
||||
} else {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node pof file does not exist\n"
|
||||
"Press OK to restore old file", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_filename = old_filename;
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
jnp->SetAlphaColor(m_color_r, m_color_g, m_color_b, m_color_a);
|
||||
|
||||
jnp->SetVisibility(!(bool)m_hidden);
|
||||
|
||||
str = (LPCTSTR) m_name;
|
||||
if (strcmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
update_map_window();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL jumpnode_dlg::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int id, point;
|
||||
object *ptr;
|
||||
|
||||
id = LOWORD(wParam);
|
||||
if ((id >= ID_JUMP_NODE_MENU) && (id < ID_JUMP_NODE_MENU + (int) Jump_nodes.size())) {
|
||||
if (!update_data()) {
|
||||
point = id - ID_JUMP_NODE_MENU;
|
||||
unmark_all();
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while ((ptr != END_OF_LIST(&obj_used_list)) && (point > -1)) {
|
||||
if (ptr->type == OBJ_JUMP_NODE) {
|
||||
if (point == 0) {
|
||||
mark_object(OBJ_INDEX(ptr));
|
||||
}
|
||||
point--;
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return CDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
void jumpnode_dlg::OnHidden()
|
||||
{
|
||||
if (m_hidden == 1)
|
||||
m_hidden = 0;
|
||||
else
|
||||
m_hidden = 1;
|
||||
|
||||
((CButton*)GetDlgItem(IDC_NODE_HIDDEN))->SetCheck(m_hidden);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _JUMPNODEDLG_H
|
||||
#define _JUMPNODEDLG_H
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// jumpnode_dlg dialog
|
||||
|
||||
class jumpnode_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
int bypass_errors;
|
||||
int update_data();
|
||||
void initialize_data(int full_update);
|
||||
void OnOK();
|
||||
BOOL Create();
|
||||
jumpnode_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(jumpnode_dlg)
|
||||
enum { IDD = IDD_JUMPNODE_EDITOR };
|
||||
CString m_name;
|
||||
CString m_display;
|
||||
CString m_filename;
|
||||
int m_color_r;
|
||||
int m_color_g;
|
||||
int m_color_b;
|
||||
int m_color_a;
|
||||
int m_hidden;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(jumpnode_dlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(jumpnode_dlg)
|
||||
afx_msg void OnInitMenu(CMenu* pMenu);
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnHidden();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -238,6 +238,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
Ship_editor_dialog.Create();
|
||||
Wing_editor_dialog.Create();
|
||||
Waypoint_editor_dialog.Create();
|
||||
Jumpnode_editor_dialog.Create();
|
||||
Music_player_dialog.Create();
|
||||
init_tools();
|
||||
LoadBarState("Tools state");
|
||||
|
||||
@@ -1001,6 +1001,7 @@ void set_cur_object_index(int obj)
|
||||
set_cur_indices(obj); // select the new object
|
||||
Update_ship = Update_wing = 1;
|
||||
Waypoint_editor_dialog.initialize_data(1);
|
||||
Jumpnode_editor_dialog.initialize_data(1);
|
||||
Update_window = 1;
|
||||
}
|
||||
|
||||
@@ -1123,6 +1124,15 @@ int update_dialog_boxes()
|
||||
return z;
|
||||
}
|
||||
|
||||
z = Jumpnode_editor_dialog.update_data();
|
||||
if (z) {
|
||||
nprintf(("Fred routing", "jumpnode dialog save failed\n"));
|
||||
Jumpnode_editor_dialog
|
||||
.SetWindowPos(&Fred_main_wnd->wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
|
||||
return z;
|
||||
}
|
||||
|
||||
update_map_window();
|
||||
return 0;
|
||||
}
|
||||
@@ -1429,6 +1439,7 @@ void mark_object(int obj)
|
||||
}
|
||||
Update_ship = Update_wing = 1;
|
||||
Waypoint_editor_dialog.initialize_data(1);
|
||||
Jumpnode_editor_dialog.initialize_data(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,6 +1467,7 @@ void unmark_object(int obj)
|
||||
}
|
||||
Update_ship = Update_wing = 1;
|
||||
Waypoint_editor_dialog.initialize_data(1);
|
||||
Jumpnode_editor_dialog.initialize_data(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-6
@@ -4584,22 +4584,35 @@ int CFred_mission_save::save_waypoints()
|
||||
fout(" %s", jnp->GetName());
|
||||
|
||||
if (Mission_save_format != FSO_FORMAT_RETAIL) {
|
||||
if (jnp->IsSpecialModel()) {
|
||||
if (optional_string_fred("+Model File:", "$Jump Node:"))
|
||||
|
||||
if (jnp->GetDisplayName()[0] != '\0') {
|
||||
if (optional_string_fred("+Display Name:", "$Jump Node:")) {
|
||||
parse_comments();
|
||||
else
|
||||
} else {
|
||||
fout("\n+Display Name:");
|
||||
}
|
||||
|
||||
fout_ext("", "%s", jnp->GetDisplayName());
|
||||
}
|
||||
|
||||
if (jnp->IsSpecialModel()) {
|
||||
if (optional_string_fred("+Model File:", "$Jump Node:")) {
|
||||
parse_comments();
|
||||
} else {
|
||||
fout("\n+Model File:");
|
||||
}
|
||||
|
||||
int model = jnp->GetModelNumber();
|
||||
polymodel *pm = model_get(model);
|
||||
polymodel* pm = model_get(model);
|
||||
fout(" %s", pm->filename);
|
||||
}
|
||||
|
||||
if (jnp->IsColored()) {
|
||||
if (optional_string_fred("+Alphacolor:", "$Jump Node:"))
|
||||
if (optional_string_fred("+Alphacolor:", "$Jump Node:")) {
|
||||
parse_comments();
|
||||
else
|
||||
} else {
|
||||
fout("\n+Alphacolor:");
|
||||
}
|
||||
|
||||
color jn_color = jnp->GetColor();
|
||||
fout(" %u %u %u %u", jn_color.red, jn_color.green, jn_color.blue, jn_color.alpha);
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#define IDD_WAYPOINT_PATH_EDITOR 210
|
||||
#define IDR_WAYPOINT_PATH_EDIT_MENU 211
|
||||
#define IDD_WING_CREATE 212
|
||||
#define IDD_JUMPNODE_EDITOR 213
|
||||
#define IDD_INITIAL_STATUS 214
|
||||
#define IDD_ASTEROID_EDITOR 215
|
||||
#define IDD_CAMPAIGN 216
|
||||
@@ -66,6 +67,7 @@
|
||||
#define IDD_BRIEFING_EDITOR 221
|
||||
#define IDD_IGNORE_ORDERS 222
|
||||
#define IDD_DEBRIEFING_EDITOR 223
|
||||
#define IDR_JUMPNODE_EDIT_MENU 224
|
||||
#define IDB_OPERATOR 226
|
||||
#define IDB_DATA 227
|
||||
#define IDB_ROOT 228
|
||||
@@ -677,15 +679,21 @@
|
||||
#define IDC_USES_SPIN 1306
|
||||
#define IDC_ADD 1308
|
||||
#define IDC_BROWSE 1309
|
||||
#define IDC_NODE_R 1310
|
||||
#define IDC_NODE_G 1311
|
||||
#define IDC_BEHAVIOR 1312
|
||||
#define IDC_ARRIVAL_DELAY 1313
|
||||
#define IDC_NODE_B 1314
|
||||
#define IDC_DEPARTURE_DELAY 1315
|
||||
#define IDC_NODE_A 1316
|
||||
#define IDC_NODE_HIDDEN 1317
|
||||
#define IDC_ARRIVAL_DELAY_SPIN 1318
|
||||
#define IDC_WING 1321
|
||||
#define IDC_NAME 1322
|
||||
#define IDC_REINFORCEMENT 1323
|
||||
#define IDC_MAIN_HALL 1323
|
||||
#define IDC_DEBRIEFING_PERSONA 1324
|
||||
#define IDC_ALT_NAME 1325
|
||||
#define IDC_DOCK1 1327
|
||||
#define IDC_INNER_MIN_X 1327
|
||||
#define IDC_DOCK2 1328
|
||||
@@ -1407,6 +1415,7 @@
|
||||
#define ID_ASTEROID_EDITOR 32984
|
||||
#define ID_RUN_FREESPACE 32985
|
||||
#define ID_EDITOR_CAMPAIGN 32986
|
||||
#define ID_EDITORS_JUMPNODE 32987
|
||||
#define ID_SHOW_IFF_9 32988
|
||||
#define ID_SHOW_HOSTILE 32989
|
||||
#define ID_SHOW_SHIPS 32990
|
||||
|
||||
@@ -73,7 +73,6 @@ void waypoint_path_dlg::OnInitMenu(CMenu* pMenu)
|
||||
{
|
||||
int i;
|
||||
SCP_list<waypoint_list>::iterator ii;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
CMenu *m;
|
||||
|
||||
m = pMenu->GetSubMenu(0);
|
||||
@@ -83,16 +82,6 @@ void waypoint_path_dlg::OnInitMenu(CMenu* pMenu)
|
||||
m->AppendMenu(MF_ENABLED | MF_STRING, ID_WAYPOINT_MENU + i, ii->get_name());
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
m->AppendMenu(MF_ENABLED | MF_STRING, ID_JUMP_NODE_MENU + i, jnp->GetName());
|
||||
if (jnp->GetSCPObjectNumber() == cur_object_index) {
|
||||
m->CheckMenuItem(ID_JUMP_NODE_MENU + i, MF_BYCOMMAND | MF_CHECKED);
|
||||
}
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
m->DeleteMenu(ID_PLACEHOLDER, MF_BYCOMMAND);
|
||||
if (cur_waypoint_list != NULL)
|
||||
{
|
||||
@@ -123,7 +112,6 @@ void waypoint_path_dlg::OnClose()
|
||||
void waypoint_path_dlg::initialize_data(int full_update)
|
||||
{
|
||||
int enable = TRUE;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
|
||||
if (!GetSafeHwnd())
|
||||
return;
|
||||
@@ -136,14 +124,6 @@ void waypoint_path_dlg::initialize_data(int full_update)
|
||||
if (cur_waypoint_list != NULL) {
|
||||
m_name = _T(cur_waypoint_list->get_name());
|
||||
|
||||
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[cur_object_index])
|
||||
break;
|
||||
}
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
|
||||
} else {
|
||||
m_name = _T("");
|
||||
enable = FALSE;
|
||||
@@ -161,7 +141,6 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
char old_name[255];
|
||||
int i, z;
|
||||
object *ptr;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
|
||||
if (!GetSafeHwnd())
|
||||
return 0;
|
||||
@@ -295,127 +274,6 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
update_texture_replacements(old_name, str);
|
||||
}
|
||||
|
||||
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[cur_object_index])
|
||||
break;
|
||||
}
|
||||
|
||||
for (i=0; i<MAX_WINGS; i++)
|
||||
{
|
||||
if (!stricmp(Wings[i].name, m_name)) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a wing\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) {
|
||||
if (!stricmp(m_name, Ships[ptr->instance].ship_name)) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a ship\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
// We don't need to check teams. "Unknown" is a valid name and also an IFF.
|
||||
|
||||
for ( i=0; i < (int)Ai_tp_list.size(); i++) {
|
||||
if (!stricmp(m_name, Ai_tp_list[i].name)) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a target priority group.\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list((LPCSTR) m_name) != NULL)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by a waypoint path\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
if (!stricmp(m_name.Left(1), "<")) {
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("Jump node names not allowed to begin with <\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
CJumpNode* found = jumpnode_get_by_name(m_name);
|
||||
if(found != NULL && &(*jnp) != found)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
z = MessageBox("This jump node name is already being used by another jump node\n"
|
||||
"Press OK to restore old name", "Error", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
strcpy_s(old_name, jnp->GetName());
|
||||
jnp->SetName((LPCSTR) m_name);
|
||||
|
||||
str = (LPCTSTR) m_name;
|
||||
if (strcmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (redraw)
|
||||
@@ -447,25 +305,5 @@ BOOL waypoint_path_dlg::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
|
||||
if ((id >= ID_JUMP_NODE_MENU) && (id < ID_JUMP_NODE_MENU + (int) Jump_nodes.size())) {
|
||||
if (!update_data()) {
|
||||
point = id - ID_JUMP_NODE_MENU;
|
||||
unmark_all();
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while ((ptr != END_OF_LIST(&obj_used_list)) && (point > -1)) {
|
||||
if (ptr->type == OBJ_JUMP_NODE) {
|
||||
if (point == 0) {
|
||||
mark_object(OBJ_INDEX(ptr));
|
||||
}
|
||||
point--;
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return CDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
@@ -4744,11 +4744,21 @@ int CFred_mission_save::save_waypoints()
|
||||
fout(" %s", jnp->GetName());
|
||||
|
||||
if (save_format != MissionFormat::RETAIL) {
|
||||
|
||||
if (jnp->GetDisplayName()[0] != '\0') {
|
||||
if (optional_string_fred("+Display Name:", "$Jump Node:")) {
|
||||
parse_comments();
|
||||
} else {
|
||||
fout("\n+Display Name:");
|
||||
}
|
||||
|
||||
fout_ext("", "%s", jnp->GetDisplayName());
|
||||
}
|
||||
|
||||
if (jnp->IsSpecialModel()) {
|
||||
if (optional_string_fred("+Model File:", "$Jump Node:")) {
|
||||
parse_comments();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fout("\n+Model File:");
|
||||
}
|
||||
|
||||
@@ -4760,8 +4770,7 @@ int CFred_mission_save::save_waypoints()
|
||||
if (jnp->IsColored()) {
|
||||
if (optional_string_fred("+Alphacolor:", "$Jump Node:")) {
|
||||
parse_comments();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fout("\n+Alphacolor:");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user