- Afegit nom als actors

- [BUG] Els actors es movien magicament (push no definit)
- Clear de actors
- Comencem amb l'editor
This commit is contained in:
2023-06-04 11:37:27 +02:00
parent 5ee23cb000
commit 312bed64da
5 changed files with 57 additions and 28 deletions

View File

@@ -19,14 +19,16 @@ namespace actor
return first;
}
actor_t *create(vec3_t p, vec3_t s, SDL_Rect r, SDL_Point o)
actor_t *create(const char *name, vec3_t p, vec3_t s, SDL_Rect r, SDL_Point o)
{
actor_t *act = (actor_t*)malloc(sizeof(actor_t));
strcpy(act->name, name);
act->pos = p;
act->size = s;
act->bmp_rect = r;
act->bmp_offset = o;
act->anim_cycle = 0;
act->anim_cycle = act->orient = 0;
act->push = act->mov_push = PUSH_NONE;
act->below = act->above = nullptr;
act->prev = act->next = nullptr;
return act;
@@ -582,4 +584,16 @@ namespace actor
(obj1->pos.z < obj2->pos.z + obj2->size.z) &&
(obj1->pos.z + obj1->size.z > obj2->pos.z );
}
void clear()
{
actor_t *act = first;
while (act)
{
actor_t *tmp = act->next;
free(act);
act = tmp;
}
first = dirty = nullptr;
}
}