mirror of
https://github.com/qwertyuiop3/Storm.git
synced 2024-12-22 14:47:24 +08:00
adjust special infected shotgun scaling
also explicitly specifying value type seems to be good practice to prevent unintended fraction down-rounding (just what've happened in paint.hpp with color 128 -> 127) also remove scope check i've competely forgot about in draw_crosshair.hpp
This commit is contained in:
parent
6554d9e04e
commit
2dc81b9839
@ -90,23 +90,23 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
Command->Buttons &= ~(*(__int32*)((unsigned __int32)Local_Player + 5028) & 2);
|
||||
}
|
||||
|
||||
float Difference = __builtin_remainderf(Move_Angles[1] - Previous_Move_Angle_Y, 360);
|
||||
float Difference = __builtin_remainderf(Move_Angles[1] - Previous_Move_Angle_Y, 360.f);
|
||||
|
||||
Previous_Move_Angle_Y = Move_Angles[1];
|
||||
|
||||
float* Velocity = (float*)((unsigned __int32)Local_Player + 256);
|
||||
|
||||
if (__builtin_fabsf(Difference) < __builtin_atan2f(30, __builtin_hypotf(Velocity[0], Velocity[1])) * 180 / 3.1415927f)
|
||||
if (__builtin_fabsf(Difference) < __builtin_atan2f(30, __builtin_hypotf(Velocity[0], Velocity[1])) * 180.f / 3.1415927f)
|
||||
{
|
||||
float Strafe_Angle = __builtin_remainderf(Move_Angles[1] - __builtin_atan2f(Velocity[1], Velocity[0]) * 180 / 3.1415927f, 360);
|
||||
float Strafe_Angle = __builtin_remainderf(Move_Angles[1] - __builtin_atan2f(Velocity[1], Velocity[0]) * 180.f / 3.1415927f, 360.f);
|
||||
|
||||
if (__builtin_signbitf(Strafe_Angle) == 0)
|
||||
{
|
||||
Command->Move[1] = -400;
|
||||
Command->Move[1] = -400.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command->Move[1] = 400;
|
||||
Command->Move[1] = 400.f;
|
||||
}
|
||||
|
||||
Move_Angles[1] -= Strafe_Angle;
|
||||
@ -115,11 +115,11 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
{
|
||||
if (__builtin_signbitf(Difference) == 0)
|
||||
{
|
||||
Command->Move[1] = -400;
|
||||
Command->Move[1] = -400.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command->Move[1] = 400;
|
||||
Command->Move[1] = 400.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,7 +230,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*(float*)((unsigned __int32)Local_Player + 4604) + 800 * Global_Variables->Interval_Per_Tick >= 560) + *(__int8*)((unsigned __int32)Local_Player + 8068) + *(__int8*)((unsigned __int32)Local_Player + 9708) != 0)
|
||||
if ((*(float*)((unsigned __int32)Local_Player + 4604) + 800.f * Global_Variables->Interval_Per_Tick >= 560.f) + *(__int8*)((unsigned __int32)Local_Player + 8068) + *(__int8*)((unsigned __int32)Local_Player + 9708) != 0)
|
||||
{
|
||||
Sequence_Shift(2);
|
||||
}
|
||||
@ -317,7 +317,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
(__int8)(Identifier == 270 ? *(void**)((unsigned __int32)Entity + 8040) == *(void**)((unsigned __int32)Local_Player + 376) : 0),
|
||||
|
||||
__builtin_powf(Local_Player_Origin[0] - Entity_Origin[0], 2) + __builtin_powf(Local_Player_Origin[1] - Entity_Origin[1], 2) + __builtin_powf(Local_Player_Origin[2] - Entity_Origin[2], 2),
|
||||
__builtin_powf(Local_Player_Origin[0] - Entity_Origin[0], 2.f) + __builtin_powf(Local_Player_Origin[1] - Entity_Origin[1], 2.f) + __builtin_powf(Local_Player_Origin[2] - Entity_Origin[2], 2.f),
|
||||
|
||||
(__int32)(Time / Global_Variables->Interval_Per_Tick + 0.5f)
|
||||
};
|
||||
@ -326,7 +326,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
{
|
||||
if (Identifier == 277)
|
||||
{
|
||||
if (*(float*)((unsigned __int32)Entity + 4844) == 1)
|
||||
if (*(float*)((unsigned __int32)Entity + 4844) == 1.f)
|
||||
{
|
||||
Sorted_Target_List.push_back(Target);
|
||||
}
|
||||
@ -441,7 +441,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
Vector_Normalize(Direction);
|
||||
|
||||
*(float*)((unsigned __int32)Weapon + 2724) = 75;
|
||||
*(float*)((unsigned __int32)Weapon + 2724) = 75.f;
|
||||
|
||||
*(__int32*)((unsigned __int32)Weapon + 3248) = 0;
|
||||
|
||||
@ -459,19 +459,19 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
{
|
||||
Command->Tick_Number = Target->Tick_Number;
|
||||
|
||||
Command->Angles[0] = __builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180 / 3.1415927f;
|
||||
Command->Angles[0] = __builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180.f / 3.1415927f;
|
||||
|
||||
Command->Angles[1] = __builtin_atan2f(Direction[1], Direction[0]) * 180 / 3.1415927f;
|
||||
Command->Angles[1] = __builtin_atan2f(Direction[1], Direction[0]) * 180.f / 3.1415927f;
|
||||
|
||||
if (Cancelable_Shove == 1)
|
||||
{
|
||||
float Shove_Multiplier = min((Global_Variables->Current_Time - *(float*)((unsigned __int32)Weapon + 2704) + *(float*)((unsigned __int32)Weapon + 2700)) / *(float*)((unsigned __int32)Weapon + 2700), 1.f);
|
||||
|
||||
Command->Angles[1] += -45 * Shove_Multiplier + 45 * (1 - Shove_Multiplier);
|
||||
Command->Angles[1] += -45.f * Shove_Multiplier + 45.f * (1.f - Shove_Multiplier);
|
||||
}
|
||||
else
|
||||
{
|
||||
Command->Angles[1] += 45;
|
||||
Command->Angles[1] += 45.f;
|
||||
}
|
||||
|
||||
Command->Buttons |= 2048;
|
||||
@ -685,9 +685,9 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
|
||||
float Angles[3] =
|
||||
{
|
||||
__builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180 / 3.1415927f,
|
||||
__builtin_atan2f(-Direction[2], __builtin_hypotf(Direction[0], Direction[1])) * 180.f / 3.1415927f,
|
||||
|
||||
__builtin_atan2f(Direction[1], Direction[0]) * 180 / 3.1415927f,
|
||||
__builtin_atan2f(Direction[1], Direction[0]) * 180.f / 3.1415927f,
|
||||
|
||||
0
|
||||
};
|
||||
@ -722,7 +722,7 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
||||
{
|
||||
if (Shove_Target != nullptr)
|
||||
{
|
||||
*(float*)((unsigned __int32)Shove_Target->Self + 16) = 0;
|
||||
*(float*)((unsigned __int32)Shove_Target->Self + 16) = 0.f;
|
||||
|
||||
if (Aim_Target != nullptr)
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
void Redirected_Draw_Crosshair()
|
||||
{
|
||||
if ((*(__int32*)(*(unsigned __int32*)((unsigned __int32)Client_Module + 7498712) + 5008) | 55) == 55)
|
||||
{
|
||||
static float Rotation_Angle;
|
||||
|
||||
auto Draw_Storm = [&](__int32 X, __int32 Y, __int32 Additional_Rotation_Angle)
|
||||
@ -14,9 +12,9 @@ void Redirected_Draw_Crosshair()
|
||||
|
||||
using Draw_Circle_Type = void(__thiscall**)(void* Surface, __int32 X, __int32 Y, __int32 Radius, __int32 Segments);
|
||||
|
||||
X += Interface_Storm_Rotation_Radius.Integer * __builtin_cosf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360) * 3.1415927f / 180);
|
||||
X += Interface_Storm_Rotation_Radius.Integer * __builtin_cosf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360.f) * 3.1415927f / 180.f);
|
||||
|
||||
Y += Interface_Storm_Rotation_Radius.Integer * __builtin_sinf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360) * 3.1415927f / 180);
|
||||
Y += Interface_Storm_Rotation_Radius.Integer * __builtin_sinf(__builtin_remainderf(Rotation_Angle + Additional_Rotation_Angle, 360.f) * 3.1415927f / 180.f);
|
||||
|
||||
(*Draw_Circle_Type(*(unsigned __int32*)Surface + 384))(Surface, X - 1, Y, Interface_Storm_Radius.Integer, Interface_Storm_Segments.Integer);
|
||||
|
||||
@ -59,6 +57,5 @@ void Redirected_Draw_Crosshair()
|
||||
}
|
||||
}
|
||||
|
||||
Rotation_Angle = __builtin_remainderf(Rotation_Angle + (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Frame_Time * Interface_Storm_Speed.Integer, 360);
|
||||
}
|
||||
Rotation_Angle = __builtin_remainderf(Rotation_Angle + (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Frame_Time * Interface_Storm_Speed.Integer, 360.f);
|
||||
}
|
@ -4,9 +4,9 @@ void __thiscall Redirected_Finish_Move(void* Unknown_Parameter_1, void* Player,
|
||||
{
|
||||
float X = *(float*)((unsigned __int32)Move_Data + 76);
|
||||
|
||||
if (X > 180)
|
||||
if (X > 180.f)
|
||||
{
|
||||
X -= 360;
|
||||
X -= 360.f;
|
||||
}
|
||||
|
||||
*(float*)((unsigned __int32)Move_Data + 76) = std::clamp(X, -90.f, 90.f);
|
||||
|
18
Paint.hpp
18
Paint.hpp
@ -36,7 +36,7 @@ void __thiscall Redirected_Paint(void* Panel)
|
||||
|
||||
0,
|
||||
|
||||
__builtin_powf(Local_Player_Origin[0] - Entity_Origin[0], 2) + __builtin_powf(Local_Player_Origin[1] - Entity_Origin[1], 2) + __builtin_powf(Local_Player_Origin[2] - Entity_Origin[2], 2)
|
||||
__builtin_powf(Local_Player_Origin[0] - Entity_Origin[0], 2.f) + __builtin_powf(Local_Player_Origin[1] - Entity_Origin[1], 2.f) + __builtin_powf(Local_Player_Origin[2] - Entity_Origin[2], 2.f)
|
||||
};
|
||||
|
||||
if (Identifier >= 0)
|
||||
@ -145,9 +145,9 @@ void __thiscall Redirected_Paint(void* Panel)
|
||||
|
||||
__int32 Screen_Height = Get_Screen_Size_Type((unsigned __int32)Client_Module + 738544)();
|
||||
|
||||
Screen[0] = Screen[0] / 2 * Screen_Width + Screen_Width / 2;
|
||||
Screen[0] = Screen[0] / 2.f * Screen_Width + Screen_Width / 2.f;
|
||||
|
||||
Screen[1] = -Screen[1] / 2 * Screen_Height + Screen_Height / 2;
|
||||
Screen[1] = -Screen[1] / 2.f * Screen_Height + Screen_Height / 2.f;
|
||||
|
||||
Bounds[0] = min(Bounds[0], Screen[0]);
|
||||
|
||||
@ -176,15 +176,15 @@ void __thiscall Redirected_Paint(void* Panel)
|
||||
}
|
||||
}
|
||||
|
||||
Bounds[0] -= 2;
|
||||
Bounds[0] -= 2.f;
|
||||
|
||||
Bounds[1] += 2;
|
||||
Bounds[1] += 2.f;
|
||||
|
||||
Bounds[2] -= 2;
|
||||
Bounds[2] -= 2.f;
|
||||
|
||||
Bounds[3] += 2;
|
||||
Bounds[3] += 2.f;
|
||||
|
||||
return (Bounds[1] != 2) * (Bounds[3] != 2);
|
||||
return (Bounds[1] != 2.f) * (Bounds[3] != 2.f);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -270,7 +270,7 @@ void __thiscall Redirected_Paint(void* Panel)
|
||||
|
||||
if (Ghost == 0)
|
||||
{
|
||||
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, (__int32)(Paint_Data->Color[0] / 2 + 0.5f), (__int32)(Paint_Data->Color[1] / 2 + 0.5f), (__int32)(Paint_Data->Color[2] / 2 + 0.5f), 128);
|
||||
(*Set_Color_Type(*(unsigned __int32*)Surface + 44))(Surface, (__int32)(Paint_Data->Color[0] / 2.f + 0.5f), (__int32)(Paint_Data->Color[1] / 2.f + 0.5f), (__int32)(Paint_Data->Color[2] / 2.f + 0.5f), 128);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ void __thiscall Perform_Trace(void* Stack)
|
||||
{
|
||||
float* Start = (float*)((unsigned __int32)Stack + 236);
|
||||
|
||||
float Distance = __builtin_sqrtf(__builtin_powf(End[0] - Start[0], 2) + __builtin_powf(End[1] - Start[1], 2) + __builtin_powf(End[2] - Start[2], 2));
|
||||
float Distance = __builtin_sqrtf(__builtin_powf(End[0] - Start[0], 2.f) + __builtin_powf(End[1] - Start[1], 2.f) + __builtin_powf(End[2] - Start[2], 2.f));
|
||||
|
||||
float Damage;
|
||||
|
||||
@ -138,20 +138,15 @@ void __thiscall Perform_Trace(void* Stack)
|
||||
|
||||
if (Distance < 100)
|
||||
{
|
||||
Damage += 4.f * Damage * __builtin_powf(1.f - Distance / 100.f, 2);
|
||||
Damage += 4.f * Damage * __builtin_powf(1.f - Distance / 100.f, 2.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (Identifier == 277)
|
||||
if (Identifier == 13)
|
||||
{
|
||||
if (Group != 1)
|
||||
{
|
||||
Apply_Difficulty_Scaling();
|
||||
}
|
||||
|
||||
Apply_Shotgun_Scaling();
|
||||
Damage *= *(float*)((unsigned __int32)Entity + 336) - *(float*)((unsigned __int32)Entity + 472) >= 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -228,12 +223,14 @@ void __thiscall Perform_Trace(void* Stack)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Identifier == 13)
|
||||
if (Identifier == 277)
|
||||
{
|
||||
if (*(float*)((unsigned __int32)Entity + 336) - *(float*)((unsigned __int32)Entity + 472) < 0.5f)
|
||||
if (Group != 1)
|
||||
{
|
||||
Damage = 0;
|
||||
Apply_Difficulty_Scaling();
|
||||
}
|
||||
|
||||
Apply_Shotgun_Scaling();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -246,7 +243,7 @@ void __thiscall Perform_Trace(void* Stack)
|
||||
{
|
||||
static float Multipliers[8] = { 1.f, 4.f, 1.f, 1.25f, 1.f, 1.f, 0.75f, 0.75f };
|
||||
|
||||
Damage *= Multipliers[Group];
|
||||
Damage *= min(4.f - 2.75f * Is_Shotgun, Multipliers[Group]);
|
||||
}
|
||||
|
||||
if (Get_Identifier(Entity, 1, 0) == 99)
|
||||
@ -318,7 +315,7 @@ void __thiscall Perform_Trace(void* Stack)
|
||||
|
||||
Angle_Vectors(Angle, Victim_Direction, nullptr, nullptr);
|
||||
|
||||
if (Inflictor_Direction[0] * Victim_Direction[0] + Inflictor_Direction[1] * Victim_Direction[1] + Inflictor_Direction[2] * Victim_Direction[2] >= 0)
|
||||
if (Inflictor_Direction[0] * Victim_Direction[0] + Inflictor_Direction[1] * Victim_Direction[1] + Inflictor_Direction[2] * Victim_Direction[2] >= 0.f)
|
||||
{
|
||||
Compute_Damage();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ void __thiscall Redirected_Process_Movement(void* Unknown_Parameter, void* Playe
|
||||
|
||||
*(__int32*)((unsigned __int32)Move_Data + 36) |= 4 * *(__int8*)((unsigned __int32)Player + 4636);
|
||||
|
||||
*(double*)((unsigned __int32)Move_Data + 44) = 0;
|
||||
*(double*)((unsigned __int32)Move_Data + 44) = 0.;
|
||||
}
|
||||
|
||||
(decltype(&Redirected_Process_Movement)(Original_Process_Movement_Caller))(Unknown_Parameter, Player, Move_Data);
|
||||
|
Loading…
Reference in New Issue
Block a user