mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Please.... please take the slider....
This commit is contained in:
parent
e3561e9d15
commit
2f44243abb
@ -11,6 +11,7 @@
|
|||||||
#include "contrib/JSON.hpp"
|
#include "contrib/JSON.hpp"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
std::map<int32_t, std::vector<WarpLocation>> TableData::RunningSkywayRoutes;
|
std::map<int32_t, std::vector<WarpLocation>> TableData::RunningSkywayRoutes;
|
||||||
std::map<int32_t, int> TableData::RunningNPCRotations;
|
std::map<int32_t, int> TableData::RunningNPCRotations;
|
||||||
@ -358,18 +359,22 @@ void TableData::loadPaths(int* nextId) {
|
|||||||
} else if (point["stop"]) { // point B is a stop
|
} else if (point["stop"]) { // point B is a stop
|
||||||
curve = 0.375f;//0.35f;
|
curve = 0.375f;//0.35f;
|
||||||
}
|
}
|
||||||
int preLerp = route.size();
|
|
||||||
TransportManager::lerp(&route, from, to, SLIDER_SPEED * curve, 1); // lerp from A to B (arbitrary speed)
|
TransportManager::lerp(&route, from, to, SLIDER_SPEED * curve, 1); // lerp from A to B (arbitrary speed)
|
||||||
int postLerp = route.size() - preLerp;
|
|
||||||
from = to; // update point A
|
from = to; // update point A
|
||||||
stopTime = point["stop"] ? SLIDER_STOP_TICKS : 0; // set stop ticks for next point A
|
stopTime = point["stop"] ? SLIDER_STOP_TICKS : 0; // set stop ticks for next point A
|
||||||
}
|
}
|
||||||
//
|
// Uniform distance calculation
|
||||||
int l = route.size();
|
int passedDistance = 0;
|
||||||
int numSlidersApprox = 16; // maybe add a config option for this?
|
// initial point
|
||||||
for (int pos = 0; pos < l; pos++) {
|
int pos = 0;
|
||||||
|
WarpLocation lastPoint = route.front();
|
||||||
|
route.pop();
|
||||||
|
route.push(lastPoint);
|
||||||
|
for (pos = 1; pos < route.size(); pos++) {
|
||||||
WarpLocation point = route.front();
|
WarpLocation point = route.front();
|
||||||
if (pos % (l / numSlidersApprox) == 0) { // space them out uniformaly
|
passedDistance += hypot(point.x - lastPoint.x, point.y - lastPoint.y);
|
||||||
|
if (passedDistance >= SLIDER_GAP_SIZE) { // space them out uniformaly
|
||||||
|
passedDistance -= SLIDER_GAP_SIZE; // step down
|
||||||
// spawn a slider
|
// spawn a slider
|
||||||
BaseNPC* slider = new BaseNPC(point.x, point.y, point.z, 0, INSTANCE_OVERWORLD, 1, (*nextId)++, NPC_BUS);
|
BaseNPC* slider = new BaseNPC(point.x, point.y, point.z, 0, INSTANCE_OVERWORLD, 1, (*nextId)++, NPC_BUS);
|
||||||
NPCManager::NPCs[slider->appearanceData.iNPC_ID] = slider;
|
NPCManager::NPCs[slider->appearanceData.iNPC_ID] = slider;
|
||||||
@ -379,6 +384,7 @@ void TableData::loadPaths(int* nextId) {
|
|||||||
// rotate
|
// rotate
|
||||||
route.pop();
|
route.pop();
|
||||||
route.push(point);
|
route.push(point);
|
||||||
|
lastPoint = point;
|
||||||
}
|
}
|
||||||
|
|
||||||
// npc paths
|
// npc paths
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
const int SLIDER_SPEED = 1200;
|
const int SLIDER_SPEED = 1200;
|
||||||
const int SLIDER_STOP_TICKS = 16;
|
const int SLIDER_STOP_TICKS = 16;
|
||||||
|
const int SLIDER_GAP_SIZE = 45000;
|
||||||
|
|
||||||
struct WarpLocation;
|
struct WarpLocation;
|
||||||
|
|
||||||
|
2
tdata
2
tdata
@ -1 +1 @@
|
|||||||
Subproject commit a36aca30c9ff69b39a1b128227a6e69c77e3c00e
|
Subproject commit a6a3841ff219ed57bbfda008782220ac4c111664
|
Loading…
Reference in New Issue
Block a user