Skip to content

[ZH][WB] Add help text support for scripts similar to ra3 #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
#define THIS_PLAYER "<This Player>"
#define LOCAL_PLAYER "<Local Player>"

#define PLAYER_0 "player0"
#define PLAYER_1 "player1"
#define PLAYER_2 "player2"
#define PLAYER_3 "player3"
#define PLAYER_4 "player4"
#define PLAYER_5 "player5"
#define PLAYER_6 "player6"
#define PLAYER_7 "player7"

#define THE_PLAYER "ThePlayer"
#define TEAM_THE_PLAYER "teamThePlayer"

Expand Down Expand Up @@ -1062,6 +1071,7 @@ class Template : public MemoryPoolObject
AsciiString getName(void) const {return m_uiName;}
AsciiString getName2(void) const {return m_uiName2;}
Int getUiStrings(AsciiString strings[MAX_PARMS]) const;
AsciiString getHelpText(void) const {return m_helpText;}
Int getNumParameters(void) const {return m_numParameters;}
enum Parameter::ParameterType getParameterType(Int ndx) const;
};
Expand Down
6 changes: 3 additions & 3 deletions GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,10 +1017,10 @@ Bool isValidMap( AsciiString mapName, Bool isMultiplayer )
MapCache::iterator it = TheMapCache->find(mapName);
if (it != TheMapCache->end())
{
if (isMultiplayer == it->second.m_isMultiplayer)
{
// if (isMultiplayer == it->second.m_isMultiplayer)
// {
return TRUE;
}
// }
}

return FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ AsciiString Parameter::getUiText(void) const
case RADAR_EVENT_TYPE:
switch (m_int) {
//case RADAR_EVENT_INVALID: ++m_int; // continue to the next case.
case RADAR_EVENT_INVALID: DEBUG_CRASH(("Invalid radar event\n")); uiText.format("Construction"); break;
case RADAR_EVENT_INVALID: uiText.format("Construction"); break;
case RADAR_EVENT_CONSTRUCTION: uiText.format("Construction"); break;
case RADAR_EVENT_UPGRADE: uiText.format("Upgrade"); break;
case RADAR_EVENT_UNDER_ATTACK: uiText.format("Under Attack"); break;
Expand Down
12 changes: 9 additions & 3 deletions GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ class DrawObject : public RenderObjClass
static void setWaypointDragFeedback(const Coord3D &start, const Coord3D &end);
static void setRampFeedbackParms(const Coord3D *start, const Coord3D *end, Real rampWidth);
static void stopWaypointDragFeedback();




static void setRoadIconColor(int val) { m_roadIconColor = val; }
static void setWaypointIconColor(int val) { m_waypointIconColor = val; }
static void setUnitIconColor(int val) { m_unitIconColor = val; }
static void setDefaultIconColor(int val) { m_defaultIconColor = val; }

MeshClass *peekMesh(void) {return m_moldMesh;};
void getMeshBounds(SphereClass *pSphere) {*pSphere = m_moldMeshBounds;};
Expand Down Expand Up @@ -168,6 +170,10 @@ class DrawObject : public RenderObjClass
static Coord3D m_rampEndPoint; ///< End ramp point
static Real m_rampWidth;

static Int m_roadIconColor;
static Int m_waypointIconColor;
static Int m_unitIconColor;
static Int m_defaultIconColor;
protected:
void addCircleToLineRenderer( const Coord3D & center, Real radius, Real width, unsigned long color, CameraClass* camera );
Int updateVB(DX8VertexBufferClass *vertexBufferTile, Int color, Bool doArrow, Bool doDiamond);
Expand Down
9 changes: 9 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class EditAction : public CDialog

protected:
void formatScriptActionText(Int parmNdx);
void ParseHelpText(const CString& helpText);
protected:
ScriptAction *m_action;
Bool m_updating;
Expand All @@ -68,13 +69,21 @@ class EditAction : public CDialog
Int m_curEditParameter;
CTreeCtrl m_actionTreeView;

CFont m_treeFont;
CFont m_oldFont;
BOOL m_bCompressed;
protected:

// Generated message map functions
//{{AFX_MSG(EditAction)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeScriptActionType();
afx_msg void OnTimer(UINT nIDEvent);

afx_msg void OnCompress();
afx_msg void OnSearch();
afx_msg void OnReset();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
Expand Down
9 changes: 9 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class EditCondition : public CDialog

protected:
void formatConditionText(Int parmNdx);
void ParseHelpText(const CString& helpText);
protected:
Condition *m_condition;
Bool m_updating;
Expand All @@ -74,13 +75,21 @@ class EditCondition : public CDialog
Int m_curEditParameter;
CTreeCtrl m_conditionTreeView;

CFont m_treeFont;
CFont m_oldFont;
BOOL m_bCompressed;
protected:

// Generated message map functions
//{{AFX_MSG(EditCondition)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeConditionType();
afx_msg void OnTimer(UINT nIDEvent);

afx_msg void OnCompress();
afx_msg void OnSearch();
afx_msg void OnReset();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class EditParameter : public CDialog
static void loadConditionParameter(Script *pScr, Parameter::ParameterType type, CComboBox *pCombo);
static Bool loadActionParameter(Script *pScr, Parameter::ParameterType type, CComboBox *pCombo, AsciiString match);
static Bool loadFlags(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString);
static char* trimSpaces(char* str); // required for fixing the bug under command buttons extra spaces at the end - Adriane [Deathscythe]


protected:
Expand Down
10 changes: 9 additions & 1 deletion GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// FenceOptions.h : header file
//

#include "ObjectPreview.h"
#include "TerrainSwatches.h"
#include "OptionsPanel.h"
#include "Common/AsciiString.h"
Expand Down Expand Up @@ -53,9 +54,11 @@ class FenceOptions : public COptionsPanel
//{{AFX_VIRTUAL(FenceOptions)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless.
virtual void OnOK();
virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless.
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
void ExpandAllItems(CTreeCtrl& treeCtrl, HTREEITEM hItem);
virtual void OnShowWindow(BOOL bShow, UINT nStatus);
//}}AFX_VIRTUAL

// Implementation
Expand All @@ -65,6 +68,9 @@ class FenceOptions : public COptionsPanel
//{{AFX_MSG(FenceOptions)
virtual BOOL OnInitDialog();
afx_msg void OnChangeFenceSpacingEdit();
afx_msg void OnSearch();
afx_msg void OnReset();
afx_msg void OnCheckFenceOnly();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

Expand All @@ -77,8 +83,10 @@ class FenceOptions : public COptionsPanel
static Real m_fenceOffset;

CTreeCtrl m_objectTreeView;
ObjectPreview m_objectPreview;
MapObject *m_objectsList;
Bool m_customSpacing;
Bool m_showAllObjectTypes;

protected:
void addObject( MapObject *mapObject, const char *pPath, const char *name,
Expand Down
4 changes: 4 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class GroveOptions : public COptionsPanel
void _setDefaultNumTrees(void);
void _setDefaultPlacementAllowed(void);

void _loadSet(int setIndex);
void OnSaveSetName();
void OnSelchangeGroveSetName();

afx_msg void _updateTreeWeights(void);
afx_msg void _updateTreeCount(void);
afx_msg void _updateGroveMakeup(void);
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/Tools/WorldBuilder/include/GroveTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class GroveTool : public Tool
void plantTree( Coord3D *pos );
void plantShrub( Coord3D *pos );
void plantGrove( Coord3D pos, Coord3D prevDir, Real baseHeight, Int level, CPoint bounds );
void _plantGroveInBox(CPoint tl, CPoint br, WbView* pView);
void _plantGroveInBox(CPoint tl, CPoint br, WbView* pView, CWorldBuilderDoc *pDoc);

void addObj(Coord3D *pos, AsciiString name);
void activate();
Expand Down
10 changes: 7 additions & 3 deletions GeneralsMD/Code/Tools/WorldBuilder/include/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ class CMainFrame : public CFrameWnd
#endif

static CMainFrame *GetMainFrame() { return TheMainFrame; }

CWnd *m_curOptions;
int m_curDialogID;

void showOptionsDialog(Int dialogID);
void OnEditGloballightoptions();
void ResetWindowPositions(void);
void adjustWindowSize(void);
void adjustWindowSize(Bool forcedResolution = false, Bool dynamicResolution = false);
Bool isAutoSaving(void) {return m_autoSaving;};
void handleCameraChange(void);
void onEditScripts();
Expand Down Expand Up @@ -123,7 +125,6 @@ class CMainFrame : public CFrameWnd
ScriptDialog* m_scriptDialog;
RulerOptions m_rulerOptions;

CWnd *m_curOptions;
Int m_curOptionsX;
Int m_curOptionsY;
Int m_optionsPanelWidth;
Expand All @@ -132,6 +133,9 @@ class CMainFrame : public CFrameWnd
Int m_globalLightOptionsHeight;

Int m_3dViewWidth;
// Int m_newWidth;
// Int m_newHeight;
// Bool m_disableOnSize;

Bool m_autoSaving; ///< True if we are autosaving.
UINT m_hAutoSaveTimer; ///< Timer that triggers for autosave.
Expand Down
9 changes: 8 additions & 1 deletion GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class ObjectOptions : public COptionsPanel
//{{AFX_VIRTUAL(ObjectOptions)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless.
virtual void OnOK();
virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless.
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual void OnShowWindow(BOOL bShow, UINT nStatus);
//}}AFX_VIRTUAL

// Implementation
Expand All @@ -67,6 +68,8 @@ class ObjectOptions : public COptionsPanel
afx_msg void OnEditchangeOwningteam();
afx_msg void OnCloseupOwningteam();
afx_msg void OnSelchangeOwningteam();
afx_msg void OnSearch();
afx_msg void OnReset();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

Expand All @@ -81,11 +84,15 @@ class ObjectOptions : public COptionsPanel
CTreeCtrl m_objectTreeView;
MapObject *m_objectsList;
ObjectPreview m_objectPreview;
Bool m_objectsListModified;
// HTREEITEM m_lastFoundItem;

protected:
void addObject( MapObject *mapObject, const char *pPath,
Int objectNdx, HTREEITEM parent );
HTREEITEM findOrAdd(HTREEITEM parent, const char *pLabel);
// HTREEITEM getNextItem(HTREEITEM hItem);
void ExpandAllItems(CTreeCtrl& treeCtrl, HTREEITEM hItem);
HTREEITEM findOrDont(const char *pLabel);
HTREEITEM _FindOrDont(const char* pLabel, HTREEITEM startPoint);
Bool setObjectTreeViewSelection(HTREEITEM parent, Int selection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class PickUnitDialog : public CDialog
//{{AFX_MSG(PickUnitDialog)
virtual BOOL OnInitDialog();
afx_msg void OnMove(int x, int y);
afx_msg void OnIgnore(); // For the bypass feature - Adriane [Deathscythe]
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

Expand Down
12 changes: 12 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
//

#include "GameLogic/SidesList.h"
#include <afxtempl.h> // for CArray, CMap, etc -- please review this one

class ListType {
public:
Expand Down Expand Up @@ -113,6 +114,14 @@ class ScriptDialog : public CDialog

AsciiString m_readPlayerNames[MAX_PLAYER_COUNT];

CString m_searchText;
HTREEITEM m_lastFoundItem;

CFont m_treeFont;
CFont* m_pOldFont;
BOOL m_bCompressed;
BOOL m_bNewIcons;

protected:
HTREEITEM addPlayer(Int playerIndx);
void addScriptList(HTREEITEM hPlayer, Int playerIndex, ScriptList *pSL);
Expand Down Expand Up @@ -150,7 +159,10 @@ class ScriptDialog : public CDialog
afx_msg void OnDelete();
afx_msg void OnVerify();
afx_msg void OnPatchGC();
afx_msg void OnFindNext();
afx_msg void OnAutoVerify();
afx_msg void OnCompress();
afx_msg void OnNewIcons();
afx_msg void OnSave();
afx_msg void OnLoad();
afx_msg void OnDblclkScriptTree(NMHDR* pNMHDR, LRESULT* pResult);
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/TeamIdentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#if !defined(AFX_TEAMIDENTITY_H__B37DB2FD_297F_4D0E_AACD_193BE30C6C85__INCLUDED_)
#define AFX_TEAMIDENTITY_H__B37DB2FD_297F_4D0E_AACD_193BE30C6C85__INCLUDED_
#define UNIT_LOAD_TIMER 1001

#if _MSC_VER > 1000
#pragma once
Expand Down Expand Up @@ -54,6 +55,7 @@ class TeamIdentity : public CPropertyPage
protected:
Dict *m_teamDict;
SidesList *m_sides;
int unitLoadIndex; // Tracks which unit is being loaded
protected:
void loadUnitsInfo(int idcMinUnit, NameKeyType keyMinUnit,
int idcMaxUnit, NameKeyType keyMaxUnit,
Expand Down Expand Up @@ -92,6 +94,7 @@ class TeamIdentity : public CPropertyPage
afx_msg void OnKillfocusTeamName();
afx_msg void OnSelendokTeamowner();
afx_msg void OnChangeTeamBuildFrames();
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
Expand Down
4 changes: 4 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class CWB3dFrameWnd : public CMainFrame
// Generated message map functions
//{{AFX_MSG(CWB3dFrameWnd)
afx_msg void OnMove(int x, int y);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnWindowPreview1280x768();
afx_msg void OnUpdateWindowPreview1280x768(CCmdUI* pCmdUI);
afx_msg void OnWindowPreview1024x768();
afx_msg void OnUpdateWindowPreview1024x768(CCmdUI* pCmdUI);
afx_msg void OnWindowPreview640x480();
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class CWorldBuilderApp : public CWinApp
Int m_lockCurTool;

AsciiString m_currentDirectory; ///< Current directory for open file.
AsciiString m_gameDirectory; ///< Required for the jump to the game button - Adriane [Deathscythe].
BOOL m_bLaunchOnStartUp;

CDocTemplate *m_3dtemplate;

Expand Down Expand Up @@ -165,6 +167,7 @@ class CWorldBuilderApp : public CWinApp
/// Sets the current directry for file opens.
void setCurrentDirectory(AsciiString dir) {m_currentDirectory = dir;};

AsciiString getCurrentGameDirectory() { return m_gameDirectory; }
Tool *getCurTool() { return m_curTool; }

/// Check to see if any keyboard overrides are changing the current tool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class CWorldBuilderDoc : public CDocument
afx_msg void OnUpdateTsCanonical(CCmdUI* pCmdUI);
afx_msg void OnFileResize();
afx_msg void OnJumpToGame();
afx_msg void OnJumpToGameWithoutDebug();
afx_msg void OnTsRemap();
afx_msg void OnEditLinkCenters();
afx_msg void OnUpdateEditLinkCenters(CCmdUI* pCmdUI);
Expand Down
Loading