@@ -39,11 +39,9 @@ CJumpNode::CJumpNode(const vec3d* position)
3939
4040 gr_init_alphacolor (&m_display_color, 0 , 255 , 0 , 255 );
4141
42- // Set m_name
42+ // Set m_name and m_display
4343 sprintf (m_name, XSTR ( " Jump Node %d" , 632 ), Jump_nodes.size ());
44-
45- // Set m_display
46- sprintf (m_display, XSTR (" Jump Node %d" , 632 ), Jump_nodes.size ());
44+ m_display[0 ] = ' \0 ' ;
4745
4846 // Set m_modelnum and m_radius
4947 m_modelnum = model_load (NOX (JN_DEFAULT_MODEL), 0 , NULL , 0 );
@@ -145,7 +143,10 @@ const char *CJumpNode::GetName()
145143 */
146144const char * CJumpNode::GetDisplayName ()
147145{
148- return m_display;
146+ if (HasDisplayName ())
147+ return m_display;
148+ else
149+ return m_name;
149150}
150151
151152/* *
@@ -214,7 +215,15 @@ void CJumpNode::SetAlphaColor(int r, int g, int b, int alpha)
214215 CLAMP (b, 0 , 255 );
215216 CLAMP (alpha, 0 , 255 );
216217
217- m_flags |= JN_USE_DISPLAY_COLOR;
218+ // see whether this is actually the default color
219+ // (which actually means to use the HUD color rather than this exact color;
220+ // it might be useful to change this design in the future, but beware of
221+ // FRED calling this function in the background)
222+ if (r == 0 && g == 255 && b == 0 && alpha == 255 )
223+ m_flags &= ~JN_USE_DISPLAY_COLOR;
224+ else
225+ m_flags |= JN_USE_DISPLAY_COLOR;
226+
218227 gr_init_alphacolor (&m_display_color, r, g, b, alpha);
219228}
220229
@@ -266,20 +275,38 @@ void CJumpNode::SetName(const char *new_name)
266275 CJumpNode* check = jumpnode_get_by_name (new_name);
267276 Assertion ((check == this || !check), " Jumpnode %s is being renamed to %s, but a jump node with that name already exists in the mission!\n " , m_name, new_name);
268277 #endif
269-
278+
270279 strcpy_s (m_name, new_name);
280+
281+ // if this name has a hash, create a default display name
282+ if (get_pointer_to_first_hash_symbol (new_name))
283+ {
284+ strcpy_s (m_display, new_name);
285+ end_string_at_first_hash_symbol (m_display);
286+ m_flags |= JN_HAS_DISPLAY_NAME;
287+ }
271288}
272289
273290/* *
274- * Set jump node name
291+ * Set jump node display name
275292 *
276- * @param new_name New name to set
293+ * @param new_display_name New name to set
277294 */
278- void CJumpNode::SetDisplayName (const char * new_name )
295+ void CJumpNode::SetDisplayName (const char *new_display_name )
279296{
280- Assert (new_name != NULL );
297+ Assert (new_display_name != NULL );
281298
282- strcpy_s (m_display, new_name);
299+ // if display name is blank or matches the actual name, clear it
300+ if (*new_display_name == ' \0 ' || !stricmp (new_display_name, m_name))
301+ {
302+ *m_display = ' \0 ' ;
303+ m_flags &= ~JN_HAS_DISPLAY_NAME;
304+ }
305+ else
306+ {
307+ strcpy_s (m_display, new_display_name);
308+ m_flags |= JN_HAS_DISPLAY_NAME;
309+ }
283310}
284311
285312/* *
@@ -307,7 +334,7 @@ void CJumpNode::SetVisibility(bool enabled)
307334/* *
308335 * @return Is the jump node hidden when rendering?
309336 */
310- bool CJumpNode::IsHidden ()
337+ bool CJumpNode::IsHidden () const
311338{
312339 if (m_flags & JN_HIDE)
313340 return true ;
@@ -318,19 +345,27 @@ bool CJumpNode::IsHidden()
318345/* *
319346 * @return Is the jump node colored any other color than default white?
320347 */
321- bool CJumpNode::IsColored ()
348+ bool CJumpNode::IsColored () const
322349{
323350 return ((m_flags & JN_USE_DISPLAY_COLOR) != 0 );
324351}
325352
326353/* *
327354 * @return Is the jump node model set differently from the default one?
328355 */
329- bool CJumpNode::IsSpecialModel ()
356+ bool CJumpNode::IsSpecialModel () const
330357{
331358 return ((m_flags & JN_SPECIAL_MODEL) != 0 );
332359}
333360
361+ /* *
362+ * @return Does the jump node have a display name?
363+ */
364+ bool CJumpNode::HasDisplayName () const
365+ {
366+ return ((m_flags & JN_HAS_DISPLAY_NAME) != 0 );
367+ }
368+
334369/* *
335370* Render jump node. Creates its own draw list to render
336371*
0 commit comments