mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
moar destroyin!
This commit is contained in:
parent
cff6de73c3
commit
314429a2fe
2 changed files with 16 additions and 20 deletions
|
@ -74,6 +74,7 @@ bool FadeIn(struct Game *game, struct TM_Action *action, enum TM_ActionState sta
|
|||
al_destroy_bitmap(fade_bitmap);
|
||||
free(fadeloop);
|
||||
TM_DestroyArgs(action->arguments);
|
||||
action->arguments = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -106,6 +107,7 @@ bool FadeOut(struct Game *game, struct TM_Action *action, enum TM_ActionState st
|
|||
game->gamestate = GAMESTATE_LOADING;
|
||||
game->loadstate = GAMESTATE_MAP;
|
||||
TM_DestroyArgs(action->arguments);
|
||||
action->arguments = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -126,6 +128,7 @@ bool napis2(struct Game *game, struct TM_Action *action, enum TM_ActionState sta
|
|||
if (*tmp>=al_get_display_width(game->display)) { *tmp=0; return true; }
|
||||
} else {
|
||||
TM_DestroyArgs(action->arguments);
|
||||
action->arguments = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -147,6 +150,7 @@ bool napis(struct Game *game, struct TM_Action *action, enum TM_ActionState stat
|
|||
} else {
|
||||
TM_AddBackgroundAction(&napis2, NULL, 0);
|
||||
TM_DestroyArgs(action->arguments);
|
||||
action->arguments = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -144,22 +144,17 @@ void TM_Pause(bool pause) {
|
|||
|
||||
void TM_Destroy() {
|
||||
if (!game) return;
|
||||
// TODO: delete everything from queues
|
||||
// maybe delete all args too?
|
||||
struct TM_Action *tmp, *tmp2, *pom = queue;
|
||||
tmp = NULL;
|
||||
while (pom!=NULL) {
|
||||
if (pom->active) {
|
||||
if (*pom->function) {
|
||||
(*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
||||
if (tmp) {
|
||||
tmp->next = pom->next;
|
||||
} else {
|
||||
background = pom->next;
|
||||
}
|
||||
} else {
|
||||
// TODO: handle delay
|
||||
if (*pom->function) (*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
||||
else {
|
||||
// TODO: handle delay
|
||||
}
|
||||
} else {
|
||||
TM_DestroyArgs(pom->arguments);
|
||||
pom->arguments = NULL;
|
||||
}
|
||||
if ((!tmp) || (tmp->next==pom)) {
|
||||
tmp = pom;
|
||||
|
@ -176,16 +171,13 @@ void TM_Destroy() {
|
|||
pom=background;
|
||||
while (pom!=NULL) {
|
||||
if (pom->active) {
|
||||
if (*pom->function) {
|
||||
(*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
||||
if (tmp) {
|
||||
tmp->next = pom->next;
|
||||
} else {
|
||||
background = pom->next;
|
||||
}
|
||||
} else {
|
||||
// TODO: handle delay
|
||||
if (*pom->function) (*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
||||
else {
|
||||
// TODO: handle delay
|
||||
}
|
||||
} else {
|
||||
TM_DestroyArgs(pom->arguments);
|
||||
pom->arguments = NULL;
|
||||
}
|
||||
if ((!tmp) || (tmp->next==pom)) {
|
||||
tmp = pom;
|
||||
|
|
Loading…
Reference in a new issue