Entity: Fix value0 reseting on Process
This commit is contained in:
21
src/Entity.c
21
src/Entity.c
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user