Coder Social home page Coder Social logo

Comments (3)

szapp avatar szapp commented on June 2, 2024

Fix #43 #47 #42 outsource accuracy and draw force

from gothicfreeaim.

szapp avatar szapp commented on June 2, 2024
/* Retrieve draw force scaled between 0 and 100 (percent). Modify this function to alter the draw force calculation */
func int freeAimGetDrawForce() {
    // Scale draw time between 0 and 100
    var int drawForce; drawForce = MEM_Timer.totalTime - bowDrawOnset; // Check for how long the bow was drawn
    if (drawForce > FREEAIM_DRAWTIME_MAX) { drawForce = 100; } // Fully drawn
    else if (drawForce < FREEAIM_DRAWTIME_MIN) { drawForce = 0; } // No negative numbers
    else { // Calculate the percentage [0, 100]
        var int numerator; numerator = mkf(100 * (drawForce - FREEAIM_DRAWTIME_MIN));
        var int denominator; denominator = mkf(FREEAIM_DRAWTIME_MAX - FREEAIM_DRAWTIME_MIN);
        drawForce = roundf(divf(numerator, denominator));
    };
    // Possibly incorporate more factors like e.g. a quick-draw talent, weapon-specific stats, ...
    // If adding more factors, keep in mind that the final drawForce must be in [0, 100]. This line could ensure that:
    // if (drawForce > 100) { drawForce = 100; } else if (drawForce < 0) { drawForce = 0; };
    return drawForce;
};

/* ... */

var int drawForce; drawForce = mulf(fracf(freeAimGetDrawForce(), 100), mkf(FREEAIM_TRAJECTORY_ARC_MAX));
FF_ApplyOnceExtData(dropProjectile, roundf(drawForce), 1, rBody);
bowDrawOnset = MEM_Timer.totalTime; // Reset draw timer

from gothicfreeaim.

szapp avatar szapp commented on June 2, 2024

The time of gravity activation should be outsourced into its own function, that can be easily modified and adjusted to talent and weapon.

from gothicfreeaim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.