Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- comparing with https://code.google.com/r/bmartin9x-bitfighter/
- searching for changes
- diff -r 70cdfe0ad762 -r da40340a2909 zap/CoreGame.cpp
- --- a/zap/CoreGame.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/CoreGame.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -279,15 +279,33 @@
- setStartingHealth(F32(CoreDefaultStartingHealth) / DamageReductionRatio); // Hits to kill
- mHasExploded = false;
- -
- mHeartbeatTimer.reset(CoreHeartbeatStartInterval);
- mCurrentExplosionNumber = 0;
- -
- mPanelGeom.isValid = false;
- mKillString = "crashed into a core"; // TODO: Really needed?
- LUAW_CONSTRUCTOR_INITIALIZATIONS;
- +
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, TEAM_INDX, END }, { GEOM, TEAM_INDX, INT, END }}, 3 };
- + S32 profile = checkArgList(L, constructorArgList, "CoreItem", "constructor");
- + if(profile == 1)
- + {
- + setPos(getPointOrXY(L, 1));
- + setTeam(getInt(L, 2));
- + }
- + else if(profile == 2)
- + {
- + setPos(getPointOrXY(L, 1));
- + setTeam(getInt(L, 2));
- + setStartingHealth(getInt(L, 3));
- + // I've got no idea why this works and getInt(L, 2) doesn't.
- + //mSpawnTime = S32(getInt(L, 3) * 1000);
- + //mTimer.reset(mSpawnTime);
- + }
- + }
- }
- diff -r 70cdfe0ad762 -r da40340a2909 zap/EngineeredItem.cpp
- --- a/zap/EngineeredItem.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/EngineeredItem.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -1689,10 +1689,20 @@
- // Combined Lua / C++ default constructor
- Turret::Turret(lua_State *L) : Parent(TEAM_NEUTRAL, Point(0,0), Point(1,0))
- {
- + // TODO: This does not work; we need to snap the turret to a nearby wall and compute the normal angle.
- + // It is likely that setPos is similarly broken. And maybe more.
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, TEAM_INDX, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "Turret", "constructor");
- + findMountPoint(Game::getAddTarget(), getPos());
- + if(profile == 1)
- + {
- + findMountPoint(gServerGame, getPointOrXY(L, 1));
- + setTeam(getInt(L, 2));
- + }
- + }
- initialize();
- -
- - if(L)
- - findMountPoint(Game::getAddTarget(), getPos());
- }
- @@ -2039,6 +2049,8 @@
- /////
- // Lua interface
- /**
- + * @luafunc Turret::Turret()
- + * @luafunc Turret::Turret(geom, team)
- * @luaclass Turret
- * @brief Mounted gun that shoots at enemy ships and other objects.
- */
- diff -r 70cdfe0ad762 -r da40340a2909 zap/Spawn.cpp
- --- a/zap/Spawn.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/Spawn.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -206,7 +206,16 @@
- // Lua constructor
- Spawn::Spawn(lua_State *L) : AbstractSpawn(Point(0,0))
- {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }, { GEOM, TEAM_INDX, END }}, 3 };
- + S32 profile = checkArgList(L, constructorArgList, "Spawn", "constructor");
- initialize();
- + if(L && profile == 1)
- + setPos(getPointOrXY(L, 1));
- + else if(L && profile == 2)
- + {
- + setPos(getPointOrXY(L, 1));
- + setTeam(getInt(L, 2));
- + }
- }
- @@ -289,6 +298,9 @@
- /////
- // Lua interface
- /**
- + * @luafunc Spawn::Spawn()
- + * @luafunc Spawn::Spawn(geom)
- + * @luafunc Spawn::Spawn(geom, team)
- * @luaclass Spawn
- * @brief Marks locations where ships and robots should spawn.
- * @geom The geometry of Spawns is a single point.
- @@ -435,6 +447,22 @@
- AsteroidSpawn::AsteroidSpawn(lua_State *L) : Parent(Point(0,0), DEFAULT_RESPAWN_TIME)
- {
- initialize();
- +
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }, { GEOM, INT, END }}, 3 };
- + S32 profile = checkArgList(L, constructorArgList, "AsteroidSpawn", "constructor");
- + initialize();
- + if(profile == 1)
- + setPos(getPointOrXY(L, 1));
- + else if(profile == 2)
- + {
- + setPos(getPointOrXY(L, 1));
- + // I've got no idea why this works and getInt(L, 2) doesn't.
- + mSpawnTime = S32(getInt(L, 3) * 1000);
- + mTimer.reset(mSpawnTime);
- + }
- + }
- }
- @@ -529,6 +557,9 @@
- /////
- // Lua interface
- /**
- + * @luafunc AsteroidSpawn::AsteroidSpawn()
- + * @luafunc AsteroidSpawn::AsteroidSpawn(geom)
- + * @luafunc AsteroidSpawn::AsteroidSpawn(geom, time)
- * @luaclass AsteroidSpawn
- * @brief Spawns \link Asteroid Asteroids \endlink at regular intervals.
- * @geom The geometry of AsteroidSpawns is a single point.
- @@ -562,6 +593,21 @@
- CircleSpawn::CircleSpawn(lua_State *L) : Parent(Point(0,0), DEFAULT_RESPAWN_TIME)
- {
- initialize();
- +
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }, { GEOM, INT, END }}, 3 };
- + S32 profile = checkArgList(L, constructorArgList, "CircleSpawn", "constructor");
- + if(profile == 1)
- + setPos(getPointOrXY(L, 1));
- + else if(profile == 2)
- + {
- + setPos(getPointOrXY(L, 1));
- + // I've got no idea why this works and getInt(L, 2) doesn't.
- + mSpawnTime = S32(getInt(L, 3) * 1000);
- + mTimer.reset(mSpawnTime);
- + }
- + }
- }
- @@ -658,6 +704,9 @@
- /////
- // Lua interface
- /**
- + * @luafunc CircleSpawn::CircleSpawn()
- + * @luafunc CircleSpawn::CircleSpawn(geom)
- + * @luafunc CircleSpawn::CircleSpawn(geom, time)
- * @luaclass CircleSpawn
- * @brief Spawns \link Circle Circles \endlink at regular intervals.
- * @geom The geometry of CircleSpawns is a single point.
- diff -r 70cdfe0ad762 -r da40340a2909 zap/UIGame.cpp
- --- a/zap/UIGame.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/UIGame.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -2290,7 +2290,7 @@
- { "addbots", &GameUserInterface::addBotsHandler, { xINT, STR, TEAM, STR }, 4, LEVEL_COMMANDS, 1, 2, {"[count]","[file]","[team name or num]","[args]"}, "Add [count] bots from [file] to [team num], pass [args] to bot" },
- { "kickbot", &GameUserInterface::kickBotHandler, { }, 0, LEVEL_COMMANDS, 1, 1, { }, "Kick most recently added bot" },
- { "kickbots", &GameUserInterface::kickBotsHandler, { }, 0, LEVEL_COMMANDS, 1, 1, { }, "Kick all bots" },
- - {"announce", &GameUserInterface::announceHandler, { STR }, 1, ADMIN_COMMANDS, 0, 1, {"<ANNOUNCEMENT>"}, "The admin announces an important message" },
- + {"announce", &GameUserInterface::announceHandler, { STR }, 1, ADMIN_COMMANDS, 0, 1, {"<ANNOUNCEMENT>"}, "The admin announces an important message" },
- { "kick", &GameUserInterface::kickPlayerHandler, { NAME }, 1, ADMIN_COMMANDS, 0, 1, {"<name>"}, "Kick a player from the game" },
- { "ban", &GameUserInterface::banPlayerHandler, { NAME, xINT }, 2, ADMIN_COMMANDS, 0, 1, {"<name>","[duration]"}, "Ban a player from the server (IP-based, def. = 60 mins)" },
- diff -r 70cdfe0ad762 -r da40340a2909 zap/Zone.cpp
- --- a/zap/Zone.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/Zone.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -26,6 +26,7 @@
- #include "Zone.h"
- #include "game.h"
- #include "stringUtils.h"
- +#include "Geometry.h"
- namespace Zap
- {
- @@ -36,6 +37,17 @@
- // Combined Lua / C++ constructor)
- Zone::Zone(lua_State *L)
- {
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "Zone", "constructor");
- +
- + if(profile == 1)
- + {
- + setGeom(L, 1);
- + }
- + }
- +
- setTeam(TEAM_NEUTRAL);
- mObjectTypeNumber = ZoneTypeNumber;
- @@ -148,7 +160,9 @@
- /////
- // Lua interface
- -/**
- +/**
- + * @luafunc Zone::Zone()
- + * @luafunc Zone::Zone(geom)
- * @luaclass Zone
- * @brief Invisible objects, used mainly for generating events.
- */
- diff -r 70cdfe0ad762 -r da40340a2909 zap/barrier.cpp
- --- a/zap/barrier.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/barrier.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -31,6 +31,7 @@
- #include "game.h"
- #include "config.h"
- #include "stringUtils.h"
- +#include "LuaWrapper.h"
- #ifndef ZAP_DEDICATED
- # include "OpenglUtils.h"
- @@ -349,6 +350,18 @@
- mAlreadyAdded = false;
- setNewGeometry(geomPolyLine);
- +
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, INT, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "WallItem", "constructor");
- + if(profile == 1)
- + {
- + setWidth(lua_tointeger(L, -1));
- + lua_pop(L, 1);
- + setGeom(L);
- + }
- + }
- LUAW_CONSTRUCTOR_INITIALIZATIONS;
- }
- @@ -571,6 +584,8 @@
- /////
- // Lua interface
- /**
- + * @luafunc WallItem::WallItem()
- + * @luafunc WallItem::WallItem(geom, thickness)
- * @luaclass WallItem
- * @brief Traditional wall item.
- * @descr A %WallItem is a traditional wall consisting of a series of straight-line segments. WallItems have a width setting that
- diff -r 70cdfe0ad762 -r da40340a2909 zap/flagItem.cpp
- --- a/zap/flagItem.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/flagItem.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -45,6 +45,21 @@
- FlagItem::FlagItem(lua_State *L) : Parent(Point(0,0), true, (F32)Ship::CollisionRadius) // radius was 20
- {
- initialize();
- +
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }, { GEOM, TEAM_INDX, END }}, 3 };
- + S32 profile = checkArgList(L, constructorArgList, "FlagItem", "constructor");
- + if(profile == 1)
- + {
- + setPos(getPointOrXY(L, 1));
- + }
- + else if(profile == 2)
- + {
- + setPos(getPointOrXY(L, 1));
- + setTeam(getInt(L, 2));
- + }
- + }
- }
- @@ -396,6 +411,9 @@
- // Lua interface
- /**
- + * @luafunc FlagItem::FlagItem()
- + * @luafunc FlagItem::FlagItem(geom)
- + * @luafunc FlagItem::FlagItem(geom, team)
- * @luaclass FlagItem
- * @brief Flags are used in many games, such as Nexus and Capture The Flag (CTF).
- * @geom The geometry of a %FlagItem is a point.
- diff -r 70cdfe0ad762 -r da40340a2909 zap/moveObject.cpp
- --- a/zap/moveObject.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/moveObject.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -1310,6 +1310,16 @@
- mDesign = TNL::Random::readI(0, ASTEROID_DESIGNS - 1);
- mKillString = "crashed into an asteroid";
- +
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "Asteroid", "constructor");
- + if(profile == 1)
- + {
- + setPos(getPointOrXY(L, 1));
- + }
- + }
- LUAW_CONSTRUCTOR_INITIALIZATIONS;
- }
- @@ -1601,6 +1611,8 @@
- // Lua interface
- /**
- + * @luafunc Asteroid::Asteroid()
- + * @luafunc Asteroid::Asteroid(geom)
- * @luaclass Asteroid
- * @brief Just like the arcade game! Yo!
- */
- diff -r 70cdfe0ad762 -r da40340a2909 zap/projectile.cpp
- --- a/zap/projectile.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/projectile.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -1017,7 +1017,20 @@
- // Combined Lua / C++ default constructor -- used in Lua and editor
- SpyBug::SpyBug(lua_State *L) : Burst(Point(0,0), Point(0,0), NULL)
- {
- - initialize(Point(0,0), NULL);
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, TEAM_INDX, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "SpyBug", "constructor");
- +
- + if(profile == 0)
- + initialize(Point(0,0), NULL);
- + else if(profile == 1)
- + {
- + initialize(Point(0,0), NULL);
- + setPos(getPointOrXY(L, 1));
- + setTeam(getInt(L, 2));
- + }
- + }
- }
- @@ -1240,6 +1253,14 @@
- /////
- // Lua interface
- +/**
- + * @luafunc SpyBug::SpyBug()
- + * @luafunc SpyBug::SpyBug(geom, team)
- + * @luaclass SpyBug
- + * @brief Monitors a section of the map and will show enemy ships there.
- + * @descr Can only be used/created if the Sensor module is selected.
- + * Makes surrounding areas of the commander's map visible to player and teammates.
- + */
- // Fn name Param profiles Profile count
- #define LUA_METHODS(CLASS, METHOD) \
- diff -r 70cdfe0ad762 -r da40340a2909 zap/speedZone.cpp
- --- a/zap/speedZone.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/speedZone.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -63,6 +63,9 @@
- // Combined C++/Lua constructor
- SpeedZone::SpeedZone(lua_State *L)
- {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }, { GEOM, NUM, END }}, 3 };
- + S32 profile = checkArgList(L, constructorArgList, "SpeedZone", "constructor");
- +
- mNetFlags.set(Ghostable);
- mObjectTypeNumber = SpeedZoneTypeNumber;
- @@ -72,6 +75,14 @@
- mUnpackInit = 0; // Some form of counter, to know that it is a rotating speed zone
- preparePoints(); // If this is constructed by Lua, we need to have some default geometry in place
- +
- + if(L && profile == 1)
- + setPos(getPointOrXY(L, 1));
- + else if(L && profile == 2)
- + {
- + setPos(getPointOrXY(L, 1));
- + setSpeed(getInt(L, 2));
- + }
- LUAW_CONSTRUCTOR_INITIALIZATIONS;
- }
- @@ -530,6 +541,9 @@
- //// Lua methods
- /**
- + * @luafunc SpeedZone::SpeedZone()
- + * @luafunc SpeedZone::SpeedZone(geom)
- + * @luafunc SpeedZone::SpeedZone(geom, speed)
- * @luaclass SpeedZone
- * @brief Propels ships at high speed.
- * @descr SpeedZones are game objects that propel ships around a level. Each %SpeedZone has a direction point
- diff -r 70cdfe0ad762 -r da40340a2909 zap/teleporter.cpp
- --- a/zap/teleporter.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/teleporter.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -86,13 +86,11 @@
- {
- TNLAssert(mOwner, "We need an owner here!");
- mDests.push_back(dest);
- -
- if(mDests.size() == 1) // Just added the first dest
- {
- mOwner->setVert(dest, 1);
- mOwner->updateExtentInDatabase();
- }
- -
- // If we're the server, update the clients
- if(mOwner->getGame() && mOwner->getGame()->isServer())
- mOwner->s2cAddDestination(dest);
- @@ -177,7 +175,16 @@
- // Combined default C++/Lua constructor
- Teleporter::Teleporter(lua_State *L)
- {
- - initialize(Point(0,0), Point(0,0), NULL);
- + initialize(Point(0,0),Point(0,0),NULL);
- + // TODO: Fix this one too -- intiailze needs to be refactored because who knows
- + // how many points the teleporter is getting? could be 1, could be 2, could be many
- + if(L)
- + {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "Teleporter", "constructor");
- + if(profile == 1)
- + setPos(getPointOrXY(L, 1));
- + }
- }
- @@ -858,6 +865,8 @@
- //// Lua methods
- /**
- + * @luafunc Teleporter::Teleporter()
- + * @luafunc Teleporter::Teleporter(geom)
- * @luaclass Teleporter
- * @brief Instantly transports ships from here to there.
- * @descr A %Teleporter represents the basic teleporter object. Every teleporter has an intake location
- diff -r 70cdfe0ad762 -r da40340a2909 zap/textItem.cpp
- --- a/zap/textItem.cpp Sun Jan 13 11:57:17 2013 +0100
- +++ b/zap/textItem.cpp Sun Jan 13 12:05:03 2013 +0100
- @@ -53,6 +53,9 @@
- // Combined Lua / C++ constructor
- TextItem::TextItem(lua_State *L)
- {
- + static LuaFunctionArgList constructorArgList = { {{ END }, { GEOM, STR, END }}, 2 };
- + S32 profile = checkArgList(L, constructorArgList, "Spawn", "constructor");
- +
- mNetFlags.set(Ghostable);
- mObjectTypeNumber = TextItemTypeNumber;
- @@ -60,6 +63,12 @@
- mSize = 20;
- LUAW_CONSTRUCTOR_INITIALIZATIONS;
- +
- + if(L && profile == 1)
- + {
- + setPos(getPointOrXY(L, 1));
- + setText(getString(L, 2));
- + }
- }
- @@ -426,6 +435,8 @@
- //// Lua methods
- /**
- + * @luafunc TextItem::TextItem()
- + * @luafunc TextItem::TextItem(geom, text)
- * @luaclass TextItem
- * @brief Display text message in level.
- * @descr A %TextItem displays text in a level. If the %TextItem belongs to a team, it is only visible to players on that team.
Advertisement
Add Comment
Please, Sign In to add comment