Reduced player particle spam
This commit is contained in:
parent
3e64af2e53
commit
e2b8d6a138
|
@ -416,6 +416,7 @@ void network_update_player(void) {
|
||||||
// figure out if we should send it or not
|
// figure out if we should send it or not
|
||||||
static u8 sTicksSinceSend = 0;
|
static u8 sTicksSinceSend = 0;
|
||||||
static u32 sLastPlayerAction = 0;
|
static u32 sLastPlayerAction = 0;
|
||||||
|
static u32 sLastPlayerParticles = 0;
|
||||||
static f32 sLastStickX = 0;
|
static f32 sLastStickX = 0;
|
||||||
static f32 sLastStickY = 0;
|
static f32 sLastStickY = 0;
|
||||||
static u32 sLastButtonDown = 0;
|
static u32 sLastButtonDown = 0;
|
||||||
|
@ -423,18 +424,20 @@ void network_update_player(void) {
|
||||||
|
|
||||||
f32 stickDist = sqrtf(powf(sLastStickX - m->controller->stickX, 2) + powf(sLastStickY - m->controller->stickY, 2));
|
f32 stickDist = sqrtf(powf(sLastStickX - m->controller->stickX, 2) + powf(sLastStickY - m->controller->stickY, 2));
|
||||||
bool shouldSend = (sTicksSinceSend > 2)
|
bool shouldSend = (sTicksSinceSend > 2)
|
||||||
|| (sLastPlayerAction != m->action)
|
|| (sLastPlayerAction != m->action)
|
||||||
|| (sLastButtonDown != m->controller->buttonDown)
|
|| (sLastButtonDown != m->controller->buttonDown)
|
||||||
|| (sLastButtonPressed != m->controller->buttonPressed)
|
|| (sLastButtonPressed != m->controller->buttonPressed)
|
||||||
|
|| (sLastPlayerParticles != m->particleFlags)
|
||||||
|| (stickDist > 5.0f);
|
|| (stickDist > 5.0f);
|
||||||
|
|
||||||
if (!shouldSend) { sTicksSinceSend++; return; }
|
if (!shouldSend) { sTicksSinceSend++; return; }
|
||||||
network_send_player(0);
|
network_send_player(0);
|
||||||
sTicksSinceSend = 0;
|
sTicksSinceSend = 0;
|
||||||
|
|
||||||
sLastPlayerAction = m->action;
|
sLastPlayerAction = m->action;
|
||||||
sLastStickX = m->controller->stickX;
|
sLastStickX = m->controller->stickX;
|
||||||
sLastStickY = m->controller->stickY;
|
sLastStickY = m->controller->stickY;
|
||||||
sLastButtonDown = m->controller->buttonDown;
|
sLastButtonDown = m->controller->buttonDown;
|
||||||
sLastButtonPressed = m->controller->buttonPressed;
|
sLastButtonPressed = m->controller->buttonPressed;
|
||||||
|
sLastPlayerParticles = m->particleFlags;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue