mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fix super and solo
This commit is contained in:
parent
eecdfd2af8
commit
6bfdad9771
|
@ -480,7 +480,6 @@ void CPlayers::RenderPlayer(
|
||||||
{
|
{
|
||||||
// apply predicted results
|
// apply predicted results
|
||||||
m_pClient->m_aClients[ClientID].m_Predicted.Write(&Player);
|
m_pClient->m_aClients[ClientID].m_Predicted.Write(&Player);
|
||||||
m_pClient->m_aClients[ClientID].m_Predicted.m_Solo = m_pClient->m_aClients[ClientID].m_Solo;
|
|
||||||
m_pClient->m_aClients[ClientID].m_PrevPredicted.Write(&Prev);
|
m_pClient->m_aClients[ClientID].m_PrevPredicted.Write(&Prev);
|
||||||
|
|
||||||
IntraTick = Client()->PredIntraGameTick();
|
IntraTick = Client()->PredIntraGameTick();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include "gamecore.h"
|
#include "gamecore.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
|
|
||||||
|
@ -312,7 +313,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
CCharacterCore *pCharCore = m_pWorld->m_apCharacters[i];
|
CCharacterCore *pCharCore = m_pWorld->m_apCharacters[i];
|
||||||
if(!pCharCore || pCharCore == this || (!m_Super && (!m_pTeams->CanCollide(i, m_Id) || pCharCore->m_Solo || pCharCore->m_NoHookHit)))
|
if(!pCharCore || pCharCore == this || (!(m_Super || pCharCore->m_Super) && (!m_pTeams->CanCollide(i, m_Id) || pCharCore->m_Solo || m_Solo)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
vec2 ClosestPoint = closest_point_on_line(m_HookPos, NewPos, pCharCore->m_Pos);
|
vec2 ClosestPoint = closest_point_on_line(m_HookPos, NewPos, pCharCore->m_Pos);
|
||||||
|
@ -426,15 +427,23 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
|
||||||
//player *p = (player*)ent;
|
//player *p = (player*)ent;
|
||||||
//if(pCharCore == this) // || !(p->flags&FLAG_ALIVE)
|
//if(pCharCore == this) // || !(p->flags&FLAG_ALIVE)
|
||||||
|
|
||||||
if(pCharCore == this || (m_Id != -1 && (!m_Super && !pCharCore->m_Super) && (!m_pTeams->CanCollide(m_Id, i) || pCharCore->m_Solo)))
|
if(pCharCore == this || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, i)))
|
||||||
continue; // make sure that we don't nudge our self
|
continue; // make sure that we don't nudge our self
|
||||||
|
|
||||||
|
if(!(m_Super || pCharCore->m_Super) && (m_Solo || pCharCore->m_Solo))
|
||||||
|
continue;
|
||||||
|
|
||||||
// handle player <-> player collision
|
// handle player <-> player collision
|
||||||
float Distance = distance(m_Pos, pCharCore->m_Pos);
|
float Distance = distance(m_Pos, pCharCore->m_Pos);
|
||||||
vec2 Dir = normalize(m_Pos - pCharCore->m_Pos);
|
vec2 Dir = normalize(m_Pos - pCharCore->m_Pos);
|
||||||
if(((m_Super || pCharCore->m_Super) || (pCharCore->m_Collision && this->m_Collision && !pCharCore->m_NoCollision && !this->m_NoCollision && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerCollision))
|
|
||||||
&& Distance < PhysSize*1.25f
|
bool CanCollide = (m_Super || pCharCore->m_Super)
|
||||||
&& Distance > 0.0f)
|
|| (pCharCore->m_Collision && m_Collision
|
||||||
|
&& !m_NoCollision && !pCharCore->m_NoCollision
|
||||||
|
&& m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerCollision
|
||||||
|
);
|
||||||
|
|
||||||
|
if(CanCollide && Distance < PhysSize*1.25f && Distance > 0.0f)
|
||||||
{
|
{
|
||||||
float a = (PhysSize*1.45f - Distance);
|
float a = (PhysSize*1.45f - Distance);
|
||||||
float Velocity = 0.5f;
|
float Velocity = 0.5f;
|
||||||
|
@ -449,7 +458,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle hook influence
|
// handle hook influence
|
||||||
if(m_Hook && !m_NoHookHit && m_HookedPlayer == i && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerHooking)
|
if(m_Hook && m_HookedPlayer == i && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerHooking)
|
||||||
{
|
{
|
||||||
if(Distance > PhysSize*1.50f) // TODO: fix tweakable variable
|
if(Distance > PhysSize*1.50f) // TODO: fix tweakable variable
|
||||||
{
|
{
|
||||||
|
@ -628,7 +637,7 @@ void CCharacterCore::Move()
|
||||||
|
|
||||||
m_Vel.x = m_Vel.x*(1.0f/RampValue);
|
m_Vel.x = m_Vel.x*(1.0f/RampValue);
|
||||||
|
|
||||||
if(m_pWorld && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerCollision && this->m_Collision)
|
if(m_pWorld && (m_Super || (m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerCollision && m_Collision && !m_NoCollision && !m_Solo)))
|
||||||
{
|
{
|
||||||
// check player collision
|
// check player collision
|
||||||
float Distance = distance(m_Pos, NewPos);
|
float Distance = distance(m_Pos, NewPos);
|
||||||
|
@ -641,10 +650,9 @@ void CCharacterCore::Move()
|
||||||
for(int p = 0; p < MAX_CLIENTS; p++)
|
for(int p = 0; p < MAX_CLIENTS; p++)
|
||||||
{
|
{
|
||||||
CCharacterCore *pCharCore = m_pWorld->m_apCharacters[p];
|
CCharacterCore *pCharCore = m_pWorld->m_apCharacters[p];
|
||||||
if(!pCharCore || pCharCore == this
|
if(!pCharCore || pCharCore == this )
|
||||||
|| !pCharCore->m_Collision
|
continue;
|
||||||
|| (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p))
|
if((!(pCharCore->m_Super || m_Super) && (m_Solo || pCharCore->m_Solo || !pCharCore->m_Collision || pCharCore->m_NoCollision || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p)))))
|
||||||
|| pCharCore->m_Solo)
|
|
||||||
continue;
|
continue;
|
||||||
float D = distance(Pos, pCharCore->m_Pos);
|
float D = distance(Pos, pCharCore->m_Pos);
|
||||||
if(D < 28.0f && D > 0.0f)
|
if(D < 28.0f && D > 0.0f)
|
||||||
|
|
|
@ -105,6 +105,7 @@ void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData)
|
||||||
if (pChr && !pChr->m_Super)
|
if (pChr && !pChr->m_Super)
|
||||||
{
|
{
|
||||||
pChr->m_Super = true;
|
pChr->m_Super = true;
|
||||||
|
pSelf->m_World.m_Core.m_apCharacters[pResult->m_ClientID]->m_Super = true;
|
||||||
pChr->UnFreeze();
|
pChr->UnFreeze();
|
||||||
pChr->m_TeamBeforeSuper = pChr->Team();
|
pChr->m_TeamBeforeSuper = pChr->Team();
|
||||||
pChr->Teams()->SetCharacterTeam(pResult->m_ClientID, TEAM_SUPER);
|
pChr->Teams()->SetCharacterTeam(pResult->m_ClientID, TEAM_SUPER);
|
||||||
|
@ -121,6 +122,7 @@ void CGameContext::ConUnSuper(IConsole::IResult *pResult, void *pUserData)
|
||||||
if (pChr && pChr->m_Super)
|
if (pChr && pChr->m_Super)
|
||||||
{
|
{
|
||||||
pChr->m_Super = false;
|
pChr->m_Super = false;
|
||||||
|
pSelf->m_World.m_Core.m_apCharacters[pResult->m_ClientID]->m_Super = false;
|
||||||
pChr->Teams()->SetForceCharacterTeam(pResult->m_ClientID,
|
pChr->Teams()->SetForceCharacterTeam(pResult->m_ClientID,
|
||||||
pChr->m_TeamBeforeSuper);
|
pChr->m_TeamBeforeSuper);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue