Add first two changes of #1131
This commit is contained in:
parent
4597627d9a
commit
6559321a4c
@ -9,6 +9,7 @@
|
||||
<Include path="nullifiedcat/crits.xml"/>
|
||||
<Include path="nullifiedcat/visuals.xml"/>
|
||||
<Include path="nullifiedcat/movement.xml"/>
|
||||
<Include path="nullifiedcat/warp.xml"/>
|
||||
<Include path="nullifiedcat/misc.xml"/>
|
||||
<Include path="nullifiedcat/hackinfo.xml"/>
|
||||
<Include path="nullifiedcat/debug.xml"/>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<Tab name="Movement" padding="0 6 6 6">
|
||||
<Tab name="Movement" padding="6 6 6 6">
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Bunny hop">
|
||||
<List width="150">
|
||||
<AutoVariable width="fill" target="bunnyhop.enable" label="Enable bunny hop"/>
|
||||
@ -56,34 +56,4 @@
|
||||
<AutoVariable width="fill" target="antibackstab.nope" label="Nope!" tooltip="Have the charachter say 'no'."/>
|
||||
</List>
|
||||
</Box>
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Warp" x="370">
|
||||
<List width="195">
|
||||
<AutoVariable width="fill" target="warp.enabled" label="Enable warp" tooltip="Allows you to charge a burst of speed."/>
|
||||
<AutoVariable width="fill" target="warp.speed" label="Warp speed" tooltip="The discharge speed (0.5 = +50%, 2 = +200%. +2300% is the maximum possible)."/>
|
||||
<AutoVariable width="fill" target="warp.key" label="Warp key" tooltip="Pressing this key will use all stored ticks to accelerate you."/>
|
||||
<AutoVariable width="fill" target="warp.charge-key" label="Charge key" tooltip="Hold down this key to charge warp."/>
|
||||
<AutoVariable width="fill" target="warp.draw" label="Draw warp" tooltip="Draws a bar indicating your warp readiness."/>
|
||||
<AutoVariable width="fill" target="warp.bar-size" label="Bar size"/>
|
||||
<AutoVariable width="fill" target="warp.bar-x" label="X position"/>
|
||||
<AutoVariable width="fill" target="warp.bar-y" label="Y position"/>
|
||||
<AutoVariable width="fill" target="warp.charge-passively" label="Charge passively" tooltip="Charge warp passively, e.g. when moving"/>
|
||||
<AutoVariable width="fill" target="warp.charge-passively.jump" label="Charge in jump" tooltip="Charge passively in jump, This will make you fall slower"/>
|
||||
<AutoVariable width="fill" target="warp.charge-passively.no-inputs" label="Charge when keys released" tooltip="Charge passively before full stop after releasing movement keys"/>
|
||||
<AutoVariable width="fill" target="warp.movement-ratio" label="Movement ratio" tooltip="Every nth movement tick is passively converted to warp"/>
|
||||
<AutoVariable width="fill" target="warp.demoknight" label="Demoknight mode" tooltip="This will make you do a swing charge with warp (attack, charge, warp)."/>
|
||||
<AutoVariable width="fill" target="warp.peek" label="Peek mode" tooltip="This will teleport you for a tick and then teleport you back"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit" label="Warp when hit" tooltip="Whenever Someone Melees you or shoots you with hitscan, warp"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.forward" label="Warp forwards" tooltip="Warp when hit option"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.backwards" label="Warp backwards" tooltip="Warp when hit option"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.left" label="Warp left" tooltip="Warp when hit option"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.right" label="Warp right" tooltip="Warp when hit option"/>
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Rapidfire">
|
||||
<List width="185">
|
||||
<AutoVariable width="fill" target="warp.rapidfire" label="Enable Rapidfire" tooltip="Allows you to shoot multiple shots at once or reduce time between shots."/>
|
||||
<AutoVariable width="fill" target="warp.rapidfire.no-movement" label="Prevent movement in rapidfire" tooltip="Attempt to not move when Rapidfiring."/>
|
||||
<AutoVariable width="fill" target="warp.rapidfire.key" label="Rapidfire key" tooltip="Optional. If set you can use this key to control when to rapidfire."/>
|
||||
</List>
|
||||
</Box>
|
||||
</List>
|
||||
</Box>
|
||||
</Tab>
|
||||
|
40
data/menu/nullifiedcat/warp.xml
Normal file
40
data/menu/nullifiedcat/warp.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<Tab name="Warp" padding="6 6 6 6">
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Warp">
|
||||
<List width="195">
|
||||
<AutoVariable width="fill" target="warp.enabled" label="Enable warp" tooltip="Allows you to charge a burst of speed."/>
|
||||
<AutoVariable width="fill" target="warp.speed" label="Warp speed" tooltip="The discharge speed (0.5 = +50%, 2 = +200%. +2300% is the maximum possible)."/>
|
||||
<AutoVariable width="fill" target="warp.key" label="Warp key" tooltip="Pressing this key will use all stored ticks to accelerate you."/>
|
||||
<AutoVariable width="fill" target="warp.charge-key" label="Charge key" tooltip="Hold down this key to charge warp."/>
|
||||
<AutoVariable width="fill" target="warp.draw" label="Draw warp" tooltip="Draws a bar indicating your warp readiness."/>
|
||||
<AutoVariable width="fill" target="warp.bar-size" label="Bar size"/>
|
||||
<AutoVariable width="fill" target="warp.bar-x" label="X position"/>
|
||||
<AutoVariable width="fill" target="warp.bar-y" label="Y position"/>
|
||||
<AutoVariable width="fill" target="warp.charge-passively" label="Charge passively" tooltip="Charge warp passively, e.g. when moving"/>
|
||||
<AutoVariable width="fill" target="warp.charge-passively.jump" label="Charge in jump" tooltip="Charge passively in jump, This will make you fall slower"/>
|
||||
<AutoVariable width="fill" target="warp.charge-passively.no-inputs" label="Charge when keys released" tooltip="Charge passively before full stop after releasing movement keys"/>
|
||||
<AutoVariable width="fill" target="warp.movement-ratio" label="Movement ratio" tooltip="Every nth movement tick is passively converted to warp"/>
|
||||
<AutoVariable width="fill" target="warp.demoknight" label="Demoknight mode" tooltip="This will make you do a swing charge with warp (attack, charge, warp)."/>
|
||||
<AutoVariable width="fill" target="warp.peek" label="Peek mode" tooltip="This will teleport you for a tick and then teleport you back"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit" label="Warp when hit" tooltip="Whenever Someone Melees you or shoots you with hitscan, warp"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.forward" label="Warp forwards" tooltip="Warp when hit option"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.backwards" label="Warp backwards" tooltip="Warp when hit option"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.left" label="Warp left" tooltip="Warp when hit option"/>
|
||||
<AutoVariable width="fill" target="warp.on-hit.right" label="Warp right" tooltip="Warp when hit option"/>
|
||||
</List>
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Rapidfire" x="210">
|
||||
<List width="185">
|
||||
<AutoVariable width="fill" target="warp.rapidfire" label="Enable Rapidfire" tooltip="Allows you to shoot multiple shots at once or reduce time between shots."/>
|
||||
<AutoVariable width="fill" target="warp.rapidfire.no-movement" label="Prevent movement in rapidfire" tooltip="Attempt to not move when Rapidfiring."/>
|
||||
<AutoVariable width="fill" target="warp.rapidfire.key" label="Rapidfire key" tooltip="Optional. If set you can use this key to control when to rapidfire."/>
|
||||
<LabeledObject width="fill" label="Rapidfire key mode" tooltip="Controls what the rapidfire key does.">
|
||||
<Select target="warp.rapidfire.key-mode">
|
||||
<Option name="Disable" value="0"/>
|
||||
<Option name="Pressed" value="1"/>
|
||||
<Option name="Not Pressed" value="2"/>
|
||||
<Option name="Toggle" value="3"/>
|
||||
</Select>
|
||||
</LabeledObject>
|
||||
</List>
|
||||
</Box>
|
||||
</Box>
|
||||
</Tab>
|
@ -22,6 +22,7 @@ static settings::Boolean no_movement{ "warp.rapidfire.no-movement", "true" };
|
||||
static settings::Boolean rapidfire{ "warp.rapidfire", "false" };
|
||||
static settings::Boolean wait_full{ "warp.rapidfire.wait-full", "true" };
|
||||
static settings::Button rapidfire_key{ "warp.rapidfire.key", "<null>" };
|
||||
static settings::Int rapidfire_key_mode{ "warp.rapidfire.key-mode", "1" };
|
||||
static settings::Float speed{ "warp.speed", "23" };
|
||||
static settings::Boolean draw{ "warp.draw", "false" };
|
||||
static settings::Button warp_key{ "warp.key", "<null>" };
|
||||
@ -69,6 +70,45 @@ static bool charged = false;
|
||||
static bool should_warp = true;
|
||||
static bool was_hurt = false;
|
||||
|
||||
// Rapidfire key mode
|
||||
static bool key_valid = false;
|
||||
|
||||
// A function that determins whether our key state allows us to rapidfire or not
|
||||
bool UpdateRFKey()
|
||||
{
|
||||
static bool key_flip = false;
|
||||
static bool pressed_last_tick = false;
|
||||
bool allow_key = true;
|
||||
|
||||
// Check if the key is even used
|
||||
if (rapidfire_key && rapidfire_key_mode)
|
||||
{
|
||||
bool key_down = rapidfire_key.isKeyDown();
|
||||
switch ((int) rapidfire_key_mode)
|
||||
{
|
||||
case 1: // Only while key is pressed
|
||||
if (!key_down)
|
||||
allow_key = false;
|
||||
break;
|
||||
case 2: // Only while key is not pressed
|
||||
if (key_down)
|
||||
allow_key = false;
|
||||
break;
|
||||
case 3: // Key acts like a toggle switch
|
||||
if (!pressed_last_tick && key_down)
|
||||
key_flip = !key_flip;
|
||||
if (!key_flip)
|
||||
allow_key = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pressed_last_tick = key_down;
|
||||
}
|
||||
// Return whether the key allows it
|
||||
return allow_key;
|
||||
}
|
||||
|
||||
bool shouldRapidfire()
|
||||
{
|
||||
if (!rapidfire)
|
||||
@ -78,8 +118,8 @@ bool shouldRapidfire()
|
||||
if (in_rapidfire)
|
||||
return false;
|
||||
|
||||
// No key set? Always run. Else check if key is held
|
||||
if (rapidfire_key && !rapidfire_key.isKeyDown())
|
||||
// Only run if key state allows it
|
||||
if (!key_valid)
|
||||
return false;
|
||||
|
||||
// Dead player
|
||||
@ -104,7 +144,13 @@ bool shouldRapidfire()
|
||||
return false;
|
||||
|
||||
// Mouse 1 is held, do it.
|
||||
return current_user_cmd && current_user_cmd->buttons & IN_ATTACK;
|
||||
bool buttons_pressed = current_user_cmd && current_user_cmd->buttons & IN_ATTACK;
|
||||
|
||||
// Unless we are on a flamethrower, where we only want m2.
|
||||
if (LOCAL_W->m_iClassID() == CL_CLASS(CTFFlameThrower))
|
||||
buttons_pressed = current_user_cmd && current_user_cmd->buttons & IN_ATTACK2;
|
||||
|
||||
return buttons_pressed;
|
||||
}
|
||||
|
||||
// Should we warp?
|
||||
@ -391,6 +437,8 @@ void CL_Move_hook(float accumulated_extra_samples, bool bFinalTick)
|
||||
// and the global variable so our time based functions are synced properly.
|
||||
void CreateMoveEarly()
|
||||
{
|
||||
// Update key state
|
||||
key_valid = UpdateRFKey();
|
||||
if (hacks::tf2::warp::in_rapidfire && current_user_cmd)
|
||||
{
|
||||
if (current_user_cmd)
|
||||
|
Reference in New Issue
Block a user