1.4 and RTS compiled and working
by Unsung Zero · in RTS Starter Kit · 01/19/2006 (5:32 am) · 32 replies
I've gotten the RTS pack to compile with TGE 1.4. Below is what is needed to add or change in order for it to
compile correctly. This _does not_ include the community release for terrain deformation or other things. It is just
a port of the starter kit from 1.3 to 1.4. If you do incorporate the community snippets into 1.4, please share them
here.
First, copy over the files from the 1.3 RTS starter kit in \engine\game\RTS over to \engine\game\RTS
in your 1.4 source. Make sure to add them to your project file.
Next, copy over \engine\terrain\terrSelection.cc to the corresponding location in your 1.4 source. Again,
make sure to add it to your project.
In engine\game\gameProcess.cc
Find
Find
Find
In file \engine\game\shapeBase.h
Find
compile correctly. This _does not_ include the community release for terrain deformation or other things. It is just
a port of the starter kit from 1.3 to 1.4. If you do incorporate the community snippets into 1.4, please share them
here.
First, copy over the files from the 1.3 RTS starter kit in \engine\game\RTS over to \engine\game\RTS
in your 1.4 source. Make sure to add them to your project file.
Next, copy over \engine\terrain\terrSelection.cc to the corresponding location in your 1.4 source. Again,
make sure to add it to your project.
In engine\game\gameProcess.cc
Find
#include "core/dnet.h" #include "game/gameConnection.h" #include "game/gameBase.h" #include "game/shapeBase.h" #include "platform/profiler.h" #include "console/consoleTypes.h"and add below it
#include "game/RTS/visManager.h"
Find
mLastTime = targetTime; PROFILE_END(); return ret;and change it to
mLastTime = targetTime; gServerVisManager->processServer(); PROFILE_END(); return ret;
Find
mLastTime = targetTime; PROFILE_END(); return tickCount != 0;And change it to
mLastTime = targetTime; gClientVisManager->processClient(); PROFILE_END(); return tickCount != 0;
In file \engine\game\shapeBase.h
Find
typedef GameBase Parent; friend class ShapeBaseConvex; friend class ShapeBaseImageData; friend void physicalZoneFind(SceneObject*, void *);And replace it with
typedef GameBase Parent; friend class ShapeBaseConvex; friend class ShapeBaseImageData; friend class RTSUnit; friend void physicalZoneFind(SceneObject*, void *);
About the author
#2
Find
Find
Find
Find
Find
01/19/2006 (5:33 am)
In file \engine\terrain\terrRender.ccFind
static LightTriangle* sgCurrLightTris = NULL; GBitmap* TerrainRender::mBlendBitmap = NULL; S32 TerrainRender::mTextureMinSquareSize;And replace it with
static LightTriangle* sgCurrLightTris = NULL; static LightTriangle* sgCurrSelectionTris = NULL; GBitmap* TerrainRender::mBlendBitmap = NULL; S32 TerrainRender::mTextureMinSquareSize;
Find
void TerrainRender::emitTerrChunk(SquareStackNode *n, F32 squareDistance, U32 lightMask, bool farClip, bool
drawDetails, bool drawBumps)
{
//if(n->pos.x || n->pos.y)
// return;
GridChunk *gc = mCurrentBlock->findChunk(n->pos);
EmitChunk *chunk = (EmitChunk *) FrameAllocator::alloc(sizeof(EmitChunk));
chunk->x = n->pos.x + mBlockOffset.x + mTerrainOffset.x;
chunk->y = n->pos.y + mBlockOffset.y + mTerrainOffset.y;
chunk->gridX = n->pos.x;
chunk->gridY = n->pos.y;
chunk->lightMask = lightMask;And replace it withvoid TerrainRender::emitTerrChunk(SquareStackNode *n, F32 squareDistance, U32 lightMask, SelectionField
selectionMask, bool farClip, bool drawDetails, bool drawBumps)
{
//if(n->pos.x || n->pos.y)
// return;
GridChunk *gc = mCurrentBlock->findChunk(n->pos);
EmitChunk *chunk = (EmitChunk *) FrameAllocator::alloc(sizeof(EmitChunk));
chunk->x = n->pos.x + mBlockOffset.x + mTerrainOffset.x;
chunk->y = n->pos.y + mBlockOffset.y + mTerrainOffset.y;
chunk->gridX = n->pos.x;
chunk->gridY = n->pos.y;
chunk->lightMask = lightMask;
chunk->selectionMask = selectionMask;Find
stack[0].level = TerrainBlock::BlockShift; stack[0].clipFlags = ((1 << mNumClipPlanes) - 1) | FarSphereMask; // test all the planes stack[0].pos.set(0,0); stack[0].top = topEdge; stack[0].right = rightEdge; stack[0].bottom = bottomEdge; stack[0].left = leftEdge; stack[0].lightMask = (1 << mDynamicLightCount) - 1; // test all the lights stack[0].texAllocated = false;And replace it with
stack[0].level = TerrainBlock::BlockShift; stack[0].clipFlags = ((1 << mNumClipPlanes) - 1) | FarSphereMask; // test all the planes stack[0].pos.set(0,0); stack[0].top = topEdge; stack[0].right = rightEdge; stack[0].bottom = bottomEdge; stack[0].left = leftEdge; stack[0].lightMask = (1 << mDynamicLightCount) - 1; // test all the lights for (U32 k = 0; k < mDynamicSelectionCount; k++) stack[0].selectionMask.set(k); stack[0].texAllocated = false;
Find
if(mRenderingCommander) // level == 6
{
emitTerrChunk(n, 0, 0, 0, 0, 0);
curStackSize--;
continue;
}
}
notexalloc:
if(n->lightMask)
n->lightMask = TestSquareLights(sq, n->level, n->pos, n->lightMask);
if(n->level == 2)
{
AssertFatal(n->texAllocated, "Invalid texture index.");
bool drawDetails = false;
if (mEnableTerrainDetails && squareDistance < zeroDetailDistance)
drawDetails = true;
//END
bool drawBumps = false;
// CW - stuff with bump maps
if (mEnableTerrainEmbossBumps && squareDistance < zeroBumpDistance)
drawBumps = true;
// CW - end bump map stuff
emitTerrChunk(n, squareDistance, n->lightMask, nextClipFlags & FarSphereMask, drawDetails, drawBumps);
curStackSize--;
continue;And replace it withif(mRenderingCommander) // level == 6
{
emitTerrChunk(n, 0, 0, SelectionField(), 0, 0, 0);
curStackSize--;
continue;
}
}
notexalloc:
if(n->lightMask)
n->lightMask = TestSquareLights(sq, n->level, n->pos, n->lightMask);
if (n->selectionMask)
n->selectionMask = TestSquareSelections(sq, n->level, n->pos, n->selectionMask);
if(n->level == 2)
{
AssertFatal(n->texAllocated, "Invalid texture index.");
bool drawDetails = false;
if (mEnableTerrainDetails && squareDistance < zeroDetailDistance)
drawDetails = true;
//END
bool drawBumps = false;
// CW - stuff with bump maps
if (mEnableTerrainEmbossBumps && squareDistance < zeroBumpDistance)
drawBumps = true;
// CW - end bump map stuff
emitTerrChunk(n, squareDistance, n->lightMask, n->selectionMask, nextClipFlags & FarSphereMask,
drawDetails, drawBumps);
curStackSize--;
continue;Find
for(S32 i = 1; i < 4; i++)
{
n[i].level = nextLevel;
n[i].clipFlags = nextClipFlags;
n[i].lightMask = n->lightMask;
n[i].texAllocated = n->texAllocated;And replace it withfor(S32 i = 1; i < 4; i++)
{
n[i].level = nextLevel;
n[i].clipFlags = nextClipFlags;
n[i].lightMask = n->lightMask;
n[i].selectionMask = n->selectionMask;
n[i].texAllocated = n->texAllocated;
#3
Find
Find
01/19/2006 (5:34 am)
FindpTri->flags = 1;
}
void TerrainRender::renderChunkCommander(EmitChunk *chunk)
{Replace it withpTri->flags = 1;
}
void buildSelectionTri(LightTriangle* pTri, TerrSelectionInfo* pInfo)
{
// Get the plane normal
Point3F normal;
mCross((pTri->point1 - pTri->point2), (pTri->point3 - pTri->point2), &normal);
if (normal.lenSquared() < 1e-7)
{
pTri->flags = 0;
return;
}
PlaneF plane(pTri->point2, normal); // Assumes that mPlane.h normalizes incoming point
Point3F centerPoint;
F32 d = plane.distToPlane(pInfo->pos);
centerPoint = pInfo->pos - plane * d;
d = mFabs(d);
if (d >= pInfo->radius) {
pTri->flags = 0;
return;
}
F32 mr = mSqrt(pInfo->radiusSquared - d*d);
Point3F normalS;
Point3F normalT;
mCross(plane, Point3F(0, 1, 0), &normalS);
mCross(plane, normalS, &normalT);
PlaneF splane(centerPoint, normalS); // Assumes that mPlane.h normalizes incoming point
PlaneF tplane(centerPoint, normalT); // Assumes that mPlane.h normalizes incoming point
pTri->color.red = pInfo->r;
pTri->color.green = pInfo->g;
pTri->color.blue = pInfo->b;
pTri->color.alpha = 0.9;
pTri->texco1.set(((splane.distToPlane(pTri->point1) / mr) + 1.0) / 2.0,
((tplane.distToPlane(pTri->point1) / mr) + 1.0) / 2.0);
pTri->texco2.set(((splane.distToPlane(pTri->point2) / mr) + 1.0) / 2.0,
((tplane.distToPlane(pTri->point2) / mr) + 1.0) / 2.0);
pTri->texco3.set(((splane.distToPlane(pTri->point3) / mr) + 1.0) / 2.0,
((tplane.distToPlane(pTri->point3) / mr) + 1.0) / 2.0);
pTri->flags = 1;
}
void TerrainRender::renderChunkCommander(EmitChunk *chunk)
{Find
start += count;
}
}
}
}
}And replace it withstart += count;
}
}
}
}
// Do dynamic selections here...
if (chunk->selectionMask) {
for (U32 i = 0; i < MaxTerrainSelections; i++) {
if (!chunk->selectionMask.test(i))
continue;
for (U32 start = startXFIndex; start < mXFIndexCount; start++) {
if (mXFIndexBuffer[start] == GL_TRIANGLE_FAN) {
start++;
U32 count = mXFIndexBuffer[start];
U32 triCount = count - 2;
LightTriangle* selectionTris = (LightTriangle*)FrameAllocator::alloc(sizeof(LightTriangle) *
triCount);
U32 j;
for (j = 0; j < (triCount-1); j++)
selectionTris[j].next = &selectionTris[j+1];
selectionTris[triCount-1].next = sgCurrSelectionTris;
sgCurrSelectionTris = selectionTris;
// Copy out tri data here...
for (j = 0; j < triCount; j++) {
selectionTris[j].point1 = mXFVertices[mXFIndexBuffer[start + 1 + 0]];
selectionTris[j].point2 = mXFVertices[mXFIndexBuffer[start + 1 + j + 1]];
selectionTris[j].point3 = mXFVertices[mXFIndexBuffer[start + 1 + j + 2]];
buildSelectionTri(&selectionTris[j], &mTerrainSelections[i]);
}
start += count;
} else {
AssertFatal(mXFIndexBuffer[start] == GL_TRIANGLES, "Error, bad start code!");
start++;
U32 count = mXFIndexBuffer[start];
AssertFatal((count / 3) * 3 == count, "Error, vertex count not divisible by 3!");
U32 triCount = count/3;
LightTriangle* selectionTris = (LightTriangle*)FrameAllocator::alloc(sizeof(LightTriangle) *
triCount);
U32 j;
for (j = 0; j < (triCount-1); j++)
selectionTris[j].next = &selectionTris[j+1];
selectionTris[triCount-1].next = sgCurrSelectionTris;
sgCurrLightTris = selectionTris;
// Copy out tri data here...
for (j = 0; j < triCount; j++) {
selectionTris[j].point1 = mXFVertices[mXFIndexBuffer[start + 1 + (j*3) + 0]];
selectionTris[j].point2 = mXFVertices[mXFIndexBuffer[start + 1 + (j*3) + 1]];
selectionTris[j].point3 = mXFVertices[mXFIndexBuffer[start + 1 + (j*3) + 2]];
buildSelectionTri(&selectionTris[j], &mTerrainSelections[i]);
}
start += count;
}
}
}
}
}Find
Point3F sTangent,tTangent;
VectorF sunVector = gClientSceneGraph->getLightManager()->getShadowLightDirection();Replace it with Point3F sTangent,tTangent;
static Vector<LightInfo*> lights;
lights.clear();
gClientSceneGraph->getLightManager()->getLights(lights);
VectorF sunVector = -lights[0]->mDirection; //first light is always sun
#4
And replace it with
Find this
Find this
In file \engine\terrain\terrRender.h
Find
01/19/2006 (5:34 am)
Find codebuildClippingPlanes(state->mFlipCull); buildLightArray();
And replace it with
buildClippingPlanes(state->mFlipCull); buildLightArray(); buildSelectionArray();
Find this
mXFIndex = 0; sgCurrLightTris = NULL; AllocatedTexture *walk; mXFIndexBuffer = (U16 *) FrameAllocator::alloc(sizeof(U16) * 64 * 64 * 4);And replace it with this
mXFIndex = 0; sgCurrLightTris = NULL; sgCurrSelectionTris = NULL; AllocatedTexture *walk; mXFIndexBuffer = (U16 *) FrameAllocator::alloc(sizeof(U16) * 64 * 64 * 4);
Find this
glDisable(GL_CULL_FACE); FrameAllocator::setWaterMark(storedWaterMark); dglSetRenderPrimType(0); PROFILE_END(); PROFILE_END(); }And replace it with
if (sgCurrSelectionTris) {
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, mCurrentBlock->mSelectionTexture.getGLName());
LightTriangle* walk = sgCurrSelectionTris;
glDisable(GL_CULL_FACE);
} //This parenthesis was missing :]
FrameAllocator::setWaterMark(storedWaterMark);
dglSetRenderPrimType(0);
PROFILE_END();
PROFILE_END();
}In file \engine\terrain\terrRender.h
Find
struct ChunkEdge : public EdgeParent
{
U32 xfIndex;
U32 pointIndex;
U32 pointCount;
EdgePoint pt[3];
EmitChunk *c1, *c2;
};
struct EmitChunk
{
ChunkEdge *edge[4];
S32 subDivLevel;
F32 growFactor;
S32 x, y;
S32 gridX, gridY;
U32 emptyFlags;
bool clip;
U32 lightMask;
EmitChunk *next;And replace it withstruct ChunkEdge : public EdgeParent
{
U32 xfIndex;
U32 pointIndex;
U32 pointCount;
EdgePoint pt[3];
EmitChunk *c1, *c2;
};
enum TerrSelectionConstants {
MaxTerrainSelections = 256,
SelectionInts = (MaxTerrainSelections - 1) / 32 + 1,
};
struct SelectionField
{
U32 mBits[SelectionInts];
SelectionField()
{
clear();
}
SelectionField(const SelectionField& field)
{
*this = field;
}
bool test(U32 index)
{
//no checking for out of bounds for performance reasons...
U32 word = index / 32;
U32 bit = index % 32;
return mBits[word] & (1 << bit);
}
void set(U32 index)
{
U32 word = index / 32;
U32 bit = index % 32;
mBits[word] |= 1 << bit;
}
void clear()
{
for (U32 k = 0; k < SelectionInts; k++)
{
mBits[k] = 0x00000000;
}
}
bool isEmpty()
{
for (U32 k = 0; k < SelectionInts; k++)
{
if (mBits[k])
return false;
}
return true;
}
SelectionField& operator=(const SelectionField& field)
{
for (U32 k = 0; k < SelectionInts; k++)
{
mBits[k] = field.mBits[k];
}
return *this;
}
operator bool()
{
return !isEmpty();
}
};
struct EmitChunk
{
ChunkEdge *edge[4];
S32 subDivLevel;
F32 growFactor;
S32 x, y;
S32 gridX, gridY;
U32 emptyFlags;
bool clip;
U32 lightMask;
SelectionField selectionMask;
EmitChunk *next;
#5
And finally find near the bottom
And replace it with
I'm sure there will be an error or two somewhere (I'm rather tired atm) so If you see anything that doesn't look
right, post it here and I'll update this post.
Brought to you by the music of "Infected Mushroom" and the letter "Q".
01/19/2006 (5:34 am)
Next, findstruct SquareStackNode
{
U32 clipFlags;
U32 lightMask;
Point2I pos;
U32 level;
bool texAllocated;
EdgeParent *top, *right, *bottom, *left;
};
struct TerrLightInfo
{
Point3F pos; ///< world position
F32 radius; ///< radius of the light
F32 radiusSquared; ///< radius^2
F32 r, g, b;
F32 distSquared; // distance to camera
};And replace it withstruct SquareStackNode
{
U32 clipFlags;
U32 lightMask;
SelectionField selectionMask;
Point2I pos;
U32 level;
bool texAllocated;
EdgeParent *top, *right, *bottom, *left;
};
struct TerrLightInfo
{
Point3F pos; ///< world position
F32 radius; ///< radius of the light
F32 radiusSquared; ///< radius^2
F32 r, g, b;
F32 distSquared; // distance to camera
};
struct TerrSelectionInfo
{
Point3F pos; ///< world position
F32 radius; ///< radius of the light
F32 radiusSquared; ///< radius^2
F32 r, g, b;
F32 distSquared; // distance to camera
};And finally find near the bottom
static PlaneF mClipPlane[MaxClipPlanes];
static Point3F mCamPos;
static TextureHandle* mGrainyTexture;
static U32 mDynamicLightCount;
static bool mEnableTerrainDetails;
static bool mEnableTerrainEmbossBumps;
static bool mEnableTerrainDynLights;
static F32 mPixelError;
#ifdef TORQUE_OS_WIN32
//only need this in win32
static bool mRenderGL;
#endif
static TerrLightInfo mTerrainLights[MaxTerrainLights];
static F32 mScreenError;
static F32 mMinSquareSize;
static F32 mFarDistance;
static S32 mDynamicTextureCount;
static S32 mStaticTextureCount;
static bool mRenderingCommander;
static ColorF mFogColor;
static bool mRenderOutline;
static U32 mMaterialCount;
static GBitmap* mBlendBitmap;
static void init();
static void shutdown();
static void allocRenderEdges(U32 edgeCount, EdgeParent **dest, bool renderEdge);
static void subdivideChunkEdge(ChunkScanEdge *e, Point2I pos, bool chunkEdge);
static void processCurrentBlock(SceneState* state, EdgeParent *topEdge, EdgeParent *rightEdge, EdgeParent
*bottomEdge, EdgeParent *leftEdge);
static ChunkCornerPoint *allocInitialPoint(Point3F pos);
static ChunkCornerPoint *allocPoint(Point2I pos);
static void emitTerrChunk(SquareStackNode *n, F32 squareDistance, U32 lightMask, bool farClip, bool useDetails,
bool useBumps);
static void renderChunkOutline(EmitChunk *chunk);
static void renderChunkCommander(EmitChunk *chunk);
static void fixEdge(ChunkEdge *edge, S32 x, S32 y, S32 dx, S32 dy);
static U32 constructPoint(S32 x, S32 y);
static U32 interpPoint(U32 p1, U32 p2, S32 x, S32 y, F32 growFactor);
static void addEdge(ChunkEdge *edge);
static void clip(U32 triFanStart);
static F32 getScreenError() { return(mScreenError); }
static void setScreenError(F32 error) { mScreenError = error; }
static void flushCache();
static void flushCacheRect(RectI rect);
static void allocTerrTexture(Point2I pos, U32 level, U32 mipLevel, bool vis, F32 distance);
static void freeTerrTexture(AllocatedTexture *texture);
static void buildBlendMap(AllocatedTexture *texture);
static U32 TestSquareLights(GridSquare *sq, S32 level, Point2I pos, U32 lightMask);
static S32 TestSquareVisibility(Point3F &min, Point3F &max, S32 clipMask, F32 expand);
static void subdivideEdge(S32 edge, Point2I pos);
static F32 getSquareDistance(const Point3F& minPoint, const Point3F& maxPoint,
F32* zDiff);
//GL bumps is faster - uses multitexturing and adds 1 small pass
static void renderGLBumps(Point2F bumpTextureOffset, U32 hazeName);
#ifdef TORQUE_OS_WIN32
//D3D bumps is slower - adds 2 small passes
//no need for a D3D render function when not on windows
static void renderD3DBumps(Point2F bumpTextureOffset);
#endif
static void buildLightArray();
static void buildClippingPlanes(bool flipClipPlanes);
static void buildDetailTable();
static void renderXFCache();
static void renderBlock(TerrainBlock *, SceneState *state);
};And replace it with
static PlaneF mClipPlane[MaxClipPlanes];
static Point3F mCamPos;
static TextureHandle* mGrainyTexture;
static U32 mDynamicLightCount;
static U32 mDynamicSelectionCount;
static bool mEnableTerrainDetails;
static bool mEnableTerrainEmbossBumps;
static bool mEnableTerrainDynLights;
static F32 mPixelError;
#ifdef TORQUE_OS_WIN32
//only need this in win32
static bool mRenderGL;
#endif
static TerrLightInfo mTerrainLights[MaxTerrainLights];
static TerrSelectionInfo mTerrainSelections[MaxTerrainSelections];
static F32 mScreenError;
static F32 mMinSquareSize;
static F32 mFarDistance;
static S32 mDynamicTextureCount;
static S32 mStaticTextureCount;
static bool mRenderingCommander;
static ColorF mFogColor;
static bool mRenderOutline;
static U32 mMaterialCount;
static GBitmap* mBlendBitmap;
static void init();
static void shutdown();
static void allocRenderEdges(U32 edgeCount, EdgeParent **dest, bool renderEdge);
static void subdivideChunkEdge(ChunkScanEdge *e, Point2I pos, bool chunkEdge);
static void processCurrentBlock(SceneState* state, EdgeParent *topEdge, EdgeParent *rightEdge, EdgeParent
*bottomEdge, EdgeParent *leftEdge);
static ChunkCornerPoint *allocInitialPoint(Point3F pos);
static ChunkCornerPoint *allocPoint(Point2I pos);
static void emitTerrChunk(SquareStackNode *n, F32 squareDistance, U32 lightMask, SelectionField selectionMask,
bool farClip, bool useDetails, bool useBumps);
static void renderChunkOutline(EmitChunk *chunk);
static void renderChunkCommander(EmitChunk *chunk);
static void fixEdge(ChunkEdge *edge, S32 x, S32 y, S32 dx, S32 dy);
static U32 constructPoint(S32 x, S32 y);
static U32 interpPoint(U32 p1, U32 p2, S32 x, S32 y, F32 growFactor);
static void addEdge(ChunkEdge *edge);
static void clip(U32 triFanStart);
static F32 getScreenError() { return(mScreenError); }
static void setScreenError(F32 error) { mScreenError = error; }
static void flushCache();
static void flushCacheRect(RectI rect);
static void allocTerrTexture(Point2I pos, U32 level, U32 mipLevel, bool vis, F32 distance);
static void freeTerrTexture(AllocatedTexture *texture);
static void buildBlendMap(AllocatedTexture *texture);
static U32 TestSquareLights(GridSquare *sq, S32 level, Point2I pos, U32 lightMask);
static SelectionField TestSquareSelections(GridSquare *sq, S32 level, Point2I sqPos, SelectionField
selectionMask);
static S32 TestSquareVisibility(Point3F &min, Point3F &max, S32 clipMask, F32 expand);
static void subdivideEdge(S32 edge, Point2I pos);
static F32 getSquareDistance(const Point3F& minPoint, const Point3F& maxPoint,
F32* zDiff);
//GL bumps is faster - uses multitexturing and adds 1 small pass
static void renderGLBumps(Point2F bumpTextureOffset, U32 hazeName);
#ifdef TORQUE_OS_WIN32
//D3D bumps is slower - adds 2 small passes
//no need for a D3D render function when not on windows
static void renderD3DBumps(Point2F bumpTextureOffset);
#endif
static void buildLightArray();
static void buildSelectionArray();
static void addSelection(U32 index, SceneObject* obj, ColorF color);
static void buildClippingPlanes(bool flipClipPlanes);
static void buildDetailTable();
static void renderXFCache();
static void renderBlock(TerrainBlock *, SceneState *state);
};I'm sure there will be an error or two somewhere (I'm rather tired atm) so If you see anything that doesn't look
right, post it here and I'll update this post.
Brought to you by the music of "Infected Mushroom" and the letter "Q".
#6
01/19/2006 (3:00 pm)
Got it compiled with the code below and yours. The RTS selection decal still doesn't seem to work, not sure if that was supposed to be fixed with your code?
#7
The code above does not fix this. It only allows you to use the RTS pack with TGE 1.4. Which is better than not having it for 1.4.
I'll work on incorporating fixes and add-ons this weekend, and will update the posts above.
I'm not 100% sure that my "stock" 1.4 I compared against really was stock. It may have had the bit to BIT changes in it. what changes did you need from the other posts to get this working?
01/19/2006 (5:06 pm)
The selection decal location is hardcoded (Don't ask me why). There is a simple fix for this up somewhere in the RTS forums. The code above does not fix this. It only allows you to use the RTS pack with TGE 1.4. Which is better than not having it for 1.4.
I'll work on incorporating fixes and add-ons this weekend, and will update the posts above.
I'm not 100% sure that my "stock" 1.4 I compared against really was stock. It may have had the bit to BIT changes in it. what changes did you need from the other posts to get this working?
#8
01/19/2006 (5:43 pm)
Thanks for posting this - I just bought the RTS pack yesterday and was looking for such a post to upgrade it to 1.4 :)
#9
Rodney - I'm in the same boat, bought it yesterday and posted last night and now this. Quick results :)
Thanks again Unsung.
01/19/2006 (7:00 pm)
Unsung Zero - Everything seems to be working other than the selection.Rodney - I'm in the same boat, bought it yesterday and posted last night and now this. Quick results :)
Thanks again Unsung.
#10
When I did the merge I marged each merge point pretty carefully to aid future merging.
I think the selection error is because of a missing code merge in TerrainRender::processCurrentBlock
Here is what I have:
-Jerry
01/25/2006 (12:22 am)
I have 1.4 and the RTS merged in my code base as well.. Everything works fine.When I did the merge I marged each merge point pretty carefully to aid future merging.
I think the selection error is because of a missing code merge in TerrainRender::processCurrentBlock
Here is what I have:
void TerrainRender::processCurrentBlock(SceneState*, EdgeParent *topEdge, EdgeParent *rightEdge, EdgeParent *bottomEdge, EdgeParent *leftEdge)
{
SquareStackNode stack[TerrainBlock::BlockShift*4];
Point3F minPoint, maxPoint;
stack[0].level = TerrainBlock::BlockShift;
stack[0].clipFlags = ((1 << mNumClipPlanes) - 1) | FarSphereMask; // test all the planes
stack[0].pos.set(0,0);
stack[0].top = topEdge;
stack[0].right = rightEdge;
stack[0].bottom = bottomEdge;
stack[0].left = leftEdge;
stack[0].lightMask = (1 << mDynamicLightCount) - 1; // test all the lights
// JAS:START:RTSKit code
for (U32 k = 0; k < mDynamicSelectionCount; k++)
stack[0].selectionMask.set(k);
// JAS:END:RTSKit code
stack[0].texAllocated = false;-Jerry
#11
02/07/2006 (9:57 pm)
If anyone is still having selection circle issues. After applying the changes so graciously provided above, in terrRender.cc findif (sgCurrSelectionTris) {
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, mCurrentBlock->mSelectionTexture.getGLName());
LightTriangle* walk = sgCurrSelectionTris;
glDisable(GL_CULL_FACE);
} //This parenthesis was missing :]replace with//selections...
if (sgCurrSelectionTris) {
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, mCurrentBlock->mSelectionTexture.getGLName());
LightTriangle* walk = sgCurrSelectionTris;
glBegin(GL_TRIANGLES);
while (walk) {
if (walk->flags) {
glColor4fv(walk->color);
glTexCoord2fv(walk->texco1);
glVertex3fv(walk->point1);
glColor4fv(walk->color);
glTexCoord2fv(walk->texco2);
glVertex3fv(walk->point2);
glColor4fv(walk->color);
glTexCoord2fv(walk->texco3);
glVertex3fv(walk->point3);
}
walk = walk->next;
}
glEnd();
glDisable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDisable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ZERO);
}
glDisable(GL_CULL_FACE);
#12
02/09/2006 (6:32 pm)
I used the following that didnt seam to work when I used it I got large green squares and not circles Quote:but I found that changing the code from
In file \engine\terrain\terrData.cc
Find
mTextureCallbackKey = TextureManager::registerEventCallback(terrainTextureEventCB, this); mDynLightTexture = TextureHandle("common/lighting/lightFalloffMono", BitmapTexture, true); if (dglDoesSupportVertexBuffer()) mVertexBuffer = glAllocateVertexBufferEXT(VertexBufferSize,GL_V12MTVFMT_EXT,true); else mVertexBuffer = -1;
And replace it with
mTextureCallbackKey = TextureManager::registerEventCallback(terrainTextureEventCB, this); mDynLightTexture = TextureHandle("common/lighting/lightFalloffMono", BitmapTexture, true); mSelectionTexture = TextureHandle("starter.RTS/ui/ring_white", BitmapTexture, true); if (dglDoesSupportVertexBuffer()) mVertexBuffer = glAllocateVertexBufferEXT(VertexBufferSize,GL_V12MTVFMT_EXT,true); else mVertexBuffer = -1;
mSelectionTexture = TextureHandle("starter.RTS/ui/ring_white", BitmapTexture, true);tomSelectionTexture = TextureHandle("starter.RTS/client/ui/ring_white", BitmapTexture, true);fixed the problem.. its just a simple texture location problem if any of you are haveing the same issues take a look and see if this might be causeing it
#13
http://www.garagegames.com/mg/forums/result.thread.php?qt=28024
It sorted it for me :)
02/12/2006 (7:49 pm)
Thanks for this guys, just made the changes and it works well. For info, if anyone else is following these instructions, and is getting compiler errors, you may also want to have a look at:http://www.garagegames.com/mg/forums/result.thread.php?qt=28024
It sorted it for me :)
#14
02/15/2006 (1:14 pm)
This may already have been mentioned but the only issue I had was a missing macro. I added,#define bit(x) (1 << (x))to, "engine\game\objectTypes.h" at around line 20,
enum SimObjectTypes
{
[b]#define bit(x) (1 << (x))[/b]
/// @name Types used by the SceneObject class
/// @{
DefaultObjectType = 0,
StaticObjectType = BIT(0),
#15
02/15/2006 (2:36 pm)
Good solution James, I always just changed bit to BIT, don't know c++ well enough to do what you did ;)
#16
02/15/2006 (4:40 pm)
Anyone have any idea why the minimap displays units as black, instead of blue?
#17
Anyone have any idea what I did wrong?
(VC++ 6)
By the way, a clean compile works fine.
03/27/2006 (8:09 pm)
I'm getting lots of these kinds of errors. Compiling...
guiMapHud.cc
c:\genesis-rts\torque\engine\game\rts\guimaphud.cc(57) : error C2039: 'getServerConnection' : is not a member of 'GameConnection'
c:\genesis-rts\torque\engine\game\gameconnection.h(41) : see declaration of 'GameConnection'
c:\genesis-rts\torque\engine\game\rts\guimaphud.cc(57) : error C2065: 'getServerConnection' : undeclared identifier
guiMapHudGen.cc
c:\genesis-rts\torque\engine\game\rts\guimaphudgen.cc(97) : error C2039: 'getServerConnection' : is not a member of 'GameConnection'
c:\genesis-rts\torque\engine\game\gameconnection.h(41) : see declaration of 'GameConnection'
c:\genesis-rts\torque\engine\game\rts\guimaphudgen.cc(97) : error C2065: 'getServerConnection' : undeclared identifier
guiMapHudRender.cc
c:\genesis-rts\torque\engine\game\rts\guimaphudrender.cc(10) : error C2039: 'getServerConnection' : is not a member of 'NetConnection'
c:\genesis-rts\torque\engine\sim\netconnection.h(371) : see declaration of 'NetConnection'
c:\genesis-rts\torque\engine\game\rts\guimaphudrender.cc(10) : error C2065: 'getServerConnection' : undeclared identifier
guiRTSTSCtrl.cc
c:\genesis-rts\torque\engine\game\rts\guirtstsctrl.h(47) : error C2065: 'bit' : undeclared identifier
c:\genesis-rts\torque\engine\game\rts\guirtstsctrl.h(47) : error C2057: expected constant expression
c:\genesis-rts\torque\engine\game\rts\guirtstsctrl.h(48) : error C2057: expected constant expression
c:\genesis-rts\torque\engine\game\rts\guirtstsctrl.h(49) : error C2057: expected constant expression
c:\genesis-rts\torque\engine\game\rts\guirtstsctrl.h(50) : error C2057: expected constant expression
c:\genesis-rts\torque\engine\game\rts\guirtstsctrl.h(52) : error C2057: expected constant expressionAnyone have any idea what I did wrong?
(VC++ 6)
By the way, a clean compile works fine.
#18
I remember getting a lot of these types of errors when I merged the code.
From memory (just wiped my PC, and haven't put torque back on yet so I can't try it out), I think that the spelling of getServerConnection changed between 1.3 and 1.4. I *think* it changed to getConnectionToServer.
For the error:
'bit' : undeclared identifier
Have a look at the post from James Dunlap above. You're missing a #define.
Hope this helps.
03/28/2006 (1:45 pm)
Nibbuls,I remember getting a lot of these types of errors when I merged the code.
From memory (just wiped my PC, and haven't put torque back on yet so I can't try it out), I think that the spelling of getServerConnection changed between 1.3 and 1.4. I *think* it changed to getConnectionToServer.
For the error:
'bit' : undeclared identifier
Have a look at the post from James Dunlap above. You're missing a #define.
Hope this helps.
#19
http://www.garagegames.com/mg/forums/result.thread.php?qt=28024
03/28/2006 (1:48 pm)
Nibbuls, I should have waited an extra couple of minutes before submitting that last post. I've just found another post that covers some of your problems. Have a look at:http://www.garagegames.com/mg/forums/result.thread.php?qt=28024
#20
*Edit: I knew it was too good to be true.
For example:
And
I get 23 of those errors while compiling.... I searched, and found a single resource that did not deal with winnt.h. With regular files I would be eager to experiment, but with one so large, I'm afraid to make a single change and then lose it.
www.garagegames.com/mg/forums/result.thread.php?qt=21381 The result wasn't of any help, either.
This is my best guess: Should I add a semicolon after something like:
03/29/2006 (1:50 am)
Beautiful! Many thanks. :D*Edit: I knew it was too good to be true.
For example:
glu2d3d.cc C:\Program Files\Microsoft SDK\include\winnt.h(256) : error C2144: syntax error : 'char' should be preceded by ';'
And
winWindow.cc C:\Program Files\Microsoft SDK\include\winnt.h(256) : error C2144: syntax error : 'char' should be preceded by ';' winV2Video.cc C:\Program Files\Microsoft SDK\include\winnt.h(256) : error C2144: syntax error : 'char' should be preceded by ';' winTime.cc C:\Program Files\Microsoft SDK\include\winnt.h(256) : error C2144: syntax error : 'char' should be preceded by ';' winThread.cc C:\Program Files\Microsoft SDK\include\winnt.h(256) : error C2144: syntax error : 'char' should be preceded by ';' winStrings.cc C:\Program Files\Microsoft SDK\include\winnt.h(256) : error C2144: syntax error : 'char' should be preceded by ';'
I get 23 of those errors while compiling.... I searched, and found a single resource that did not deal with winnt.h. With regular files I would be eager to experiment, but with one so large, I'm afraid to make a single change and then lose it.
www.garagegames.com/mg/forums/result.thread.php?qt=21381 The result wasn't of any help, either.
This is my best guess: Should I add a semicolon after something like:
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1](INSERT ; HERE) #include <basetsd.h>
Torque Owner Unsung Zero
Find
mTextureCallbackKey = TextureManager::registerEventCallback(terrainTextureEventCB, this); mDynLightTexture = TextureHandle("common/lighting/lightFalloffMono", BitmapTexture, true); if (dglDoesSupportVertexBuffer()) mVertexBuffer = glAllocateVertexBufferEXT(VertexBufferSize,GL_V12MTVFMT_EXT,true); else mVertexBuffer = -1;And replace it withmTextureCallbackKey = TextureManager::registerEventCallback(terrainTextureEventCB, this); mDynLightTexture = TextureHandle("common/lighting/lightFalloffMono", BitmapTexture, true); mSelectionTexture = TextureHandle("starter.RTS/ui/ring_white", BitmapTexture, true); if (dglDoesSupportVertexBuffer()) mVertexBuffer = glAllocateVertexBufferEXT(VertexBufferSize,GL_V12MTVFMT_EXT,true); else mVertexBuffer = -1;In file \engine\terrrain\terrData.h
Find
And replace it with