--- a/QTfrontend/team.cpp Mon May 28 17:54:23 2012 +0400
+++ b/QTfrontend/team.cpp Mon May 28 20:04:49 2012 +0400
@@ -37,6 +37,7 @@
OldTeamName = m_name;
for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
+ m_hedgehogs.append(HWHog());
m_hedgehogs[i].Name = (QLineEdit::tr("hedgehog %1").arg(i+1));
m_hedgehogs[i].Hat = "NoHat";
}
@@ -46,6 +47,7 @@
m_flag = "hedgewars";
for(int i = 0; i < BINDS_NUMBER; i++)
{
+ m_binds.append(BindAction());
m_binds[i].action = cbinds[i].action;
m_binds[i].strbind = cbinds[i].strbind;
}
@@ -70,6 +72,7 @@
m_difficulty = strLst[6].toUInt();
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
+ m_hedgehogs.append(HWHog());
m_hedgehogs[i].Name=strLst[i * 2 + 7];
m_hedgehogs[i].Hat=strLst[i * 2 + 8];
// Somehow claymore managed an empty hat. Until we figure out how, this should avoid a repeat
@@ -90,6 +93,7 @@
m_name = QString("Team");
for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
+ m_hedgehogs.append(HWHog());
m_hedgehogs[i].Name.sprintf("hedgehog %d", i);
m_hedgehogs[i].Hat = "NoHat";
}
@@ -101,6 +105,7 @@
for(int i = 0; i < BINDS_NUMBER; i++)
{
+ m_binds.append(BindAction());
m_binds[i].action = cbinds[i].action;
m_binds[i].strbind = cbinds[i].strbind;
}
@@ -347,7 +352,7 @@
void HWTeam::setColor(int color)
{
- m_color = color;
+ m_color = color % colorsModel->rowCount();
}
--- a/QTfrontend/team.h Mon May 28 17:54:23 2012 +0400
+++ b/QTfrontend/team.h Mon May 28 20:04:49 2012 +0400
@@ -113,9 +113,9 @@
QString m_fort;
QString m_flag;
QString m_voicepack;
- HWHog m_hedgehogs[HEDGEHOGS_PER_TEAM];
+ QList<HWHog> m_hedgehogs;
quint8 m_difficulty;
- BindAction m_binds[BINDS_NUMBER];
+ QList<BindAction> m_binds;
// class members that contain info for the current game setup
quint8 m_numHedgehogs;
--- a/hedgewars/uGears.pas Mon May 28 17:54:23 2012 +0400
+++ b/hedgewars/uGears.pas Mon May 28 20:04:49 2012 +0400
@@ -455,6 +455,7 @@
end;
ScriptCall('onGameTick');
+if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
inc(GameTicks)
end;
--- a/hedgewars/uScript.pas Mon May 28 17:54:23 2012 +0400
+++ b/hedgewars/uScript.pas Mon May 28 20:04:49 2012 +0400
@@ -150,7 +150,7 @@
lua_pushnil(L);
end
else
- lua_pushinteger(L, lua_tointeger(L, 2) div lua_tointeger(L, 1));
+ lua_pushinteger(L, lua_tointeger(L, 1) div lua_tointeger(L, 2));
lc_div := 1;
end;
--- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua Mon May 28 17:54:23 2012 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua Mon May 28 20:04:49 2012 +0400
@@ -297,7 +297,6 @@
-- tumbler goods
---------------------
-local moveTimer = 0
local leftOn = false
local rightOn = false
local upOn = false
@@ -318,7 +317,6 @@
local primShotsMax = 5
local primShotsLeft = 0
-local TimeLeftCounter = 0
local TimeLeft = 0
local stopMovement = false
local tumbleStarted = false
@@ -331,8 +329,6 @@
local shockwaveHealth = 0
local shockwaveRad = 300
-local Timer100 = 0
-
local vTag = {}
-----------------------------------------------
@@ -346,8 +342,7 @@
local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies
local pTimer = 0 -- tracking projectiles following player
-local circAdjustTimer = 0 -- handle adjustment of circs direction
-local m2Count = 0 -- handle speed of circs
+--local m2Count = 0 -- handle speed of circs
local vCirc = {}
local vCCount = 0
@@ -1160,7 +1155,7 @@
end
-function onGameTick()
+function onGameTick20()
--WriteLnToConsole("Start of GameTick")
@@ -1175,9 +1170,7 @@
--end
- Timer100 = Timer100 + 1
- if Timer100 >= 100 then
- Timer100 = 0
+ if GameTime%100 == 0 then
if beam == true then
shieldHealth = shieldHealth - 1
@@ -1201,7 +1194,7 @@
--runOnGears(HandleLifeSpan)
--runOnGears(DeleteFarFlungBarrel)
- if CirclesAreGo == true then
+ if CirclesAreGo == true and CurrentHedgehog ~= nil then
CheckDistances()
--runOnGears(CheckVarious) -- used to be in handletracking for some bizarre reason
--runOnGears(ProjectileTrack)
@@ -1225,7 +1218,7 @@
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
--AddCaption(LOC_NOT("Good to go!"))
tumbleStarted = true
- TimeLeft = (TurnTime/1000) --45
+ TimeLeft = div(TurnTime, 1000) --45
FadeAlpha = 0
rAlpha = 255
AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
@@ -1243,9 +1236,7 @@
--AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) )
-- Calculate and display turn time
- TimeLeftCounter = TimeLeftCounter + 1
- if TimeLeftCounter == 1000 then
- TimeLeftCounter = 0
+ if GameTime%1000 == 0 then
TimeLeft = TimeLeft - 1
if TimeLeft >= 0 then
@@ -1310,10 +1301,8 @@
end
-- handle movement based on IO
- moveTimer = moveTimer + 1
- if moveTimer == 100 then -- 100
+ if GameTime%100 == 0 then -- 100
--nw WriteLnToConsole("Start of Player MoveTimer")
- moveTimer = 0
---------------
-- new trail code
@@ -2261,10 +2250,7 @@
end
-- alter the circles velocities
- circAdjustTimer = circAdjustTimer + 1
- if circAdjustTimer == 2000 then
-
- circAdjustTimer = 0
+ if GameTime%2000 == 0 then
for i = 0,(vCCount-1) do
@@ -2272,9 +2258,9 @@
-- or make them move in random directions
if vCircX[i] > 5500 then
- vCircDX[i] = -5 --5 circmovchange
+ vCircDX[i] = -4 --5 circmovchange
elseif vCircX[i] < -1500 then
- vCircDX[i] = 5 --5 circmovchange
+ vCircDX[i] = 4 --5 circmovchange
else
z = GetRandom(2)
@@ -2287,9 +2273,9 @@
end
if vCircY[i] > 1500 then
- vCircDY[i] = -5 --5 circmovchange
+ vCircDY[i] = -4 --5 circmovchange
elseif vCircY[i] < -2900 then
- vCircDY[i] = 5 --5 circmovchange
+ vCircDY[i] = 4 --5 circmovchange
else
z = GetRandom(2)
if z == 1 then
@@ -2305,10 +2291,10 @@
end
-- move the circles according to their current velocities
- m2Count = m2Count + 1
- if m2Count == 25 then --25 circmovchange
-
- m2Count = 0
+ --m2Count = m2Count + 1
+ --if m2Count == 25 then --25 circmovchange
+
+ -- m2Count = 0
for i = 0,(vCCount-1) do
vCircX[i] = vCircX[i] + vCircDX[i]
vCircY[i] = vCircY[i] + vCircDY[i]
@@ -2349,7 +2335,7 @@
- end
+ --end
for i = 0,(vCCount-1) do
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i]) -- vCircCol[i] g10