[Opentnl-cvs] tnl/zap UIEditor.cpp,1.19,1.20 UIEditor.h,1.5,1.6 ZAP.vcproj,1.40,1.41 gameType.cpp,1.
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-10-18 00:09:33
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32370/zap Modified Files: UIEditor.cpp UIEditor.h ZAP.vcproj gameType.cpp gameType.h Log Message: Added width field to barriers for variable-width barriers Index: UIEditor.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIEditor.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** UIEditor.cpp 2 Aug 2004 21:01:30 -0000 1.19 --- UIEditor.cpp 18 Oct 2004 00:09:22 -0000 1.20 *************** *** 31,34 **** --- 31,35 ---- #include <ctype.h> #include "gameObjectRender.h" + #include "barrier.h" namespace Zap *************** *** 58,61 **** --- 59,63 ---- mCreatingPoly = false; mCurrentTeam = 0; + mGridSize = Game::DefaultGridSize; strcpy(mEditFileName, name); *************** *** 66,69 **** --- 68,72 ---- { const char *name; + bool hasWidth; bool hasTeam; bool canHaveNoTeam; *************** *** 89,105 **** GameItemRec gGameItemRecs[] = { ! { "Spawn", true, false, false, 'S' }, ! { "SoccerBallItem", false, false, false, 'B' }, ! { "FlagItem", true, true, false, 0 }, ! { "BarrierMaker", false, false, true, 0 }, ! { "Teleporter", false, false, true, 'T' }, ! { "RepairItem", false, false, false, 'R' }, ! { "TestItem", false, false, false, 't' }, ! { "ResourceItem", false, false, false, 'r' }, ! { "LoadoutZone", true, true, true, 0 }, ! { "Turret", true, true, false, 'N' }, ! { "ForceFieldProjector", true, true, false, 'P' }, ! { "GoalZone", true, false, true, 0 }, ! { NULL, false, false, false, 0 }, }; --- 92,108 ---- GameItemRec gGameItemRecs[] = { ! { "Spawn", false, true, false, false, 'S' }, ! { "SoccerBallItem", false, false, false, false, 'B' }, ! { "FlagItem", false, true, true, false, 0 }, ! { "BarrierMaker", true, false, false, true, 0 }, ! { "Teleporter", false, false, false, true, 'T' }, ! { "RepairItem", false, false, false, false, 'R' }, ! { "TestItem", false, false, false, false, 't' }, ! { "ResourceItem", false, false, false, false, 'r' }, ! { "LoadoutZone", false, true, true, true, 0 }, ! { "Turret", false, true, true, false, 'N' }, ! { "ForceFieldProjector", false, true, true, false, 'P' }, ! { "GoalZone", false, true, false, true, 0 }, ! { NULL, false, false, false, false, 0 }, }; *************** *** 129,132 **** --- 132,141 ---- i.team = -1; i.selected = false; + i.width = 0; + if(gGameItemRecs[index].hasWidth) + { + i.width = atof(argv[arg]); + arg++; + } if(gGameItemRecs[index].hasTeam) { *************** *** 160,163 **** --- 169,176 ---- mTeams.push_back(t); } + else if(!strcmp(argv[0], "GridSize") && argc == 2) + { + mGridSize = atof(argv[1]); + } else { *************** *** 261,264 **** --- 274,289 ---- mNewItem.verts.erase_fast(mNewItem.verts.size() - 1); } + else + { + for(S32 i = 0; i < mItems.size(); i++) + { + if(mItems[i].selected && mItems[i].index == ItemBarrierMaker) + { + glColor3f(1,1,1); + drawStringf(680, 5, 20, "Width: %g", mItems[i].width); + break; + } + } + } if(mDragSelecting) { *************** *** 793,796 **** --- 818,822 ---- mNewItem.verts.clear(); mNewItem.index = ItemBarrierMaker; + mNewItem.width = Barrier::BarrierWidth; mNewItem.team = -1; mNewItem.selected = false; *************** *** 850,853 **** --- 876,897 ---- } + void EditorUserInterface::incBarrierWidth() + { + for(S32 i = 0; i < mItems.size(); i++) + { + if(mItems[i].index == ItemBarrierMaker && mItems[i].selected) + mItems[i].width += 5; + } + } + + void EditorUserInterface::decBarrierWidth() + { + for(S32 i = 0; i < mItems.size(); i++) + { + if(mItems[i].index == ItemBarrierMaker && mItems[i].selected && mItems[i].width >= 9) + mItems[i].width -= 5; + } + } + void EditorUserInterface::constructItem(U32 itemIndex) { *************** *** 948,951 **** --- 992,1003 ---- deleteSelection(); break; + case '+': + case '=': + incBarrierWidth(); + break; + case '-': + case '_': + decBarrierWidth(); + break; case 27: gEditorMenuUserInterface.activate(); *************** *** 1076,1079 **** --- 1128,1133 ---- WorldItem &p = mItems[i]; fprintf(f, "%s ", gGameItemRecs[mItems[i].index].name); + if(gGameItemRecs[mItems[i].index].hasWidth) + fprintf(f, "%g ", mItems[i].width); if(gGameItemRecs[mItems[i].index].hasTeam) fprintf(f, "%d ", mItems[i].team); Index: gameType.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** gameType.cpp 15 Oct 2004 18:01:15 -0000 1.64 --- gameType.cpp 18 Oct 2004 00:09:22 -0000 1.65 *************** *** 49,53 **** mGameOver = false; mTeamScoreLimit = DefaultTeamScoreLimit; - mBarrierWidth = Barrier::BarrierWidth; } --- 49,52 ---- *************** *** 441,455 **** { BarrierRec barrier; ! for(S32 i = 1; i < argc; i++) barrier.verts.push_back(atof(argv[i]) * getGame()->getGridSize()); if(barrier.verts.size() > 3) { - barrier.width = mBarrierWidth; mBarriers.push_back(barrier); ! constructBarriers(getGame(), barrier.verts, mBarrierWidth); } } - else if(!stricmp(argv[0], "BarrierWidth")) - mBarrierWidth = atof(argv[1]); else if(!stricmp(argv[0], "LevelName") && argc > 1) mLevelName.set(argv[1]); --- 440,454 ---- { BarrierRec barrier; ! if(argc < 2) ! return false; ! barrier.width = atof(argv[1]); ! for(S32 i = 2; i < argc; i++) barrier.verts.push_back(atof(argv[i]) * getGame()->getGridSize()); if(barrier.verts.size() > 3) { mBarriers.push_back(barrier); ! constructBarriers(getGame(), barrier.verts, barrier.width); } } else if(!stricmp(argv[0], "LevelName") && argc > 1) mLevelName.set(argv[1]); Index: UIEditor.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIEditor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UIEditor.h 15 Jul 2004 00:13:35 -0000 1.5 --- UIEditor.h 18 Oct 2004 00:09:22 -0000 1.6 *************** *** 41,44 **** --- 41,45 ---- U32 index; S32 team; + F32 width; Vector<Point> verts; bool selected; *************** *** 68,71 **** --- 69,73 ---- Point mMouseDownPos; S32 mCurrentTeam; + F32 mGridSize; bool mCreatingPoly; *************** *** 106,109 **** --- 108,114 ---- void rotateSelection(F32 angle); + void incBarrierWidth(); + void decBarrierWidth(); + void saveLevel(); void testLevel(); Index: gameType.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** gameType.h 15 Oct 2004 18:01:15 -0000 1.38 --- gameType.h 18 Oct 2004 00:09:22 -0000 1.39 *************** *** 77,81 **** }; - F32 mBarrierWidth; struct BarrierRec { --- 77,80 ---- Index: ZAP.vcproj =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ZAP.vcproj,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ZAP.vcproj 29 Sep 2004 23:53:21 -0000 1.40 --- ZAP.vcproj 18 Oct 2004 00:09:22 -0000 1.41 *************** *** 139,145 **** --- 139,157 ---- </File> <File + RelativePath="..\exe\levels\football3.txt"> + </File> + <File + RelativePath="..\exe\levels\football4.txt"> + </File> + <File + RelativePath="..\exe\levels\football5.txt"> + </File> + <File RelativePath="..\exe\levels\hunters1.txt"> </File> <File + RelativePath="..\exe\levels\hunters2.txt"> + </File> + <File RelativePath="..\exe\levels\level2.txt"> </File> *************** *** 160,163 **** --- 172,181 ---- </File> <File + RelativePath="..\exe\levels\retrieve2.txt"> + </File> + <File + RelativePath="..\exe\levels\retrieve3.txt"> + </File> + <File RelativePath="..\exe\levels\soccer1.txt"> </File> *************** *** 165,168 **** --- 183,189 ---- RelativePath="..\exe\levels\soccer2.txt"> </File> + <File + RelativePath="..\exe\levels\zm1.txt"> + </File> </Filter> <Filter |