From: <tr...@us...> - 2008-11-28 03:55:51
|
Revision: 18987 http://bzflag.svn.sourceforge.net/bzflag/?rev=18987&view=rev Author: trepan Date: 2008-11-28 03:55:39 +0000 (Fri, 28 Nov 2008) Log Message: ----------- * bumped BZ_PROTO_VERSION to 0071, BZ_REV to 12 (also changed the AC_INIT() value this time ;-) * added the 'text' world object type * updated the FontManager to use map<> for looking up font faces * added the ability to load URL sourced fonts into the FontManager * added getOpacity() to FontManager * added the maxFontSize BZDB variable (default is 128, currently only used by TextSceneNode) * rewrote the bzfsAPI URL handling for simultaneous queries * added the 'size_t bz_addURLJobForID(...)' and 'bool bz_removeURLJobByID(size_t)' bzfsAPI routines * fixed a small cURLManager glitch (static calls vs. no managers) * added the setDeleteOnDone() cURLManager function * updated bzw.5 for the following: - mapinfo - text object - dynamic color control via a BZDB variable * rewrote the parts of BZWReader that read 'raw text' (no more fakeObject) - custom objects and mapinfo were tripping up on bzw keywords other than 'end' * cached BZDBCache::shadowAlpha * tweaked the stencil shadow algorithm to accomodate text objects (added a full-screen draw after everything has updated the stencil) * added bz_getProtocolVersion() to bzfsAPI * whitespace changes to Octree.cxx * removed the unused MsgPortal... protocol codes Modified Paths: -------------- trunk/bzflag/configure.ac trunk/bzflag/include/BZDBCache.h trunk/bzflag/include/BzMaterial.h trunk/bzflag/include/DynamicColor.h trunk/bzflag/include/FontManager.h trunk/bzflag/include/Makefile.am trunk/bzflag/include/OpenGLGState.h trunk/bzflag/include/Protocol.h trunk/bzflag/include/WallSceneNode.h trunk/bzflag/include/bzfsAPI.h trunk/bzflag/include/cURLManager.h trunk/bzflag/man/bzw.5.in trunk/bzflag/plugins/lua/Makefile.am trunk/bzflag/plugins/lua/bzdb.cpp trunk/bzflag/plugins/lua/callins.cpp trunk/bzflag/plugins/lua/callins.h trunk/bzflag/plugins/lua/callouts.cpp trunk/bzflag/plugins/lua/example/bzfs.lua trunk/bzflag/plugins/lua/example/plugins/air_spawn.lua trunk/bzflag/plugins/lua/example/plugins/debug.lua trunk/bzflag/plugins/lua/example/plugins/phoenix.lua trunk/bzflag/plugins/lua/example/plugins/rogue_genocide.lua trunk/bzflag/plugins/lua/example/plugins.lua trunk/bzflag/plugins/lua/example/utils.lua trunk/bzflag/plugins/lua/lua.cpp trunk/bzflag/plugins/lua/mapobject.cpp trunk/bzflag/plugins/lua/mapobject.h trunk/bzflag/plugins/lua/slashcmd.cpp trunk/bzflag/plugins/lua/slashcmd.h trunk/bzflag/src/3D/FontManager.cxx trunk/bzflag/src/bzflag/BackgroundRenderer.cxx trunk/bzflag/src/bzflag/CommandsImplementation.cxx trunk/bzflag/src/bzflag/Makefile.am trunk/bzflag/src/bzflag/SceneBuilder.cxx trunk/bzflag/src/bzflag/SceneBuilder.h trunk/bzflag/src/bzflag/SceneRenderer.cxx trunk/bzflag/src/bzflag/World.cxx trunk/bzflag/src/bzflag/WorldBuilder.cxx trunk/bzflag/src/bzflag/defaultBZDB.cxx trunk/bzflag/src/bzfs/BZWReader.cxx trunk/bzflag/src/bzfs/BZWReader.h trunk/bzflag/src/bzfs/CustomDynamicColor.cxx trunk/bzflag/src/bzfs/Makefile.am trunk/bzflag/src/bzfs/ParseMaterial.cxx trunk/bzflag/src/bzfs/WorldFileLocation.cxx trunk/bzflag/src/bzfs/WorldGenerators.cxx trunk/bzflag/src/bzfs/WorldInfo.cxx trunk/bzflag/src/bzfs/WorldInfo.h trunk/bzflag/src/bzfs/bzfsAPI.cxx trunk/bzflag/src/bzrobots/Makefile.am trunk/bzflag/src/common/cURLManager.cxx trunk/bzflag/src/date/buildDate.cxx trunk/bzflag/src/game/BZDBCache.cxx trunk/bzflag/src/game/BzMaterial.cxx trunk/bzflag/src/game/DynamicColor.cxx trunk/bzflag/src/game/Makefile.am trunk/bzflag/src/game/MeshTransform.cxx trunk/bzflag/src/game/MsgStrings.cxx trunk/bzflag/src/geometry/BillboardSceneNode.cxx trunk/bzflag/src/geometry/BoltSceneNode.cxx trunk/bzflag/src/geometry/EighthDBaseSceneNode.cxx trunk/bzflag/src/geometry/EighthDBoxSceneNode.cxx trunk/bzflag/src/geometry/EighthDPyrSceneNode.cxx trunk/bzflag/src/geometry/EighthDimSceneNode.cxx trunk/bzflag/src/geometry/FlagWarpSceneNode.cxx trunk/bzflag/src/geometry/LaserSceneNode.cxx trunk/bzflag/src/geometry/Makefile.am trunk/bzflag/src/geometry/MeshPolySceneNode.cxx trunk/bzflag/src/geometry/MeshSceneNode.cxx trunk/bzflag/src/geometry/PTSceneNode.cxx trunk/bzflag/src/geometry/PolyWallSceneNode.cxx trunk/bzflag/src/geometry/QuadWallSceneNode.cxx trunk/bzflag/src/geometry/SceneNode.cxx trunk/bzflag/src/geometry/ShellSceneNode.cxx trunk/bzflag/src/geometry/TracerSceneNode.cxx trunk/bzflag/src/geometry/TriWallSceneNode.cxx trunk/bzflag/src/geometry/WallSceneNode.cxx trunk/bzflag/src/obstacle/ArcObstacle.cxx trunk/bzflag/src/obstacle/BaseBuilding.cxx trunk/bzflag/src/obstacle/BoxBuilding.cxx trunk/bzflag/src/obstacle/ConeObstacle.cxx trunk/bzflag/src/obstacle/MeshObstacle.cxx trunk/bzflag/src/obstacle/MeshSceneNodeGenerator.cxx trunk/bzflag/src/obstacle/ObstacleMgr.cxx trunk/bzflag/src/obstacle/PyramidBuilding.cxx trunk/bzflag/src/obstacle/SphereObstacle.cxx trunk/bzflag/src/obstacle/Teleporter.cxx trunk/bzflag/src/obstacle/TetraBuilding.cxx trunk/bzflag/src/ogl/OpenGLGState.cxx trunk/bzflag/src/ogl/RenderNode.cxx trunk/bzflag/src/scene/Octree.cxx Added Paths: ----------- trunk/bzflag/include/TextSceneNode.h trunk/bzflag/include/WorldText.h trunk/bzflag/src/bzfs/CustomWorldText.cxx trunk/bzflag/src/bzfs/CustomWorldText.h trunk/bzflag/src/game/WorldText.cxx trunk/bzflag/src/geometry/TextSceneNode.cxx Removed Paths: ------------- trunk/bzflag/src/bzfs/CustomMapInfo.cxx trunk/bzflag/src/bzfs/CustomMapInfo.h Modified: trunk/bzflag/configure.ac =================================================================== --- trunk/bzflag/configure.ac 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/configure.ac 2008-11-28 03:55:39 UTC (rev 18987) @@ -46,7 +46,7 @@ dnl setting in the autogen.sh script. AC_PREREQ(2.58) -AC_INIT(BZFlag, 2.99.11, [http://BZFlag.org], bzflag) +AC_INIT(BZFlag, 2.99.12, [http://BZFlag.org], bzflag) AC_CONFIG_SRCDIR(src/bzflag/bzflag.cxx) AC_REVISION($Revision$) Modified: trunk/bzflag/include/BZDBCache.h =================================================================== --- trunk/bzflag/include/BZDBCache.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/BZDBCache.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -35,6 +35,7 @@ static bool animatedTreads; static int radarStyle; static float radarTankPixels; + static float shadowAlpha; static bool leadingShotLine; static bool showShotGuide; static int linedRadarShots; Modified: trunk/bzflag/include/BzMaterial.h =================================================================== --- trunk/bzflag/include/BzMaterial.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/BzMaterial.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -53,6 +53,7 @@ bool setName(const std::string&); bool addAlias(const std::string&); + void setOrder(int); void setDynamicColor(int); void setAmbient(const float[4]); void setDiffuse(const float[4]); @@ -91,6 +92,7 @@ const std::string& getName() const; const std::vector<std::string>& getAliases() const; + int getOrder() const; int getDynamicColor() const; const float* getAmbient() const; const float* getDiffuse() const; @@ -141,6 +143,8 @@ bool referenced; + int order; + int dynamicColor; float ambient[4]; float diffuse[4]; Modified: trunk/bzflag/include/DynamicColor.h =================================================================== --- trunk/bzflag/include/DynamicColor.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/DynamicColor.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -92,11 +92,11 @@ std::string varName; bool varUseAlpha; - float varTiming; + float varTime; bool varInit; bool varTransition; - float varTimingTmp; + float varTimeTmp; float varOldColor[4]; float varNewColor[4]; TimeKeeper varLastChange; Modified: trunk/bzflag/include/FontManager.h =================================================================== --- trunk/bzflag/include/FontManager.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/FontManager.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -87,12 +87,27 @@ int loadAll(std::string dir); /** + * load a specified font + */ + int load(const char* file); + + /** * return an index to the requested font if it's been loaded or the * first loaded font otherwise. */ int getFaceID(std::string const& faceName); /** + * lookup the font ID for a given font, or -1 on failure + */ + int lookupID(std::string const& faceName); + + /** + * lookup the font ID for a given font filename, or -1 on failure + */ + int lookupFileID(std::string const& fileName); + + /** * main work-horse. render the provided text with the specified * font size, optionally justifying to a particular alignment. */ @@ -110,30 +125,23 @@ */ float getStringHeight(int faceID, float size); - void setDimFactor(float newDimFactor); - void setOpacity(float newOpacity); - void setDarkness(float newDimFactor); + float getOpacity() const { return opacity; } + void setOpacity(float newOpacity); + void setDarkness(float newDarkFactor); + void setDimFactor(float newDimFactor); + bool freeFontFile(const std::string& fileName); + protected: friend class Singleton<FontManager>; /** - * lookup the font ID for a given font, or -1 on failure - */ - int lookupID(std::string const& faceName); - - /** * return the pulse color */ void getPulseColor(const GLfloat* color, GLfloat* pulseColor) const; /** - * load a specified font - */ - int load(const char* file); - - /** * destroy all the fonts, clear all the lists */ void clear(); Modified: trunk/bzflag/include/Makefile.am =================================================================== --- trunk/bzflag/include/Makefile.am 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/Makefile.am 2008-11-28 03:55:39 UTC (rev 18987) @@ -129,6 +129,7 @@ TeleporterSceneNodeGenerator.h \ TetraBuilding.h \ TextChunkManager.h \ + TextSceneNode.h \ TextUtils.h \ TextureManager.h \ TextureMatrix.h \ @@ -144,6 +145,7 @@ WallSceneNodeGenerator.h \ WordFilter.h \ WorldEventManager.h \ + WorldText.h \ ZSceneDatabase.h \ bz_Locale.h \ bzares.h \ Modified: trunk/bzflag/include/OpenGLGState.h =================================================================== --- trunk/bzflag/include/OpenGLGState.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/OpenGLGState.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -37,6 +37,7 @@ ~OpenGLGState(); OpenGLGState& operator=(const OpenGLGState& state); void setState() const; + int getOrder() const; bool getNeedsSorting() const; bool isBlended() const; bool isTextured() const; @@ -150,6 +151,7 @@ OpenGLGStateBuilder &operator=(const OpenGLGState&); void reset(); + void setOrder(int); void enableTexture(bool = true); void enableTextureMatrix(bool = true); void enableSphereMap(bool = true); Modified: trunk/bzflag/include/Protocol.h =================================================================== --- trunk/bzflag/include/Protocol.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/Protocol.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -47,133 +47,130 @@ const uint16_t MsgNull = 0x0000; // server message codes -const uint16_t MsgAccept = 0x6163; // 'ac' -const uint16_t MsgAdminInfo = 0x6169; // 'ai' -const uint16_t MsgAlive = 0x616c; // 'al' -const uint16_t MsgAllow = 0x696f; // 'ao' -const uint16_t MsgAddPlayer = 0x6170; // 'ap' -const uint16_t MsgAllowSpawn = 0x6173; // 'as' -const uint16_t MsgAutoPilot = 0x6175; // 'au' -const uint16_t MsgCapBits = 0x6362; // 'cb' -const uint16_t MsgCaptureFlag = 0x6366; // 'cf' -const uint16_t MsgCollide = 0x636f; // 'co' -const uint16_t MsgCustomSound = 0x6373; // 'cs' -const uint16_t MsgCacheURL = 0x6375; // 'cu' -const uint16_t MsgDropFlag = 0x6466; // 'df' -const uint16_t MsgEnter = 0x656e; // 'en' -const uint16_t MsgExit = 0x6578; // 'ex' -const uint16_t MsgFlagType = 0x6674; // 'ft' -const uint16_t MsgFlagUpdate = 0x6675; // 'fu' -const uint16_t MsgFetchResources = 0x6672; // 'fr' -const uint16_t MsgGrabFlag = 0x6766; // 'gf' -const uint16_t MsgGMUpdate = 0x676d; // 'gm' -const uint16_t MsgGetWorld = 0x6777; // 'gw' -const uint16_t MsgGameSettings = 0x6773; // 'gs' -const uint16_t MsgGameTime = 0x6774; // 'gt' -const uint16_t MsgHandicap = 0x6863; // 'hc' -const uint16_t MsgHit = 0x6869; // 'hi' -const uint16_t MsgJoinServer = 0x6a73; // 'js' -const uint16_t MsgKilled = 0x6b6c; // 'kl' -const uint16_t MsgLagState = 0x6c73; // 'ls' -const uint16_t MsgLimboMessage = 0x6c6d; // 'lm' -const uint16_t MsgMessage = 0x6d67; // 'mg' -const uint16_t MsgNewPlayer = 0x6e70; // 'np' -const uint16_t MsgNearFlag = 0x4e66; // 'Nf' -const uint16_t MsgNewRabbit = 0x6e52; // 'nR' -const uint16_t MsgNegotiateFlags = 0x6e66; // 'nf' -const uint16_t MsgPause = 0x7061; // 'pa' -const uint16_t MsgPlayerInfo = 0x7062; // 'pb' -const uint16_t MsgPlayerData = 0x7064; // 'pd' -const uint16_t MsgPlayerUpdate = 0x7075; // 'pu' -const uint16_t MsgPlayerUpdateSmall = 0x7073; // 'ps' -const uint16_t MsgQueryGame = 0x7167; // 'qg' -const uint16_t MsgQueryPlayers = 0x7170; // 'qp' -const uint16_t MsgReject = 0x726a; // 'rj' -const uint16_t MsgRemovePlayer = 0x7270; // 'rp' -const uint16_t MsgReplayReset = 0x7272; // 'rr' -const uint16_t MsgShotBegin = 0x7362; // 'sb' -const uint16_t MsgWShotBegin = 0x7762; // 'wb' -const uint16_t MsgWhatTimeIsIt = 0x7774; // 'wt' -const uint16_t MsgScore = 0x7363; // 'sc' -const uint16_t MsgScoreOver = 0x736f; // 'so' -const uint16_t MsgShotEnd = 0x7365; // 'se' -const uint16_t MsgSuperKill = 0x736b; // 'sk' -const uint16_t MsgSetShot = 0x7373; // 'ss' -const uint16_t MsgSetTeam = 0x7374; // 'st' -const uint16_t MsgSetVar = 0x7376; // 'sv' -const uint16_t MsgTangibilityUpdate = 0x746e; // 'tn' -const uint16_t MsgTangibilityReset = 0x7472; // 'tr' -const uint16_t MsgTimeUpdate = 0x746f; // 'to' -const uint16_t MsgTeleport = 0x7470; // 'tp' -const uint16_t MsgTransferFlag = 0x7466; // 'tf' -const uint16_t MsgTeamUpdate = 0x7475; // 'tu' -const uint16_t MsgWantWHash = 0x7768; // 'wh' -const uint16_t MsgWantSettings = 0x7773; // 'ws' -const uint16_t MsgPortalAdd = 0x5061; // 'Pa' -const uint16_t MsgPortalRemove = 0x5072; // 'Pr' -const uint16_t MsgPortalUpdate = 0x5075; // 'Pu' +const uint16_t MsgAccept = 0x6163; // 'ac' +const uint16_t MsgAdminInfo = 0x6169; // 'ai' +const uint16_t MsgAlive = 0x616c; // 'al' +const uint16_t MsgAllow = 0x696f; // 'ao' +const uint16_t MsgAddPlayer = 0x6170; // 'ap' +const uint16_t MsgAllowSpawn = 0x6173; // 'as' +const uint16_t MsgAutoPilot = 0x6175; // 'au' +const uint16_t MsgCapBits = 0x6362; // 'cb' +const uint16_t MsgCaptureFlag = 0x6366; // 'cf' +const uint16_t MsgCollide = 0x636f; // 'co' +const uint16_t MsgCustomSound = 0x6373; // 'cs' +const uint16_t MsgCacheURL = 0x6375; // 'cu' +const uint16_t MsgDropFlag = 0x6466; // 'df' +const uint16_t MsgEnter = 0x656e; // 'en' +const uint16_t MsgExit = 0x6578; // 'ex' +const uint16_t MsgFlagType = 0x6674; // 'ft' +const uint16_t MsgFlagUpdate = 0x6675; // 'fu' +const uint16_t MsgFetchResources = 0x6672; // 'fr' +const uint16_t MsgGrabFlag = 0x6766; // 'gf' +const uint16_t MsgGMUpdate = 0x676d; // 'gm' +const uint16_t MsgGetWorld = 0x6777; // 'gw' +const uint16_t MsgGameSettings = 0x6773; // 'gs' +const uint16_t MsgGameTime = 0x6774; // 'gt' +const uint16_t MsgHandicap = 0x6863; // 'hc' +const uint16_t MsgHit = 0x6869; // 'hi' +const uint16_t MsgJoinServer = 0x6a73; // 'js' +const uint16_t MsgKilled = 0x6b6c; // 'kl' +const uint16_t MsgLagState = 0x6c73; // 'ls' +const uint16_t MsgLimboMessage = 0x6c6d; // 'lm' +const uint16_t MsgMessage = 0x6d67; // 'mg' +const uint16_t MsgNewPlayer = 0x6e70; // 'np' +const uint16_t MsgNearFlag = 0x4e66; // 'Nf' +const uint16_t MsgNewRabbit = 0x6e52; // 'nR' +const uint16_t MsgNegotiateFlags = 0x6e66; // 'nf' +const uint16_t MsgPause = 0x7061; // 'pa' +const uint16_t MsgPlayerInfo = 0x7062; // 'pb' +const uint16_t MsgPlayerData = 0x7064; // 'pd' +const uint16_t MsgPlayerUpdate = 0x7075; // 'pu' +const uint16_t MsgPlayerUpdateSmall = 0x7073; // 'ps' +const uint16_t MsgQueryGame = 0x7167; // 'qg' +const uint16_t MsgQueryPlayers = 0x7170; // 'qp' +const uint16_t MsgReject = 0x726a; // 'rj' +const uint16_t MsgRemovePlayer = 0x7270; // 'rp' +const uint16_t MsgReplayReset = 0x7272; // 'rr' +const uint16_t MsgShotBegin = 0x7362; // 'sb' +const uint16_t MsgWShotBegin = 0x7762; // 'wb' +const uint16_t MsgWhatTimeIsIt = 0x7774; // 'wt' +const uint16_t MsgScore = 0x7363; // 'sc' +const uint16_t MsgScoreOver = 0x736f; // 'so' +const uint16_t MsgShotEnd = 0x7365; // 'se' +const uint16_t MsgSuperKill = 0x736b; // 'sk' +const uint16_t MsgSetShot = 0x7373; // 'ss' +const uint16_t MsgSetTeam = 0x7374; // 'st' +const uint16_t MsgSetVar = 0x7376; // 'sv' +const uint16_t MsgTangibilityUpdate = 0x746e; // 'tn' +const uint16_t MsgTangibilityReset = 0x7472; // 'tr' +const uint16_t MsgTeleport = 0x7470; // 'tp' +const uint16_t MsgTimeUpdate = 0x746f; // 'to' +const uint16_t MsgTransferFlag = 0x7466; // 'tf' +const uint16_t MsgTeamUpdate = 0x7475; // 'tu' +const uint16_t MsgWantWHash = 0x7768; // 'wh' +const uint16_t MsgWantSettings = 0x7773; // 'ws' // world database codes -const uint16_t WorldCodeHeader = 0x6865; // 'he' -const uint16_t WorldCodeBase = 0x6261; // 'ba' -const uint16_t WorldCodeBox = 0x6278; // 'bx' -const uint16_t WorldCodeEnd = 0x6564; // 'ed' -const uint16_t WorldCodeLink = 0x6c6e; // 'ln' -const uint16_t WorldCodePyramid = 0x7079; // 'py' -const uint16_t WorldCodeMesh = 0x6D65; // 'me' -const uint16_t WorldCodeArc = 0x6172; // 'ar' -const uint16_t WorldCodeCone = 0x636e; // 'cn' -const uint16_t WorldCodeSphere = 0x7370; // 'sp' -const uint16_t WorldCodeTetra = 0x7468; // 'th' -const uint16_t WorldCodeTeleporter = 0x7465; // 'te' -const uint16_t WorldCodeWall = 0x776c; // 'wl' -const uint16_t WorldCodeWeapon = 0x7765; // 'we' -const uint16_t WorldCodeZone = 0x7A6e; // 'zn' -const uint16_t WorldCodeGroup = 0x6772; // 'gr' -const uint16_t WorldCodeGroupDefStart = 0x6473; // 'ds' -const uint16_t WorldCodeGroupDefEnd = 0x6465; // 'de' +const uint16_t WorldCodeHeader = 0x6865; // 'he' +const uint16_t WorldCodeBase = 0x6261; // 'ba' +const uint16_t WorldCodeBox = 0x6278; // 'bx' +const uint16_t WorldCodeEnd = 0x6564; // 'ed' +const uint16_t WorldCodeLink = 0x6c6e; // 'ln' +const uint16_t WorldCodePyramid = 0x7079; // 'py' +const uint16_t WorldCodeMesh = 0x6D65; // 'me' +const uint16_t WorldCodeArc = 0x6172; // 'ar' +const uint16_t WorldCodeCone = 0x636e; // 'cn' +const uint16_t WorldCodeSphere = 0x7370; // 'sp' +const uint16_t WorldCodeTetra = 0x7468; // 'th' +const uint16_t WorldCodeTeleporter = 0x7465; // 'te' +const uint16_t WorldCodeWall = 0x776c; // 'wl' +const uint16_t WorldCodeWeapon = 0x7765; // 'we' +const uint16_t WorldCodeZone = 0x7A6e; // 'zn' +const uint16_t WorldCodeGroup = 0x6772; // 'gr' +const uint16_t WorldCodeGroupDefStart = 0x6473; // 'ds' +const uint16_t WorldCodeGroupDefEnd = 0x6465; // 'de' // world database sizes -const uint16_t WorldSettingsSize = 18; -const uint16_t WorldCodeHeaderSize = 10; -const uint16_t WorldCodeBaseSize = 31; -const uint16_t WorldCodeWallSize = 24; -const uint16_t WorldCodeBoxSize = 29; -const uint16_t WorldCodeEndSize = 0; -const uint16_t WorldCodePyramidSize = 29; -const uint16_t WorldCodeMeshSize = 0xA5; // dummy value, sizes are variable -const uint16_t WorldCodeArcSize = 85; -const uint16_t WorldCodeConeSize = 65; -const uint16_t WorldCodeSphereSize = 53; -const uint16_t WorldCodeTetraSize = 66; -const uint16_t WorldCodeTeleporterSize = 34; -const uint16_t WorldCodeLinkSize = 4; -const uint16_t WorldCodeWeaponSize = 24; // basic size, not including lists -const uint16_t WorldCodeZoneSize = 34; // basic size, not including lists +const uint16_t WorldSettingsSize = 18; +const uint16_t WorldCodeHeaderSize = 10; +const uint16_t WorldCodeBaseSize = 31; +const uint16_t WorldCodeWallSize = 24; +const uint16_t WorldCodeBoxSize = 29; +const uint16_t WorldCodeEndSize = 0; +const uint16_t WorldCodePyramidSize = 29; +const uint16_t WorldCodeMeshSize = 0xA5; // dummy value, sizes are variable +const uint16_t WorldCodeArcSize = 85; +const uint16_t WorldCodeConeSize = 65; +const uint16_t WorldCodeSphereSize = 53; +const uint16_t WorldCodeTetraSize = 66; +const uint16_t WorldCodeTeleporterSize = 34; +const uint16_t WorldCodeLinkSize = 4; +const uint16_t WorldCodeWeaponSize = 24; // basic size, not including lists +const uint16_t WorldCodeZoneSize = 34; // basic size, not including lists // ping packet sizes, codes and structure -const uint16_t MsgPingCodeReply = 0x0303; -const uint16_t MsgPingCodeRequest = 0x0404; +const uint16_t MsgPingCodeReply = 0x0303; +const uint16_t MsgPingCodeRequest = 0x0404; -const uint16_t MsgEchoRequest = 0x6572; // 'er' -const uint16_t MsgEchoResponse = 0x6570; // 'ep' +const uint16_t MsgEchoRequest = 0x6572; // 'er' +const uint16_t MsgEchoResponse = 0x6570; // 'ep' // rejection codes -const uint16_t RejectBadRequest = 0x0000; -const uint16_t RejectBadTeam = 0x0001; -const uint16_t RejectBadType = 0x0002; -const uint16_t RejectUNUSED = 0x0003; -const uint16_t RejectTeamFull = 0x0004; -const uint16_t RejectServerFull = 0x0005; -const uint16_t RejectBadCallsign = 0x0006; -const uint16_t RejectRepeatCallsign = 0x0007; -const uint16_t RejectRejoinWaitTime = 0x0008; -const uint16_t RejectIPBanned = 0x0009; -const uint16_t RejectHostBanned = 0x000A; -const uint16_t RejectIDBanned = 0x000B; +const uint16_t RejectBadRequest = 0x0000; +const uint16_t RejectBadTeam = 0x0001; +const uint16_t RejectBadType = 0x0002; +const uint16_t RejectUNUSED = 0x0003; +const uint16_t RejectTeamFull = 0x0004; +const uint16_t RejectServerFull = 0x0005; +const uint16_t RejectBadCallsign = 0x0006; +const uint16_t RejectRepeatCallsign = 0x0007; +const uint16_t RejectRejoinWaitTime = 0x0008; +const uint16_t RejectIPBanned = 0x0009; +const uint16_t RejectHostBanned = 0x000A; +const uint16_t RejectIDBanned = 0x000B; // sound type codes -const uint16_t LocalCustomSound = 0x0001; +const uint16_t LocalCustomSound = 0x0001; enum BlowedUpReason { GotKilledMsg, @@ -188,14 +185,14 @@ }; // request for additional UDP link -const uint16_t MsgUDPLinkRequest = 0x6f66; // 'of' -const uint16_t MsgUDPLinkEstablished = 0x6f67; // 'og' +const uint16_t MsgUDPLinkRequest = 0x6f66; // 'of' +const uint16_t MsgUDPLinkEstablished = 0x6f67; // 'og' // server control message -const uint16_t MsgServerControl = 0x6f69; // 'oi' +const uint16_t MsgServerControl = 0x6f69; // 'oi' // lag ping sent by server to client and reply from client -const uint16_t MsgLagPing = 0x7069; // 'pi' +const uint16_t MsgLagPing = 0x7069; // 'pi' /* server communication protocol: --> incoming messages (to server) Added: trunk/bzflag/include/TextSceneNode.h =================================================================== --- trunk/bzflag/include/TextSceneNode.h (rev 0) +++ trunk/bzflag/include/TextSceneNode.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -0,0 +1,137 @@ +/* bzflag + * Copyright (c) 1993 - 2008 Tim Riker + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the license found in the file + * named COPYING that should have accompanied this file. + * + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* TextSceneNode: + * Encapsulates information for rendering world text. + */ + +#ifndef BZF_TEXT_SCENE_NODE_H +#define BZF_TEXT_SCENE_NODE_H + + +#include "common.h" + +/* system headers */ +#include <string> +#include <vector> + +/* common headers */ +#include "SceneNode.h" +#include "WorldText.h" +#include "MeshTransform.h" + + +class TextSceneNode : public SceneNode { + public: + TextSceneNode(const WorldText* text); + ~TextSceneNode(); + + void setRawText(const std::string& rawText); + + bool inAxisBox (const Extents&) const; + + void notifyStyleChange(); + + bool cullShadow(int pCount, const float (*planes)[4]) const; + + void addRenderNodes(SceneRenderer&); + void addShadowNodes(SceneRenderer&); + void renderRadar(); + + protected: + class TextRenderNode : public RenderNode { + + friend class TextSceneNode; + + public: + TextRenderNode(TextSceneNode*, const WorldText* text); + ~TextRenderNode(); + + void setText(const std::string& text); + + void render(); + void renderRadar(); + void renderShadow(); + + const GLfloat* getPosition() const { return sceneNode->getSphere(); } + + private: + int getFontID() const; + + void setRawText(const std::string& rawText); + void countTriangles(); + + bool checkDist() const; + void singleLineXForm() const; + + void drawDebug(); + + void initXFormList(); + void freeXFormList(); + static void initContext(void* data); + static void freeContext(void* data); + + static void bzdbCallback(const std::string& name, void* userData); + + private: + TextSceneNode* sceneNode; + + const WorldText text; + + GLuint xformList; + + int fontID; + int fontSize; + + std::vector<std::string> lines; + std::vector<float> widths; + + float fixedWidth; + + float lineStep; + + const float* colorPtr; + + bool noRadar; + bool noShadow; + + bool usePolygonOffset; + bool useLengthPerPixel; + + int triangles; + }; + + friend class TextRenderNode; + + protected: + void calcPlane(); + void calcSphere(); + void calcExtents(); + void getPoints(float points[5][3]) const; // corners, and the origin + float getMaxDist(const float points[5][3]) const; + + private: + OpenGLGState gstate; + TextRenderNode renderNode; +}; + + +#endif // BZF_TEXT_SCENE_NODE_H + + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Property changes on: trunk/bzflag/include/TextSceneNode.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/bzflag/include/WallSceneNode.h =================================================================== --- trunk/bzflag/include/WallSceneNode.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/WallSceneNode.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -55,6 +55,7 @@ void setMaterial(const OpenGLMaterial&); void setTexture(const int); void setTextureMatrix(const GLfloat* texmat); + void setOrder(int); void setDynamicColor(const float* color); void setBlending(bool); void setSphereMap(bool); @@ -95,6 +96,7 @@ private: int numLODs; float* elementAreas; + int order; const GLfloat* dynamicColor; GLfloat color[4]; GLfloat modulateColor[4]; Added: trunk/bzflag/include/WorldText.h =================================================================== --- trunk/bzflag/include/WorldText.h (rev 0) +++ trunk/bzflag/include/WorldText.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -0,0 +1,101 @@ +/* bzflag + * Copyright (c) 1993 - 2008 Tim Riker + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the license found in the file + * named COPYING that should have accompanied this file. + * + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef WORLD_TEXT_H +#define WORLD_TEXT_H + +#include "common.h" + +/* system interface headers */ +#include <string> +#include <vector> +#include <iostream> + +/* common interface headers */ +#include "MeshTransform.h" + + +class BzMaterial; + + +class WorldText { + public: + WorldText(); + WorldText(const WorldText& text); + ~WorldText(); + + bool isValid() const; + + int packSize() const; + void *pack(void* buf) const; + void *unpack(void* buf); + + void print(std::ostream& out, const std::string& indent) const; + + public: + std::string name; + std::string data; + std::string font; + + float fontSize; + float justify; // justification (0.0 = left, 1.0 = right) + float lineSpace; + float fixedWidth; + float lengthPerPixel; + + bool useBZDB; // 'data' refers to a bzdb variable + bool billboard; + + const BzMaterial* bzMaterial; + + MeshTransform xform; + + // polygon offset + float poFactor; + float poUnits; +}; + + +class WorldTextManager { + public: + WorldTextManager(); + ~WorldTextManager(); + + void clear(); + + int addText(WorldText* text); + + const std::vector<WorldText*>& GetTexts() const { return texts; } + + int packSize() const; + void *pack(void* buf) const; + void *unpack(void* buf); + + void print(std::ostream& out, const std::string& indent) const; + + private: + std::vector<WorldText*> texts; +}; + + +extern WorldTextManager WORLDTEXTMGR; + + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Property changes on: trunk/bzflag/include/WorldText.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/bzflag/include/bzfsAPI.h =================================================================== --- trunk/bzflag/include/bzfsAPI.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/bzfsAPI.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -1717,6 +1717,7 @@ public: bz_BaseURLHandler() { version = 1; } virtual ~bz_BaseURLHandler() {}; + virtual void done(const char* URL, void * data, unsigned int size, bool complete) = 0; virtual void timeout(const char* /*URL*/, int /*errorCode*/) {}; virtual void error(const char* /*URL*/, int /*errorCode*/, const char * /*errorString*/) {}; @@ -1727,6 +1728,10 @@ BZF_API bool bz_addURLJob(const char* URL, bz_BaseURLHandler* handler = NULL, const char* postData = NULL); BZF_API bool bz_removeURLJob(const char* URL); +BZF_API size_t bz_addURLJobForID(const char* URL, + bz_BaseURLHandler* handler = NULL, + const char* postData = NULL); +BZF_API bool bz_removeURLJobByID(size_t id); BZF_API bool bz_stopAllURLJobs(void); // inter plugin communication @@ -1809,6 +1814,7 @@ BZF_API const char* bz_MD5(const void * data, size_t size); BZF_API const char* bz_getServerVersion(void); +BZF_API const char* bz_getProtocolVersion(void); // server side player API Modified: trunk/bzflag/include/cURLManager.h =================================================================== --- trunk/bzflag/include/cURLManager.h 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/include/cURLManager.h 2008-11-28 03:55:39 UTC (rev 18987) @@ -50,6 +50,7 @@ void setInterface(const std::string interfaceIP); void setUserAgent(const std::string userAgent); void setDNSCachingTime(int time); + void setDeleteOnDone(); void addFormData(const char *key, const char *value); @@ -59,24 +60,27 @@ virtual void collectData(char *ptr, int len); virtual void finalization(char *data, unsigned int length, bool good); + void performWait(); + + static bool perform(); static int fdset(fd_set &read, fd_set &write); - static bool perform(); - void performWait(); protected: void *theData; unsigned int theLen; + private: - void infoComplete(CURLcode result); static bool inited; static bool justCalled; - CURL *easyHandle; static int refs; static CURLM *multiHandle; static char errorBuffer[CURL_ERROR_SIZE]; + + CURL *easyHandle; bool added; + bool deleteOnDone; std::string usedUrl; std::string interfaceIP; std::string userAgent; Modified: trunk/bzflag/man/bzw.5.in =================================================================== --- trunk/bzflag/man/bzw.5.in 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/man/bzw.5.in 2008-11-28 03:55:39 UTC (rev 18987) @@ -78,6 +78,8 @@ .br .B world .br +.B mapinfo +.br .B options .br .B waterLevel @@ -120,6 +122,8 @@ .br .B base .br +.B text +.br .B weapon .br .B zone @@ -147,6 +151,7 @@ .br In the following examples, the values are the defaults. + .B The World object .br Header for the world. @@ -162,6 +167,31 @@ \fBend\fR .br + +.B The MapInfo object +.br +A block of text to provide information about the world. + +\fBmapinfo\fR +.br + author: bob +.br + name: bob_cool.bzw +.br + brief: bob's cool BZFlag map +.br + date: Jan 01, 2010 +.br + email: bo...@bo... +.br + url: http://bobland.bz/maps/cool/ +.br + license: http://creativecommons.org/licenses/by/3.0/us/ +.br +\fBend\fR +.br + + .B The Options object .br A world file interface for setting command line options for BZFS. @@ -215,6 +245,8 @@ .br # links .br + # text +.br # weapon .br # zone @@ -302,6 +334,20 @@ .br \fB red sequence\fR 0.0 0.0 2 0 1 1 2 0 ... # period, offset, list of states .br + # BZDB variables can also be used to control dynamic colors: +.br +\fB variable\fR _varname # the BZDB variable name +.br +\fB varTime\fR 1.0 # the transition time (in seconds) +.br +\fB varUseAlpha\fR # use the alpha channel? +.br + # the BZDB variable should contain a valid color string. +.br + # it can also be suffixed with '@ <seconds>', which will +.br + # override the varTime value for that change. +.br \fBend\fR .br @@ -812,6 +858,83 @@ .br +.B The Text object +.br +Creates a text message in the world. Although text objects can not be grouped, +they can still use all of the transformation keywords (shift, scale, spin, shear, +etc...) Text objects can also use all of the material keywords, but some of them +will not do anything (ex: texture). The 'data' value (when not being used as a +BZDB variable), can use the following escape characters: +.br + \fBshort named\fR +.br + \\\\ backslash + \\n newline + \\e escape + \\s space + \\r red + \\g green + \\b blue + \\y yellow + \\p purple + \\c cyan + \\o orange + \\w white + \\d black + \\+ bright + \\- dim + \\* blink + \\/ noblink + \\_ under + \\~ nounder + \\! reset + \\# fullreset +.br + The 'short' escapes style: '\\rred \\!then \\bblue' +.br + The 'named' escapes style: '\\(red)red \\(reset)then \\(blue)blue' + +.br +\fBtext\fR +.br +\fB name example_text\fR +.br +\fB data\fR my text string # the text, or the bzdb variable name +.br +\fB bzdb\fR # use 'data' as a BZDB variable name +.br +\fB font\fR myFontName # the font name, can use URLs +.br +\fB justify 0.0\fR # horizontal justification +.br + # 0.0 -> left justify +.br + # 0.5 -> center justify +.br + # 1.0 -> right justify +.br +\fB fontSize 18.0\fR # the resolution of the font +.br +\fB lineSpace 1.1\fR # vertical space between lines +.br +\fB fixedWidth 0.0\fR # text width control +.br + # if > 0, the initial horizontal width (relative to a height of 1) +.br + # if < 0, the longest of the lines (useless for single lines) +.br +\fB upright\fR # a shortcut for 'spin 90 1 0 0' +.br +\fB billboard\fR # orients the text towards the screen +.br +\fB polyoffset 0.0 0.0\fR # polygon offset factor and units +.br +\fB lengthPerPixel 0.0\fR # draw distance cutoff length +.br +\fBend\fR +.br + + .B The Weapon object .br Creates a world weapon, or a weapon fired automatically by the world. The weapon can either be timed or be event driven. @@ -932,6 +1055,8 @@ .br | "tetra" .br + | "text" +.br | "weapon" .br | "zone" @@ -968,6 +1093,8 @@ .br | "teleporter" <name>? .br + | "mapinfo" +.br | "options" .br | "include" <filename> @@ -1210,6 +1337,12 @@ .br | channel "sequence" <float> <float> ("0" "1" "2"){1..*} .br + | variable <bzdb_varname> +.br + | varTime <float> +.br + | varUseAlpha +.br .TP .B (CustomGate.cxx/CustomGate::read) .br @@ -1555,6 +1688,36 @@ | object .br .TP +.B (CustomWorldText.cxx/CustomWorldText::read) +.br +.TP +text := +.br + "data" <string> +.br + | "bzdb" +.br + | "font" <string> +.br + | "fontsize" <float> +.br + | "justify" <float> +.br + | "linespace" <float> +.br + | "fixedwidth" <float> +.br + | "polyoffset" <float> <float> +.br + | "billboard" +.br + | "lengthPerPixel" <float> +.br + | material +.br + | location +.br +.TP .B (CustomZone.cxx/CustomZone::read) .br .TP Modified: trunk/bzflag/plugins/lua/Makefile.am =================================================================== --- trunk/bzflag/plugins/lua/Makefile.am 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/plugins/lua/Makefile.am 2008-11-28 03:55:39 UTC (rev 18987) @@ -12,6 +12,8 @@ callouts.cpp \ constants.h \ constants.cpp \ + fetchurl.cpp \ + fetchurl.h \ mapobject.h \ mapobject.cpp \ slashcmd.h \ Modified: trunk/bzflag/plugins/lua/bzdb.cpp =================================================================== --- trunk/bzflag/plugins/lua/bzdb.cpp 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/plugins/lua/bzdb.cpp 2008-11-28 03:55:39 UTC (rev 18987) @@ -43,30 +43,30 @@ bool BZDB::PushEntries(lua_State* L) { -#define REGISTER_LUA_CFUNC(x) \ - lua_pushliteral(L, #x); \ - lua_pushcfunction(L, x); \ +#define PUSH_LUA_CFUNC(x) \ + lua_pushliteral(L, #x); \ + lua_pushcfunction(L, x); \ lua_rawset(L, -3) lua_pushliteral(L, "DB"); lua_newtable(L); - REGISTER_LUA_CFUNC(GetMap); - REGISTER_LUA_CFUNC(GetList); + PUSH_LUA_CFUNC(GetMap); + PUSH_LUA_CFUNC(GetList); - REGISTER_LUA_CFUNC(Exists); - REGISTER_LUA_CFUNC(IsPersistent); - REGISTER_LUA_CFUNC(GetDefault); + PUSH_LUA_CFUNC(Exists); + PUSH_LUA_CFUNC(IsPersistent); + PUSH_LUA_CFUNC(GetDefault); - REGISTER_LUA_CFUNC(GetInt); - REGISTER_LUA_CFUNC(GetBool); - REGISTER_LUA_CFUNC(GetFloat); - REGISTER_LUA_CFUNC(GetString); + PUSH_LUA_CFUNC(GetInt); + PUSH_LUA_CFUNC(GetBool); + PUSH_LUA_CFUNC(GetFloat); + PUSH_LUA_CFUNC(GetString); - REGISTER_LUA_CFUNC(SetInt); - REGISTER_LUA_CFUNC(SetBool); - REGISTER_LUA_CFUNC(SetFloat); - REGISTER_LUA_CFUNC(SetString); + PUSH_LUA_CFUNC(SetInt); + PUSH_LUA_CFUNC(SetBool); + PUSH_LUA_CFUNC(SetFloat); + PUSH_LUA_CFUNC(SetString); lua_rawset(L, -3); Modified: trunk/bzflag/plugins/lua/callins.cpp =================================================================== --- trunk/bzflag/plugins/lua/callins.cpp 2008-11-25 17:17:43 UTC (rev 18986) +++ trunk/bzflag/plugins/lua/callins.cpp 2008-11-28 03:55:39 UTC (rev 18987) @@ -17,6 +17,9 @@ using std::map; +static const bz_eEventType bz_eShutdown = (bz_eEventType)(bz_eLastEvent + 1); + + /******************************************************************************/ /******************************************************************************/ @@ -81,7 +84,7 @@ bool Register() { if (code > bz_eLastEvent) { - return true; + return true; // no need to register } if (!registered) { bz_registerEvent((bz_eEventType)code, this); @@ -94,7 +97,7 @@ bool Unregister() { if (code > bz_eLastEvent) { - return true; + return true; // no need to register } if (registered) { bz_removeEvent((bz_eEventType)code, this); @@ -200,13 +203,13 @@ { L = _L; -#define REGISTER_LUA_CFUNC(x) \ - lua_pushliteral(L, #x); \ - lua_pushcfunction(L, x); \ +#define PUSH_LUA_CFUNC(x) \ + lua_pushliteral(L, #x); \ + lua_pushcfunction(L, x); \ lua_rawset(L, -3) - REGISTER_LUA_CFUNC(UpdateCallIn); - REGISTER_LUA_CFUNC(GetCallIns); + PUSH_LUA_CFUNC(UpdateCallIn); + PUSH_LUA_CFUNC(GetCallIns); // scan for global call-ins -- FIXME -- remove? have lua do it? /* @@ -228,7 +231,7 @@ } -bool CallIns::Shutdown(lua_State* _L) +bool CallIns::CleanUp(lua_State* _L) { L = NULL; @@ -246,79 +249,91 @@ /******************************************************************************/ /******************************************************************************/ -#define DEFINE_CALLIN(x) \ - class CI_ ## x : public CallIn { \ - public: \ - CI_ ## x() : CallIn(bz_e ## x, #x) {} \ - ~CI_ ## x() {} \ - bool execute(bz_EventData* eventData); \ - }; \ - static CI_ ## x ci ## x +// lua plugin custom call-in +class CI_Shutdown : public CallIn { + public: + CI_Shutdown() : CallIn(bz_eShutdown, "Shutdown") {} + ~CI_Shutdown() {} + bool execute(bz_EventData* eventData); +}; +static CI_Shutdown ciShutdown; -DEFINE_CALLIN(AllowCTFCaptureEvent); -DEFINE_CALLIN(AllowFlagGrabEvent); -DEFINE_CALLIN(AllowKillCommandEvent); -DEFINE_CALLIN(AllowPlayer); -DEFINE_CALLIN(AllowSpawn); -DEFINE_CALLIN(AnointRabbitEvent); -DEFINE_CALLIN(BanEvent); -DEFINE_CALLIN(BZDBChange); -DEFINE_CALLIN(CaptureEvent); -DEFINE_CALLIN(FilteredChatMessageEvent); -DEFINE_CALLIN(FlagDroppedEvent); -DEFINE_CALLIN(FlagGrabbedEvent); -DEFINE_CALLIN(FlagResetEvent); -DEFINE_CALLIN(FlagTransferredEvent); -DEFINE_CALLIN(GameEndEvent); -DEFINE_CALLIN(GameStartEvent); -DEFINE_CALLIN(GetAutoTeamEvent); -DEFINE_CALLIN(GetPlayerInfoEvent); -DEFINE_CALLIN(GetPlayerSpawnPosEvent); -DEFINE_CALLIN(GetWorldEvent); -DEFINE_CALLIN(HostBanModifyEvent); -DEFINE_CALLIN(HostBanNotifyEvent); -DEFINE_CALLIN(IdBanEvent); -DEFINE_CALLIN(IdleNewNonPlayerConnection); -DEFINE_CALLIN(KickEvent); -DEFINE_CALLIN(KillEvent); -DEFINE_CALLIN(ListServerUpdateEvent); -DEFINE_CALLIN(LoggingEvent); -DEFINE_CALLIN(MessageFilteredEvent); -DEFINE_CALLIN(NetDataReceiveEvent); -DEFINE_CALLIN(NetDataSendEvent); -DEFINE_CALLIN(NewNonPlayerConnection); -DEFINE_CALLIN(NewRabbitEvent); -DEFINE_CALLIN(PlayerAuthEvent); -DEFINE_CALLIN(PlayerCollision); -DEFINE_CALLIN(PlayerCustomDataChanged); -DEFINE_CALLIN(PlayerDieEvent); -DEFINE_CALLIN(PlayerJoinEvent); -DEFINE_CALLIN(PlayerPartEvent); -DEFINE_CALLIN(PlayerPausedEvent); -DEFINE_CALLIN(PlayerSentCustomData); -DEFINE_CALLIN(PlayerSpawnEvent); -DEFINE_CALLIN(PlayerUpdateEvent); -DEFINE_CALLIN(RawChatMessageEvent); -DEFINE_CALLIN(ReloadEvent); -DEFINE_CALLIN(ReportFiledEvent); -DEFINE_CALLIN(ServerMsgEvent); -DEFINE_CALLIN(ShotEndedEvent); -DEFINE_CALLIN(ShotFiredEvent); -DEFINE_CALLIN(SlashCommandEvent); -DEFINE_CALLIN(TeleportEvent); -DEFINE_CALLIN(TickEvent); -DEFINE_CALLIN(UnknownSlashCommand); -DEFINE_CALLIN(WorldFinalized); -DEFINE_CALLIN(ZoneEntryEvent); -DEFINE_CALLIN(ZoneExitEvent); +#define DEFINE_CALLIN(cpp, lua) \ + class CI_ ## lua : public CallIn { \ + public: \ + CI_ ## lua() : CallIn(bz_e ## cpp, #lua) {} \ + ~CI_ ## lua() {} \ + bool execute(bz_EventData* eventData); \ + }; \ + static CI_ ## lua ci ## lua +// bz_e <C++ enum name> lua call-in name difference +// -------------------- ---------------- ---------- +DEFINE_CALLIN(AllowCTFCaptureEvent, AllowCTFCapture); // -Event +DEFINE_CALLIN(AllowFlagGrabEvent, AllowFlagGrab); // -Event +DEFINE_CALLIN(AllowKillCommandEvent, AllowKillCommand); // -Event +DEFINE_CALLIN(AllowPlayer, AllowPlayer); +DEFINE_CALLIN(AllowSpawn, AllowSpawn); +DEFINE_CALLIN(AnointRabbitEvent, AnointRabbit); // -Event +DEFINE_CALLIN(BanEvent, Ban); // -Event +DEFINE_CALLIN(BZDBChange, BZDBChange); +DEFINE_CALLIN(CaptureEvent, Capture); // -Event +DEFINE_CALLIN(FilteredChatMessageEvent, FilteredChatMessage); // -Event +DEFINE_CALLIN(FlagDroppedEvent, FlagDropped); // -Event +DEFINE_CALLIN(FlagGrabbedEvent, FlagGrabbed); // -Event +DEFINE_CALLIN(FlagResetEvent, FlagReset); // -Event +DEFINE_CALLIN(FlagTransferredEvent, FlagTransfer); // -Event +DEFINE_CALLIN(GameEndEvent, GameEnd); // -Event +DEFINE_CALLIN(GameStartEvent, GameStart); // -Event +DEFINE_CALLIN(GetAutoTeamEvent, GetAutoTeam); // -Event +DEFINE_CALLIN(GetPlayerInfoEvent, GetPlayerInfo); // -Event +DEFINE_CALLIN(GetPlayerSpawnPosEvent, GetPlayerSpawnPos); // -Event +DEFINE_CALLIN(GetWorldEvent, GetWorld); // -Event +//DEFINE_CALLIN(HostBanModifyEvent, HostBanModify); // unused +DEFINE_CALLIN(HostBanNotifyEvent, HostBan); // -Event- +DEFINE_CALLIN(IdBanEvent, IdBan); // -Event +DEFINE_CALLIN(IdleNewNonPlayerConnection, IdleNewNonPlayerConnection); +DEFINE_CALLIN(KickEvent, Kick); // -Event +DEFINE_CALLIN(KillEvent, Kill); // -Event +DEFINE_CALLIN(ListServerUpdateEvent, ListServerUpdate); // -Event +DEFINE_CALLIN(LoggingEvent, Logging); // -Event +//DEFINE_CALLIN(Shutdown, Shutdown); // custom +DEFINE_CALLIN(MessageFilteredEvent, MessageFiltered); // -Event +DEFINE_CALLIN(NetDataReceiveEvent, NetDataReceive); // -Event +DEFINE_CALLIN(NetDataSendEvent, NetDataSend); // -Event +DEFINE_CALLIN(NewNonPlayerConnection, NewNonPlayerConnection); +DEFINE_CALLIN(NewRabbitEvent, NewRabbit); // -Event +DEFINE_CALLIN(PlayerAuthEvent, PlayerAuth); // -Event +DEFINE_CALLIN(PlayerCollision, PlayerCollision); +DEFINE_CALLIN(PlayerCustomDataChanged, PlayerCustomDataChanged); +DEFINE_CALLIN(PlayerDieEvent, PlayerDied); // -Event+d +DEFINE_CALLIN(PlayerJoinEvent, PlayerJoined); // -Event+ed +DEFINE_CALLIN(PlayerPartEvent, PlayerParted); // -Event+ed +DEFINE_CALLIN(PlayerPausedEvent, PlayerPaused); // -Event +DEFINE_CALLIN(PlayerSentCustomData, PlayerSentCustomData); +DEFINE_CALLIN(PlayerSpawnEvent, PlayerSpawned); // -Event+ed +DEFINE_CALLIN(PlayerUpdateEvent, PlayerUpdate); // -Event +DEFINE_CALLIN(RawChatMessageEvent, RawChatMessage); // -Event +DEFINE_CALLIN(ReloadEvent, Reload); // -Event +DEFINE_CALLIN(ReportFiledEvent, ReportFiled); // -Event +DEFINE_CALLIN(ServerMsgEvent, ServerMsg); // -Event +DEFINE_CALLIN(ShotEndedEvent, ShotEnded); // -Event +DEFINE_CALLIN(ShotFiredEvent, ShotFired); // -Event +DEFINE_CALLIN(SlashCommandEvent, SlashCommand); // -Event +DEFINE_CALLIN(TeleportEvent, Teleport); // -Event +DEFINE_CALLIN(TickEvent, Tick); // -Event +DEFINE_CALLIN(UnknownSlashCommand, UnknownSlashCommand); +DEFINE_CALLIN(WorldFinalized, WorldFinalized); +DEFINE_CALLIN(ZoneEntryEvent, ZoneEntry); // -Event +DEFINE_CALLIN(ZoneExitEvent, ZoneExit); // -Event + + /******************************************************************************/ /******************************************************************************/ - -bool CI_AllowCTFCaptureEvent::execute(bz_EventData* eventData) +bool CI_AllowCTFCapture::execute(bz_EventData* eventData) { bz_AllowCTFCaptureEventData_V1* ed = (bz_AllowCTFCaptureEventData_V1*)eventData; @@ -352,7 +367,7 @@ } -bool CI_AllowFlagGrabEvent::execute(bz_EventData* eventData) +bool CI_AllowFlagGrab::execute(bz_EventData* eventData) { bz_AllowFlagGrabEventData_V1* ed = (bz_AllowFlagGrabEventData_V1*)eventData; @@ -375,13 +390,14 @@ if (lua_isboolean(L, -1)) { ed->allow = lua_toboolean(L, -1); } + lua_pop(L, 1); return true; } -bool CI_AllowKillCommandEvent::execute(bz_EventData* eventData) +bool CI_AllowKillCommand::execute(bz_EventData* eventData) { bz_AllowKillCommandEventData_V1* ed = (bz_AllowKillCommandEventData_V1*)eventData; @@ -399,6 +415,7 @@ if (lua_isboolean(L, -1)) { ed->allow = lua_toboolean(L, -1); } + lua_pop(L, 1); return true; @@ -451,8 +468,8 @@ if (lua_isboolean(L, -1)) { ed->allow = lua_toboolean(L, -1); + // ed->handled = true; FIXME? } - // bool handled; ? lua_pop(L, 1); @@ -460,7 +477,7 @@ } -bool CI_AnointRabbitEvent::execute(bz_EventData* eventData) +bool CI_AnointRabbit::execute(bz_EventData* eventData) { bz_AnointRabbitEventData_V1* ed = (bz_AnointRabbitEventData_V1*)eventData; @@ -485,7 +502,7 @@ } -bool CI_BanEvent::execute(bz_EventData* eventData) +bool CI_Ban::execute(bz_EventData* eventData) { bz_BanEventData_V1* ed = (bz_BanEventData_V1*)eventData; @@ -518,7 +535,7 @@ } -bool CI_CaptureEvent::execute(bz_EventData* eventData) +bool CI_Capture::execute(bz_EventData* eventData) { bz_CTFCaptureEventData_V1* ed = (bz_CTFCaptureEventData_V1*)eventData; @@ -538,7 +555,7 @@ } -bool CI_FilteredChatMessageEvent::execute(bz_EventData* eventData) +bool CI_FilteredChatMessage::execute(bz_EventData* eventData) { bz_ChatEventData_V1* ed = (bz_ChatEventData_V1*)eventData; @@ -554,7 +571,7 @@ } -bool CI_FlagDroppedEvent::execute(bz_EventData* eventData) +bool CI_FlagDropped::execute(bz_EventData* eventData) { bz_FlagDroppedEventData_V1* ed = (bz_FlagDroppedEventData_V1*)eventData; @@ -573,7 +590,7 @@ } -bool CI_FlagGrabbedEvent::execute(bz_EventData* eventData) +bool CI_FlagGrabbed::execute(bz_EventData* eventData) { bz_FlagGrabbedEventData_V1* ed = (bz_FlagGrabbedEventData_V1*)eventData; @@ -593,7 +610,7 @@ } -bool CI_FlagResetEvent::execute(bz_EventData* eventData) +bool CI_FlagReset::execute(bz_EventData* eventData) { bz_FlagResetEventData_V1* ed = (bz_FlagResetEventData_V1*)eventData; @@ -613,7 +630,7 @@ } -bool CI_FlagTransferredEvent::execute(bz_EventData* eventData) +bool CI_FlagTransfer::execute(bz_EventData* eventData) { bz_FlagTransferredEventData_V1* ed = (bz_FlagTransferredEventData_V1*)eventData; @@ -639,7 +656,7 @@ } -bool CI_GameEndEvent::execute(bz_EventData* eventData) +bool CI_GameEnd::execute(bz_EventData* eventData) { bz_GameStartEndEventData_V1* ed = (bz_GameStartEndEventData_V1*)eventData; @@ -653,7 +670,7 @@ } -bool CI_GameStartEvent::execute(bz_EventData* eventData) +bool CI_GameStart::execute(bz_EventData* eventData) { bz_GameStartEndEventData_V1* ed = (bz_GameStartEndEventData_V1*)eventData; @@ -667,7 +684,7 @@ } -bool CI_GetAutoTeamEvent::execute(bz_EventData* eventData) +bool CI_GetAutoTeam::execute(bz_EventData* eventData) { bz_GetAutoTeamEventData_V1* ed = (bz_GetAutoTeamEventData_V1*)eventData; @@ -692,7 +709,7 @@ } -bool CI_GetPlayerInfoEvent::execute(bz_EventData* eventData) +bool CI_GetPlayerInfo::execute(bz_EventData* eventData) { bz_GetPlayerInfoEventData_V1* ed = (bz_GetPlayerInfoEventData_V1*)eventData; @@ -722,7 +739,7 @@ } -bool CI_GetPlayerSpawnPosEvent::execute(bz_EventData* eventData) +bool CI_GetPlayerSpawnPos::execute(bz_EventData* eventData) { bz_GetPlayerSpawnPosEventData_V1* ed = (bz_GetPlayerSpawnPosEventData_V1*)eventData; @@ -762,7 +779,7 @@ } -bool CI_GetWorldEvent::execute(bz_EventData* eventData) +bool CI_GetWorld::execute(bz_EventData* eventData) { bz_GetWorldEventData_V1* ed = (bz_GetWorldEventData_V1*)eventData; @@ -831,7 +848,8 @@ } -bool CI_HostBanModifyEvent::execute(bz_EventData* eventData) +/* unused +bool CI_HostBanModify::execute(bz_EventData* eventData) { bz_HostBanEventData_V1* ed = (bz_HostBanEventData_V1*)eventData; @@ -846,9 +864,10 @@ return RunCallIn(4, 0); } +*/ -bool CI_HostBanNotifyEvent::execute(bz_EventData* eventData) +bool CI_HostBan::execute(bz_EventData* eventData) { bz_HostBanEventData_V1* ed = (bz_HostBanEventData_V1*)eventData; @@ -865,7 +884,7 @@ } -bool CI_IdBanEvent::execute(bz_EventData* eventData) +bool CI_IdBan::execute(bz_EventData* eventData) { bz_IdBanEventData_V1* ed = (bz_IdBanEventData_V1*)eventData; @@ -898,7 +917,7 @@ } -bool CI_KickEvent::execute(bz_EventData* eventData) +bool CI_Kick::execute(bz_EventData* eventData) { bz_KickEventData_V1* ed = (bz_KickEventData_V1*)eventData; @@ -914,7 +933,7 @@ } -bool CI_KillEvent::execute(bz_EventData* eventData) +bool CI_Kill::execute(bz_EventData* eventData) { bz_KillEventData_V1* ed = (bz_KillEventData_V1*)eventData; @@ -930,7 +949,7 @@ } -bool CI_ListServerUpdateEvent::execute(bz_EventData* eventData) +bool CI_ListServerUpdate::execute(bz_EventData* eventData) { bz_ListServerUpdateEvent_V1* ed = (bz_ListServerUpdateEvent_V1*)eventData; @@ -948,7 +967,7 @@ } -bool CI_LoggingEvent::execute(bz_EventData* eventData) +bool CI_Logging::execute(bz_EventData* eventData) { bz_LoggingEventData_V1* ed = (bz_LoggingEventData_V1*)eventData; @@ -963,8 +982,17 @@ } -bool CI_MessageFilteredEvent::execute(bz_EventData* eventData) +bool CI_Shutdown::execute(bz_EventData* eventData) { + if (!PushCallIn(2)) { + return false; + } + return RunCallIn(0, 0); +} + + +bool CI_MessageFiltered::execute(bz_EventData* eventData) +{ bz_MessageFilteredEventData_V1* ed = (bz_MessageFilteredEventData_V1*)eventData; if (!PushCallIn(5)) { @@ -979,7 +1007,7 @@ } -bool CI_NetDataReceiveEvent::execute(bz_EventData* eventData) +bool CI_NetDataReceive::execute(bz_EventData* eventData) { bz_NetTransferEventData_V1* ed = (bz_NetTransferEventData_V1*)eventData; @@ -996,7 +1024,7 @@ } -bool CI_NetDataSendEvent::execute(bz_EventData* eventData) +bool CI_NetDataSend::execute(bz_EventData* eventData) { bz_NetTransferEventData_V1* ed = (bz_NetTransferEventData_V1*)eventData; @@ -1028,7 +1056,7 @@ } -bool CI_NewRabbitEvent::execute(bz_EventData* eventData) +bool CI_NewRabbit::execute(bz_EventData* eventData) { bz_NewRabbitEventData_V1* ed = (bz_NewRabbitEventData_V1*)eventData; @@ -1042,7 +1070,7 @@ } -bool CI_PlayerAuthEvent::execute(bz_EventData* eventData) +bool CI_PlayerAuth::execute(bz_EventData* eventData) { bz_PlayerAuthEventData_V1* ed = (bz_PlayerAuthEventData_V1*)eventData; @@ -1107,7 +1135,7 @@ } -bool CI_PlayerDieEvent::execute(bz_EventData* eventData) +bool CI_PlayerDied::execute(bz_EventData* eventData) { bz_PlayerDieEventData_V1* ed = (bz_PlayerDieEventData_V1*)eventData; @@ -1131,7 +1159,7 @@ } -bool CI_PlayerJoinEvent::execute(bz_EventData* eventData) +bool CI_PlayerJoined::execute(bz_EventData* eventData) { bz_PlayerJoinPartEventData_V1* ed = (bz_PlayerJoinPartEventData_V1*)eventData; @@ -1149,7 +1177,7 @@ } -bool CI_PlayerPartEvent::execute(bz_EventData* eventData) +bool CI_PlayerParted::execute(bz_EventData* eventData) { bz_PlayerJoinPartEventData_V1* ed = (bz_PlayerJoinPartEventData_V1*)eventData; @@ -1167,7 +1195,7 @@ } -bool CI_PlayerPausedEvent::execute(bz_EventData* eventData) +bool CI_PlayerPaused::execute(bz_EventData* eventData) { bz_PlayerPausedEventData_V1* ed = (bz_PlayerPausedEventData_V1*)eventData; @@ -1198,7 +1226,7 @@ } -bool CI_PlayerSpawnEvent::execute(bz_EventData* eventData) +bool CI_PlayerSpawned::execute(bz_EventData* eventData) { bz_PlayerSpawnEventData_V1* ed = (bz_PlayerSpawnEventData_V1*)eventData; @@ -1221,7 +1249,7 @@ } -bool CI_PlayerUpdateEvent::execute(bz_EventData* eventData) +bool CI_PlayerUpdate::execute(bz_EventData* eventData) { bz_PlayerUpdateEventData_V1* ed = (bz_PlayerUpdateEventData_V1*)eventData; @@ -1255,7 +1283,7 @@ } -bool CI_RawChatMessageEvent::execute(bz_EventData* eventData) +bool CI_RawChatMessage::execute(bz_EventData* eventData) { bz_ChatEventData_V1* ed = (bz_ChatEventData_V1*)eventData; @@ -1281,7 +1309,7 @@ } -bool CI_ReloadEvent::execute(bz_EventData* eventData) +bool CI_Reload::execute(bz_EventData* eventData) { bz_ReloadEventData_V1* ed = (bz_ReloadEventData_V1*)eventData; @@ -1295,7 +1323,7 @@ } -bool CI_ReportFiledEvent::execute(bz_EventData* eventData) +bool CI_ReportFiled::execute(bz_EventData* eventData) { bz_ReportFiledEventData_V1* ed = (bz_ReportFiledEventData_V1*)eventData; @@ -1310,7 +1338,7 @@ } -bool CI_ServerMsgEvent::execute(bz_EventData* eventData) +bool CI_ServerMsg::execute(bz_EventData* eventData) { bz_ServerMsgEventData_V1* ed = (bz_ServerMsgEventData_V1*)eventData; @@ -1326,7 +1354,7 @@ } -bool CI_ShotEndedEvent::execute(bz_EventData* eventData) +bool CI_ShotEnded::execute(bz_EventData* eventData) { bz_ShotEndedEventData_V1* ed = (bz_ShotEndedEventData_V1*)eventData; @@ -1342,7 +1370,7 @@ } -bool CI_ShotFiredEvent::execute(bz_EventData* eventData) +bool CI_ShotFired::execute(bz_EventData* eventData) { bz_ShotFiredEventData_V1* ed = (bz_ShotFiredEventData_V1*)eventData; @@ -1362,7 +1390,7 @@ } -bool CI_SlashCommandEvent::execute(bz_EventData* eventData) +bool CI_SlashCommand::execute(bz_EventData* eventData) { bz_SlashCommandEventData_V1* ed = (bz_SlashCommandEventData_V1*)eventData; @@ -1377,7 +1405,7 @@ } -bool CI_TeleportEvent::execute(bz_EventData* eventData) +bool CI_Teleport::execute(bz_EventData* eventData) { bz_TeleportEventData_V1* ed = (bz_TeleportEventData_V1*)eventData; @@ -1393,7 +1421,7 @@ } -bool CI_TickEvent::execute(bz_EventData* eventData) +bool CI_Tick::execute(bz_EventData* eventData) { bz_TickEventData_V1* ed = (bz_TickEventData_V1*)eventData; @@ -1443,7 +1471,7 @@ } -bool CI_ZoneEntryEvent::execute(bz_EventData* eventData) +bool CI_ZoneEntry::execute(bz_EventData* eventData) { // FIXME -- not implemented ? if (!PushCallIn(2)) { @@ -1453,7 +1481,7 @@ } -bool CI_ZoneExitEvent::execute(bz_EventData* eventData) +bool CI_ZoneExit::execute(bz_EventData* eventData) { // FIXME -- not implemented ? if (!PushCallIn(2)) { @@ -1465,3 +1493,13 @@ /*****************************************************************... [truncated message content] |