mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Trying to fix the crazy shotgun bullets -.-"
This commit is contained in:
parent
31d6ed6292
commit
883e0f2222
|
@ -66,7 +66,7 @@ MACRO_CONFIG_INT(SvSqlPort, sv_sql_port, 3306, 0, 65535, CFGFLAG_SERVER, "SQL Da
|
|||
MACRO_CONFIG_STR(SvSqlDatabase, sv_sql_database, 16, "teeworlds", CFGFLAG_SERVER, "SQL Database name")
|
||||
MACRO_CONFIG_STR(SvSqlPrefix, sv_sql_prefix, 16, "record", CFGFLAG_SERVER, "SQL Database table prefix")
|
||||
//===============================
|
||||
|
||||
MACRO_CONFIG_INT(SvShotgunReset, sv_shotgun_reset, 0,0,9999, CFGFLAG_SERVER, "Resets the shotgun bullets to start position")
|
||||
MACRO_CONFIG_STR(PlayerName, player_name, 24, "nameless tee", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Name of the player")
|
||||
MACRO_CONFIG_STR(ClanName, clan_name, 32, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "(not used)")
|
||||
MACRO_CONFIG_STR(Password, password, 32, "", CFGFLAG_CLIENT|CFGFLAG_SERVER, "Password to the server")
|
||||
|
|
|
@ -19,7 +19,9 @@ CProjectile::CProjectile(
|
|||
{
|
||||
m_Type = Type;
|
||||
m_Pos = Pos;
|
||||
m_StartPos = Pos;
|
||||
m_Direction = Dir;
|
||||
m_StartDir = Dir;
|
||||
m_LifeSpan = Span;
|
||||
m_Owner = Owner;
|
||||
m_Force = Force;
|
||||
|
@ -31,9 +33,9 @@ CProjectile::CProjectile(
|
|||
m_Explosive = Explosive;
|
||||
m_BouncePos=vec2(0,0);
|
||||
m_ReBouncePos=vec2(0,0);
|
||||
m_AvgPos=vec2(0,0);
|
||||
m_LastBounce=vec2(0,0);
|
||||
m_PrevLastBounce=vec2(0,0);
|
||||
m_LastRestart = 0;
|
||||
|
||||
GameWorld()->InsertEntity(this);
|
||||
}
|
||||
|
@ -97,7 +99,6 @@ void CProjectile::Tick()
|
|||
if(m_LifeSpan > -1)
|
||||
m_LifeSpan--;
|
||||
|
||||
|
||||
if( (TargetChr && (g_Config.m_SvHit || TargetChr == OwnerChar)) || Collide)
|
||||
{
|
||||
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
|
||||
|
@ -111,6 +112,12 @@ void CProjectile::Tick()
|
|||
{
|
||||
m_StartTick = Server()->Tick();
|
||||
m_Pos = NewPos;
|
||||
if(g_Config.m_SvShotgunReset > m_LastRestart)
|
||||
{
|
||||
m_Pos = m_StartPos;
|
||||
m_Direction = m_StartDir;
|
||||
m_StartTick = Server()->Tick();
|
||||
}
|
||||
if (m_Bouncing == 1)
|
||||
{
|
||||
m_PrevLastBounce.x = m_LastBounce.x;
|
||||
|
@ -119,9 +126,7 @@ void CProjectile::Tick()
|
|||
m_BouncePos.x=m_Pos.x;
|
||||
else if (!m_ReBouncePos.x)
|
||||
m_ReBouncePos.x=m_Pos.x;
|
||||
else if(!m_AvgPos.x)
|
||||
m_AvgPos = vec2((m_BouncePos.x+m_ReBouncePos.x)/2,(m_BouncePos.y+m_ReBouncePos.y)/2);
|
||||
if (m_AvgPos.x)
|
||||
m_Direction.x =- m_Direction.x;
|
||||
if(!((m_PrevLastBounce.x+1 == m_BouncePos.x || m_PrevLastBounce.x-1 == m_BouncePos.x || m_PrevLastBounce.x == m_BouncePos.x) && (m_LastBounce.x == m_ReBouncePos.x || m_LastBounce.x+1 == m_ReBouncePos.x || m_LastBounce.x-1 == m_ReBouncePos.x)) && !((m_LastBounce.x == m_BouncePos.x || m_LastBounce.x+1 == m_BouncePos.x || m_LastBounce.x-1 == m_BouncePos.x) && (m_PrevLastBounce.x+1 == m_ReBouncePos.x || m_PrevLastBounce.x-1 == m_ReBouncePos.x || m_PrevLastBounce.x == m_ReBouncePos.x)))
|
||||
{
|
||||
/*int bx=(int)m_BouncePos.x;
|
||||
|
@ -133,11 +138,11 @@ void CProjectile::Tick()
|
|||
dbg_msg("m_LastBounce","%d",lbx);
|
||||
dbg_msg("m_PrevLastBounce","%d",plbx);
|
||||
m_Pos.x=m_AvgPos.x;*/
|
||||
g_Config.m_SvShotgunReset++;
|
||||
dbg_msg("CrazyShotgun","Warning Horizontal Crazy Shotgun Out of bounds");
|
||||
/*int x=(int)m_Pos.x;
|
||||
dbg_msg("RePos","%d",x);*/
|
||||
}
|
||||
m_Direction.x =- m_Direction.x;
|
||||
}
|
||||
else if (m_Bouncing == 2)
|
||||
{
|
||||
|
@ -147,11 +152,8 @@ void CProjectile::Tick()
|
|||
m_BouncePos.y=m_Pos.y;
|
||||
else if (!m_ReBouncePos.y)
|
||||
m_ReBouncePos.y=m_Pos.y;
|
||||
else if(!m_AvgPos.y)
|
||||
m_AvgPos = vec2((m_BouncePos.x+m_ReBouncePos.x)/2,(m_BouncePos.y+m_ReBouncePos.y)/2);
|
||||
m_Direction.y =- m_Direction.y;
|
||||
if (m_AvgPos.y)
|
||||
if(!((m_PrevLastBounce.y+1 == m_BouncePos.y || m_PrevLastBounce.y-1 == m_BouncePos.y || m_PrevLastBounce.y == m_BouncePos.y) && (m_LastBounce.y == m_ReBouncePos.y || m_LastBounce.y+1 == m_ReBouncePos.y || m_LastBounce.y-1 == m_ReBouncePos.y)) && !((m_LastBounce.y == m_BouncePos.y || m_LastBounce.y+1 == m_BouncePos.y || m_LastBounce.y-1 == m_BouncePos.y) && (m_PrevLastBounce.y+1 == m_ReBouncePos.y || m_PrevLastBounce.y-1 == m_ReBouncePos.y || m_PrevLastBounce.y == m_ReBouncePos.y)))
|
||||
if(!((m_PrevLastBounce.y+1 == m_BouncePos.y || m_PrevLastBounce.y-1 == m_BouncePos.y || m_PrevLastBounce.y == m_BouncePos.y) && (m_LastBounce.y == m_ReBouncePos.y || m_LastBounce.y+1 == m_ReBouncePos.y || m_LastBounce.y-1 == m_ReBouncePos.y)) && !((m_LastBounce.y == m_BouncePos.y || m_LastBounce.y+1 == m_BouncePos.y || m_LastBounce.y-1 == m_BouncePos.y) && (m_PrevLastBounce.y+1 == m_ReBouncePos.y || m_PrevLastBounce.y-1 == m_ReBouncePos.y || m_PrevLastBounce.y == m_ReBouncePos.y)))
|
||||
{
|
||||
/*int by=(int)m_BouncePos.y;
|
||||
int rby=(int)m_ReBouncePos.y;
|
||||
|
@ -160,12 +162,12 @@ void CProjectile::Tick()
|
|||
dbg_msg("m_BouncePos","%d",by);
|
||||
dbg_msg("m_ReBouncePos","%d",rby);
|
||||
dbg_msg("m_LastBounce","%d",lby);
|
||||
dbg_msg("m_PrevLastBounce","%d",plby);*/
|
||||
m_Pos=m_AvgPos;
|
||||
dbg_msg("m_PrevLastBounce","%d",plby);
|
||||
m_Pos=m_AvgPos;*/
|
||||
g_Config.m_SvShotgunReset++;
|
||||
dbg_msg("CrazyShotgun","Warning Vertical Crazy Shotgun Out of bounds");
|
||||
/*int y=(int)m_Pos.y;
|
||||
dbg_msg("RePos","%d",y);*/
|
||||
|
||||
}
|
||||
}
|
||||
m_Pos += m_Direction;
|
||||
|
|
|
@ -34,6 +34,9 @@ private:
|
|||
vec2 m_ReBouncePos;
|
||||
vec2 m_LastBounce;
|
||||
vec2 m_PrevLastBounce;
|
||||
vec2 m_StartPos;
|
||||
vec2 m_StartDir;
|
||||
int m_LastRestart;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue