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 9 commits into
base: main
Choose a base branch
from
20 changes: 20 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 @@ -635,6 +644,11 @@ class Script : public MemoryPoolObject, public Snapshot
Real m_conditionTime; ///< Amount of time (cum) to evaluate conditions.
Real m_curTime; ///< Amount of time (cum) to evaluate conditions.
Int m_conditionExecutedCount; ///< Number of times conditions evaluated.

// Adriane [Deathscythe] Required for faster script validation
Bool m_dirty;
Bool m_warningUpdateToDate;


public:
Script();
Expand All @@ -644,6 +658,11 @@ class Script : public MemoryPoolObject, public Snapshot
const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const;

public:
void setDirty(Bool value) { m_dirty = value; }
Bool isDirty() const { return m_dirty; }
void setWarningsUpToDate(Bool value) { m_warningUpdateToDate = value; }
Bool areWarningsUpToDate() const { return m_warningUpdateToDate; }

void setName(AsciiString name) { m_scriptName = name;}
void setWarnings(Bool warnings) { m_hasWarnings = warnings;}
void setComment(AsciiString comment) { m_comment = comment;}
Expand Down Expand Up @@ -1062,6 +1081,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
28 changes: 19 additions & 9 deletions GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,16 @@ Int parseYRes(char *args[], int num)
return 1;
}

Int parseUseWaveEditor(char *args[], int num)
{
if (TheWritableGlobalData)
{
TheWritableGlobalData->m_usingWaterTrackEditor = TRUE;
}
return 1;
}


#if defined(_DEBUG) || defined(_INTERNAL)
//=============================================================================
//=============================================================================
Expand Down Expand Up @@ -527,14 +537,14 @@ Int parseNoStaticLOD(char *args[], int num)

//=============================================================================
//=============================================================================
Int parseUseWaveEditor(char *args[], int num)
{
if (TheWritableGlobalData)
{
TheWritableGlobalData->m_usingWaterTrackEditor = TRUE;
}
return 1;
}
// Int parseUseWaveEditor(char *args[], int num)
// {
// if (TheWritableGlobalData)
// {
// TheWritableGlobalData->m_usingWaterTrackEditor = TRUE;
// }
// return 1;
// }

//=============================================================================
//=============================================================================
Expand Down Expand Up @@ -1204,6 +1214,7 @@ static CommandLineParam params[] =
{ "-mod", parseMod },
{ "-noshaders", parseNoShaders },
{ "-quickstart", parseQuickStart },
{ "-useWaveEditor", parseUseWaveEditor },

#if (defined(_DEBUG) || defined(_INTERNAL))
{ "-noaudio", parseNoAudio },
Expand Down Expand Up @@ -1286,7 +1297,6 @@ static CommandLineParam params[] =
{ "-lowDetail", parseLowDetail },
{ "-noDynamicLOD", parseNoDynamicLOD },
{ "-noStaticLOD", parseNoStaticLOD },
{ "-useWaveEditor", parseUseWaveEditor },
{ "-fps", parseFPSLimit },
{ "-wireframe", parseWireframe },
{ "-showCollision", parseShowCollision },
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 @@ -920,6 +920,8 @@ m_conditionExecutedCount(0),
m_frameToEvaluateAt(0),
m_isSubroutine(false),
m_hasWarnings(false),
m_dirty(true),
m_warningUpdateToDate(false),
m_nextScript(NULL),
m_condition(NULL),
m_action(NULL),
Expand Down Expand Up @@ -1979,7 +1981,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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
extern void W3DLogicalScreenToPixelScreen( Real logX, Real logY,
Int *screenX, Int *screenY,
Int screenWidth, Int screenHeight );
extern void W3DLogicalScreenToPixelScreenHackedForWBLabels( Real logX, Real logY,
Int *screenX, Int *screenY,
Int screenWidth, Int screenHeight
);
extern void PixelScreenToW3DLogicalScreen( Int screenX, Int screenY,
Real *logX, Real *logY,
Int screenWidth, Int screenHeight );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class BaseHeightMapRenderObjClass : public RenderObjClass, public DX8_CleanupHoo
void removeTree(DrawableID id);
Bool updateTreePosition(DrawableID id, Coord3D location, Real angle);
void renderTrees(CameraClass * camera); ///< renders the tree buffer.

void removeAllRoads(void);

void addProp(Int id, Coord3D location, Real angle, Real scale, const AsciiString &modelName);
void removeProp(Int id);
Expand Down Expand Up @@ -200,6 +202,7 @@ class BaseHeightMapRenderObjClass : public RenderObjClass, public DX8_CleanupHoo
void updateViewImpassableAreas(Bool partial = FALSE, Int minX = 0, Int maxX = 0, Int minY = 0, Int maxY = 0);
void clearAllScorches(void);
void setTimeOfDay( TimeOfDay tod );
void loadRoadsOnly(); ///< Load the roads from the map objects.
void loadRoadsAndBridges(W3DTerrainLogic *pTerrainLogic, Bool saveGame); ///< Load the roads from the map objects.
void worldBuilderUpdateBridgeTowers( W3DAssetManager *assetManager, SimpleSceneClass *scene ); ///< for the editor updating of bridge tower visuals
Int getStaticDiffuse(Int x, Int y); ///< Gets the diffuse terrain lighting value for a point on the mesh.
Expand All @@ -210,6 +213,10 @@ class BaseHeightMapRenderObjClass : public RenderObjClass, public DX8_CleanupHoo
Bool getMaximumVisibleBox(const FrustumClass &frustum, AABoxClass *box, Bool ignoreMaxHeight); ///<3d extent of visible terrain.
Real getHeightMapHeight(Real x, Real y, Coord3D* normal) const; ///<return height and normal at given point
Bool isCliffCell(Real x, Real y); ///<return height and normal at given point
Bool isBadBuildLocation(Real x, Real y, Real angle, Real halfSizeX, Real halfSizeY);
Bool pleaseHelpMeIamUnderTheWata(Real x, Real y);
Real getWaterHeightIfUnderwater(Real x, Real y);
W3DBridgeBuffer* getBridgeBuffer() const { return m_bridgeBuffer; }
Real getMinHeight(void) const {return m_minHeight;} ///<return minimum height of entire terrain
Real getMaxHeight(void) const {return m_maxHeight;} ///<return maximum height of entire terrain
Real getMaxCellHeight(Real x, Real y) const; ///< returns maximum height of the 4 cell corners.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "Common/GameType.h"
#include "Common/Dict.h"
#include "Common/AsciiString.h"
#include "Common/MapObject.h"

//-----------------------------------------------------------------------------
// Forward References
Expand Down Expand Up @@ -167,6 +168,8 @@ friend class BaseHeightMapRenderObjClass;
enum { MAX_BRIDGE_VERTEX=12000, //make sure it stays under 65535
MAX_BRIDGE_INDEX=2*MAX_BRIDGE_VERTEX, //make sure it stays under 65535
MAX_BRIDGES=200};

BridgeInfo getBridgeInfoFromMapObject(MapObject *bridgePoint1, MapObject *bridgePoint2);
protected:
DX8VertexBufferClass *m_vertexBridge; ///<Bridge vertex buffer.
DX8IndexBufferClass *m_indexBridge; ///<indices defining a triangles for the bridge drawing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ class WorldHeightMap : public RefCountClass,
STRETCH_DRAW_HEIGHT = 65
};

// We need to expose this for the blending of textures for copy mode
Short *m_extraBlendTileNdxes; ///< matches m_Data, indexes into m_extraBlendedTiles. 0 means no blend info.
Short *m_blendTileNdxes; ///< matches m_Data, indexes into m_blendedTiles. 0 means no blend info.

protected:
Int m_width; ///< Height map width.
Int m_height; ///< Height map height (y size of array).
Expand All @@ -133,10 +137,7 @@ class WorldHeightMap : public RefCountClass,

/// Texture indices.
Short *m_tileNdxes; ///< matches m_Data, indexes into m_SourceTiles.
Short *m_blendTileNdxes; ///< matches m_Data, indexes into m_blendedTiles. 0 means no blend info.
Short *m_cliffInfoNdxes; ///< matches m_Data, indexes into m_cliffInfo. 0 means no cliff info.
Short *m_extraBlendTileNdxes; ///< matches m_Data, indexes into m_extraBlendedTiles. 0 means no blend info.


Int m_numBitmapTiles; // Number of tiles initialized from bitmaps in m_SourceTiles.
Int m_numEdgeTiles; // Number of tiles initialized from bitmaps in m_SourceTiles.
Expand Down Expand Up @@ -254,6 +255,9 @@ class WorldHeightMap : public RefCountClass,
return(0);
};

inline Int getStoredWidth() const {return m_width; }
inline Int getStoredHeight() const {return m_height; }

void getUVForBlend(Int edgeClass, Region2D *range);

Bool setDrawOrg(Int xOrg, Int yOrg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ void W3DLogicalScreenToPixelScreen( Real logX, Real logY,

} // end W3DLogicalScreenToPixelScreen

/**
* Adriane [Deathscythe] -- Bug fix
* I dont want to brick the old one so i created this one instead for backwards compatibility
* and since it also only edit the ui labels postions
*/
void W3DLogicalScreenToPixelScreenHackedForWBLabels( Real logX, Real logY,
Int *screenX, Int *screenY,
Int screenWidth, Int screenHeight )
{
*screenX = REAL_TO_INT((screenWidth * (logX + 1.0f)) / 2.0f);
*screenY = REAL_TO_INT((screenHeight * (-logY + 1.0f)) /1.85f);
}
//=============================================================================
// PixelScreenToW3DLogicalScreen
//=============================================================================
Expand Down
Loading