Entity: Fix value0 reseting on Process

This commit is contained in:
2021-04-26 17:10:39 +02:00
committed by Valeriano A.R
parent 6f7a850404
commit 80a15daa86

View File

@@ -288,7 +288,10 @@ int Entity_IsVisible(Entity e, int x, int y, int w, int h) {
//
//
void Entity_Process(Entity e, int ft) {
e->internalFlags &= ~EntityIntFlag_UpdatedPos;
if (e->internalFlags & EntityIntFlag_UpdatedPos) {
vec2_copy(e->pos0, e->pos);
e->internalFlags &= ~EntityIntFlag_UpdatedPos;
}
if (e->internalFlags & EntityIntFlag_UpdatedScale) {
e->scale0[0] = e->scale[0];
@@ -296,6 +299,14 @@ void Entity_Process(Entity e, int ft) {
e->internalFlags &= ~EntityIntFlag_UpdatedScale;
}
if (e->internalFlags & EntityIntFlag_UpdatedColor) {
e->color0[0] = e->color[0];
e->color0[1] = e->color[1];
e->color0[2] = e->color[2];
e->color0[3] = e->color[3];
e->internalFlags &= ~EntityIntFlag_UpdatedColor;
}
// Launch method
if (e->proc) {
e->proc(e, ft);
@@ -309,14 +320,6 @@ void Entity_Process(Entity e, int ft) {
void Entity_PostProcess(Entity e, int ft) {
float qlen, len;
vec2_copy(e->pos0, e->pos);
e->color0[0] = e->color[0];
e->color0[1] = e->color[1];
e->color0[2] = e->color[2];
e->color0[3] = e->color[3];
e->internalFlags &= ~EntityIntFlag_UpdatedColor;
// Determine if there is movement
qlen = vec2_dot(e->vel, e->vel);
if (qlen > 0.0f) {