Fix: Tunings and Tunezones with dummies

This commit is contained in:
def 2014-04-29 03:34:23 +02:00
parent 158900cbc1
commit 5eb7a74558
9 changed files with 51 additions and 50 deletions

View file

@ -29,7 +29,7 @@ void CDebugHud::RenderNetCorrections()
vec2(netobjects.local_character->x, netobjects.local_character->y));*/
float Velspeed = length(vec2(m_pClient->m_Snap.m_pLocalCharacter->m_VelX/256.0f, m_pClient->m_Snap.m_pLocalCharacter->m_VelY/256.0f))*50;
float Ramp = VelocityRamp(Velspeed, m_pClient->m_Tuning.m_VelrampStart, m_pClient->m_Tuning.m_VelrampRange, m_pClient->m_Tuning.m_VelrampCurvature);
float Ramp = VelocityRamp(Velspeed, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
const char *paStrings[] = {"velspeed:", "velspeed*ramp:", "ramp:", "Pos", " x:", " y:", "netobj corrections", " num:", " on:"};
const int Num = sizeof(paStrings)/sizeof(char *);
@ -82,11 +82,11 @@ void CDebugHud::RenderTuning()
float y = 27.0f;
int Count = 0;
for(int i = 0; i < m_pClient->m_Tuning.Num(); i++)
for(int i = 0; i < m_pClient->m_Tuning[g_Config.m_ClDummy].Num(); i++)
{
char aBuf[128];
float Current, Standard;
m_pClient->m_Tuning.Get(i, &Current);
m_pClient->m_Tuning[g_Config.m_ClDummy].Get(i, &Current);
StandardTuning.Get(i, &Standard);
if(Standard == Current)
@ -108,7 +108,7 @@ void CDebugHud::RenderTuning()
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1);
x += 5.0f;
TextRender()->Text(0x0, x, y+Count*6, 5, m_pClient->m_Tuning.m_apNames[i], -1);
TextRender()->Text(0x0, x, y+Count*6, 5, m_pClient->m_Tuning[g_Config.m_ClDummy].m_apNames[i], -1);
Count++;
}
@ -124,7 +124,7 @@ void CDebugHud::RenderTuning()
for(int i = 0; i < 100; i++)
{
float Speed = i/100.0f * 3000;
float Ramp = VelocityRamp(Speed, m_pClient->m_Tuning.m_VelrampStart, m_pClient->m_Tuning.m_VelrampRange, m_pClient->m_Tuning.m_VelrampCurvature);
float Ramp = VelocityRamp(Speed, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
float RampedSpeed = (Speed * Ramp)/1000.0f;
Array[i] = IGraphics::CLineItem((i-1)*2, y+Height-pv*Height, i*2, y+Height-RampedSpeed*Height);
//Graphics()->LinesDraw((i-1)*2, 200, i*2, 200);

View file

@ -28,18 +28,18 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
float Speed = 0;
if(pCurrent->m_Type == WEAPON_GRENADE)
{
Curvature = m_pClient->m_Tuning.m_GrenadeCurvature;
Speed = m_pClient->m_Tuning.m_GrenadeSpeed;
Curvature = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GrenadeCurvature;
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GrenadeSpeed;
}
else if(pCurrent->m_Type == WEAPON_SHOTGUN)
{
Curvature = m_pClient->m_Tuning.m_ShotgunCurvature;
Speed = m_pClient->m_Tuning.m_ShotgunSpeed;
Curvature = m_pClient->m_Tuning[g_Config.m_ClDummy].m_ShotgunCurvature;
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_ShotgunSpeed;
}
else if(pCurrent->m_Type == WEAPON_GUN)
{
Curvature = m_pClient->m_Tuning.m_GunCurvature;
Speed = m_pClient->m_Tuning.m_GunSpeed;
Curvature = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GunCurvature;
Speed = m_pClient->m_Tuning[g_Config.m_ClDummy].m_GunSpeed;
}
static float s_LastGameTickTime = Client()->GameTickTime();
@ -228,7 +228,7 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent)
float Ticks = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
float Ms = (Ticks/50.0f) * 1000.0f;
float a = Ms / m_pClient->m_Tuning.m_LaserBounceDelay;
float a = Ms / m_pClient->m_Tuning[g_Config.m_ClDummy].m_LaserBounceDelay;
a = clamp(a, 0.0f, 1.0f);
float Ia = 1-a;

View file

@ -548,7 +548,7 @@ void CPlayers::RenderPlayer(
Graphics()->TextureSet(-1);
vec2 initPos = Position;
vec2 finishPos = initPos + ExDirection * (m_pClient->m_Tuning.m_HookLength-42.0f);
vec2 finishPos = initPos + ExDirection * (m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength-42.0f);
Graphics()->LinesBegin();
Graphics()->SetColor(1.00f, 0.0f, 0.0f, 1.00f);
@ -563,11 +563,11 @@ void CPlayers::RenderPlayer(
do {
OldPos = NewPos;
NewPos = OldPos + ExDirection * m_pClient->m_Tuning.m_HookFireSpeed;
NewPos = OldPos + ExDirection * m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookFireSpeed;
if (distance(Position, NewPos) > m_pClient->m_Tuning.m_HookLength)
if (distance(Position, NewPos) > m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength)
{
NewPos = initPos + normalize(NewPos-initPos) * m_pClient->m_Tuning.m_HookLength;
NewPos = initPos + normalize(NewPos-initPos) * m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength;
doBreak = true;
}
@ -581,7 +581,7 @@ void CPlayers::RenderPlayer(
Graphics()->SetColor(130.0f/255.0f, 232.0f/255.0f, 160.0f/255.0f, 1.0f);
}
if(m_pClient->m_Tuning.m_PlayerHooking && m_pClient->IntersectCharacter(OldPos, finishPos, finishPos, pPlayerInfo->m_ClientID) != -1)
if(m_pClient->m_Tuning[g_Config.m_ClDummy].m_PlayerHooking && m_pClient->IntersectCharacter(OldPos, finishPos, finishPos, pPlayerInfo->m_ClientID) != -1)
{
Graphics()->SetColor(1.0f, 1.0f, 0.0f, 1.0f);
break;

View file

@ -422,7 +422,8 @@ void CGameClient::OnReset()
m_DemoSpecID = SPEC_FREEVIEW;
m_FlagDropTick[TEAM_RED] = 0;
m_FlagDropTick[TEAM_BLUE] = 0;
m_Tuning = CTuningParams();
m_Tuning[0] = CTuningParams();
m_Tuning[1] = CTuningParams();
m_Teams.Reset();
m_DDRaceMsgSent[0] = false;
@ -631,7 +632,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
m_ServerMode = SERVERMODE_PURE;
// apply new tuning
m_Tuning = NewTuning;
m_Tuning[g_Config.m_ClDummy] = NewTuning;
return;
}
@ -1071,18 +1072,18 @@ void CGameClient::OnNewSnapshot()
{
if(str_comp(CurrentServerInfo.m_aGameType, "DM") != 0 && str_comp(CurrentServerInfo.m_aGameType, "TDM") != 0 && str_comp(CurrentServerInfo.m_aGameType, "CTF") != 0)
m_ServerMode = SERVERMODE_MOD;
else if(mem_comp(&StandardTuning, &m_Tuning, 33) == 0)
else if(mem_comp(&StandardTuning, &m_Tuning[g_Config.m_ClDummy], 33) == 0)
m_ServerMode = SERVERMODE_PURE;
else
m_ServerMode = SERVERMODE_PUREMOD;
}
// add tuning to demo
if(DemoRecorder()->IsRecording() && mem_comp(&StandardTuning, &m_Tuning, sizeof(CTuningParams)) != 0)
if(DemoRecorder()->IsRecording() && mem_comp(&StandardTuning, &m_Tuning[g_Config.m_ClDummy], sizeof(CTuningParams)) != 0)
{
CMsgPacker Msg(NETMSGTYPE_SV_TUNEPARAMS);
int *pParams = (int *)&m_Tuning;
for(unsigned i = 0; i < sizeof(m_Tuning)/sizeof(int); i++)
int *pParams = (int *)&m_Tuning[g_Config.m_ClDummy];
for(unsigned i = 0; i < sizeof(m_Tuning[0])/sizeof(int); i++)
Msg.AddInt(pParams[i]);
Client()->SendMsg(&Msg, MSGFLAG_RECORD|MSGFLAG_NOSEND);
}
@ -1146,7 +1147,7 @@ void CGameClient::OnPredict()
// repredict character
CWorldCore World;
World.m_Tuning = m_Tuning;
World.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
// search for players
for(int i = 0; i < MAX_CLIENTS; i++)
@ -1444,7 +1445,7 @@ int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2& NewPos2, in
float Distance = 0.0f;
int ClosestID = -1;
if (!m_Tuning.m_PlayerHooking)
if (!m_Tuning[g_Config.m_ClDummy].m_PlayerHooking)
return ClosestID;
for (int i=0; i<MAX_CLIENTS; i++)

View file

@ -102,7 +102,7 @@ public:
int m_FlagDropTick[2];
// TODO: move this
CTuningParams m_Tuning;
CTuningParams m_Tuning[2];
enum
{

View file

@ -155,11 +155,11 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
vec2 TargetDirection = normalize(vec2(m_Input.m_TargetX, m_Input.m_TargetY));
m_Vel.y += m_pWorld->m_Tuning.m_Gravity;
m_Vel.y += m_pWorld->m_Tuning[g_Config.m_ClDummy].m_Gravity;
float MaxSpeed = Grounded ? m_pWorld->m_Tuning.m_GroundControlSpeed : m_pWorld->m_Tuning.m_AirControlSpeed;
float Accel = Grounded ? m_pWorld->m_Tuning.m_GroundControlAccel : m_pWorld->m_Tuning.m_AirControlAccel;
float Friction = Grounded ? m_pWorld->m_Tuning.m_GroundFriction : m_pWorld->m_Tuning.m_AirFriction;
float MaxSpeed = Grounded ? m_pWorld->m_Tuning[g_Config.m_ClDummy].m_GroundControlSpeed : m_pWorld->m_Tuning[g_Config.m_ClDummy].m_AirControlSpeed;
float Accel = Grounded ? m_pWorld->m_Tuning[g_Config.m_ClDummy].m_GroundControlAccel : m_pWorld->m_Tuning[g_Config.m_ClDummy].m_AirControlAccel;
float Friction = Grounded ? m_pWorld->m_Tuning[g_Config.m_ClDummy].m_GroundFriction : m_pWorld->m_Tuning[g_Config.m_ClDummy].m_AirFriction;
// handle input
if(UseInput)
@ -186,14 +186,14 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
if(Grounded)
{
m_TriggeredEvents |= COREEVENT_GROUND_JUMP;
m_Vel.y = -m_pWorld->m_Tuning.m_GroundJumpImpulse;
m_Vel.y = -m_pWorld->m_Tuning[g_Config.m_ClDummy].m_GroundJumpImpulse;
m_Jumped |= 1;
m_JumpedTotal = 1;
}
else if(!(m_Jumped&2))
{
m_TriggeredEvents |= COREEVENT_AIR_JUMP;
m_Vel.y = -m_pWorld->m_Tuning.m_AirJumpImpulse;
m_Vel.y = -m_pWorld->m_Tuning[g_Config.m_ClDummy].m_AirJumpImpulse;
m_Jumped |= 3;
m_JumpedTotal++;
}
@ -259,12 +259,12 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
}
else if(m_HookState == HOOK_FLYING)
{
vec2 NewPos = m_HookPos+m_HookDir*m_pWorld->m_Tuning.m_HookFireSpeed;
if((!m_NewHook && distance(m_Pos, NewPos) > m_pWorld->m_Tuning.m_HookLength)
|| (m_NewHook && distance(m_HookTeleBase, NewPos) > m_pWorld->m_Tuning.m_HookLength))
vec2 NewPos = m_HookPos+m_HookDir*m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookFireSpeed;
if((!m_NewHook && distance(m_Pos, NewPos) > m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookLength)
|| (m_NewHook && distance(m_HookTeleBase, NewPos) > m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookLength))
{
m_HookState = HOOK_RETRACT_START;
NewPos = m_Pos + normalize(NewPos-m_Pos) * m_pWorld->m_Tuning.m_HookLength;
NewPos = m_Pos + normalize(NewPos-m_Pos) * m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookLength;
m_pReset = true;
}
@ -289,7 +289,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
}
// Check against other players first
if(this->m_Hook && m_pWorld && m_pWorld->m_Tuning.m_PlayerHooking)
if(this->m_Hook && m_pWorld && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerHooking)
{
float Distance = 0.0f;
for(int i = 0; i < MAX_CLIENTS; i++)
@ -367,7 +367,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
// don't do this hook rutine when we are hook to a player
if(m_HookedPlayer == -1 && distance(m_HookPos, m_Pos) > 46.0f)
{
vec2 HookVel = normalize(m_HookPos-m_Pos)*m_pWorld->m_Tuning.m_HookDragAccel;
vec2 HookVel = normalize(m_HookPos-m_Pos)*m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookDragAccel;
// the hook as more power to drag you up then down.
// this makes it easier to get on top of an platform
if(HookVel.y > 0)
@ -383,7 +383,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
vec2 NewVel = m_Vel+HookVel;
// check if we are under the legal limit for the hook
if(length(NewVel) < m_pWorld->m_Tuning.m_HookDragSpeed || length(NewVel) < length(m_Vel))
if(length(NewVel) < m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookDragSpeed || length(NewVel) < length(m_Vel))
m_Vel = NewVel; // no problem. apply
}
@ -415,7 +415,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
// handle player <-> player collision
float Distance = distance(m_Pos, pCharCore->m_Pos);
vec2 Dir = normalize(m_Pos - pCharCore->m_Pos);
if(pCharCore->m_Collision && this->m_Collision && m_pWorld->m_Tuning.m_PlayerCollision && Distance < PhysSize*1.25f && Distance > 0.0f)
if(pCharCore->m_Collision && this->m_Collision && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerCollision && Distance < PhysSize*1.25f && Distance > 0.0f)
{
float a = (PhysSize*1.45f - Distance);
float Velocity = 0.5f;
@ -430,12 +430,12 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
}
// handle hook influence
if(m_Hook && m_HookedPlayer == i && m_pWorld->m_Tuning.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
{
float Accel = m_pWorld->m_Tuning.m_HookDragAccel * (Distance/m_pWorld->m_Tuning.m_HookLength);
float DragSpeed = m_pWorld->m_Tuning.m_HookDragSpeed;
float Accel = m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookDragAccel * (Distance/m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookLength);
float DragSpeed = m_pWorld->m_Tuning[g_Config.m_ClDummy].m_HookDragSpeed;
// add force to the hooked player
vec2 Temp = pCharCore->m_Vel;
@ -546,7 +546,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
}
if(IsClient && UseInput && (m_Input.m_Fire&1) && m_ActiveWeapon == WEAPON_GUN) {
m_Vel += TargetDirection * -1.0f * (m_pWorld->m_Tuning.m_JetpackStrength / 100.0f / 6.11f);
m_Vel += TargetDirection * -1.0f * (m_pWorld->m_Tuning[g_Config.m_ClDummy].m_JetpackStrength / 100.0f / 6.11f);
}
if(g_Config.m_ClPredictDDRace && IsClient)
{
@ -589,7 +589,7 @@ void CCharacterCore::Tick(bool UseInput, bool IsClient)
void CCharacterCore::Move()
{
float RampValue = VelocityRamp(length(m_Vel)*50, m_pWorld->m_Tuning.m_VelrampStart, m_pWorld->m_Tuning.m_VelrampRange, m_pWorld->m_Tuning.m_VelrampCurvature);
float RampValue = VelocityRamp(length(m_Vel)*50, m_pWorld->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pWorld->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pWorld->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
m_Vel.x = m_Vel.x*RampValue;
@ -598,7 +598,7 @@ void CCharacterCore::Move()
m_Vel.x = m_Vel.x*(1.0f/RampValue);
if(m_pWorld && m_pWorld->m_Tuning.m_PlayerCollision && this->m_Collision)
if(m_pWorld && m_pWorld->m_Tuning[g_Config.m_ClDummy].m_PlayerCollision && this->m_Collision)
{
// check player collision
float Distance = distance(m_Pos, NewPos);

View file

@ -175,7 +175,7 @@ public:
mem_zero(m_apCharacters, sizeof(m_apCharacters));
}
CTuningParams m_Tuning;
CTuningParams m_Tuning[2];
class CCharacterCore *m_apCharacters[MAX_CLIENTS];
};

View file

@ -1812,9 +1812,9 @@ void CCharacter::HandleTuneLayer()
m_TuneZone = GameServer()->Collision()->IsTune(CurrentIndex);
if(m_TuneZone)
m_Core.m_pWorld->m_Tuning = GameServer()->TuningList()[m_TuneZone]; // throw tunings from specific zone into gamecore
m_Core.m_pWorld->m_Tuning[g_Config.m_ClDummy] = GameServer()->TuningList()[m_TuneZone]; // throw tunings from specific zone into gamecore
else
m_Core.m_pWorld->m_Tuning = *GameServer()->Tuning();
m_Core.m_pWorld->m_Tuning[g_Config.m_ClDummy] = *GameServer()->Tuning();
if (m_TuneZone != m_TuneZoneOld) // dont send tunigs all the time
{

View file

@ -563,7 +563,7 @@ void CGameContext::OnTick()
CheckPureTuning();
// copy tuning
m_World.m_Core.m_Tuning = m_Tuning;
m_World.m_Core.m_Tuning[0] = m_Tuning;
m_World.Tick();
//if(world.paused) // make sure that the game object always updates