mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 19:16: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);
|
al_destroy_bitmap(fade_bitmap);
|
||||||
free(fadeloop);
|
free(fadeloop);
|
||||||
TM_DestroyArgs(action->arguments);
|
TM_DestroyArgs(action->arguments);
|
||||||
|
action->arguments = NULL;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,7 @@ bool FadeOut(struct Game *game, struct TM_Action *action, enum TM_ActionState st
|
||||||
game->gamestate = GAMESTATE_LOADING;
|
game->gamestate = GAMESTATE_LOADING;
|
||||||
game->loadstate = GAMESTATE_MAP;
|
game->loadstate = GAMESTATE_MAP;
|
||||||
TM_DestroyArgs(action->arguments);
|
TM_DestroyArgs(action->arguments);
|
||||||
|
action->arguments = NULL;
|
||||||
}
|
}
|
||||||
return false;
|
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; }
|
if (*tmp>=al_get_display_width(game->display)) { *tmp=0; return true; }
|
||||||
} else {
|
} else {
|
||||||
TM_DestroyArgs(action->arguments);
|
TM_DestroyArgs(action->arguments);
|
||||||
|
action->arguments = NULL;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -147,6 +150,7 @@ bool napis(struct Game *game, struct TM_Action *action, enum TM_ActionState stat
|
||||||
} else {
|
} else {
|
||||||
TM_AddBackgroundAction(&napis2, NULL, 0);
|
TM_AddBackgroundAction(&napis2, NULL, 0);
|
||||||
TM_DestroyArgs(action->arguments);
|
TM_DestroyArgs(action->arguments);
|
||||||
|
action->arguments = NULL;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,22 +144,17 @@ void TM_Pause(bool pause) {
|
||||||
|
|
||||||
void TM_Destroy() {
|
void TM_Destroy() {
|
||||||
if (!game) return;
|
if (!game) return;
|
||||||
// TODO: delete everything from queues
|
|
||||||
// maybe delete all args too?
|
|
||||||
struct TM_Action *tmp, *tmp2, *pom = queue;
|
struct TM_Action *tmp, *tmp2, *pom = queue;
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
while (pom!=NULL) {
|
while (pom!=NULL) {
|
||||||
if (pom->active) {
|
if (pom->active) {
|
||||||
if (*pom->function) {
|
if (*pom->function) (*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
||||||
(*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
else {
|
||||||
if (tmp) {
|
// TODO: handle delay
|
||||||
tmp->next = pom->next;
|
|
||||||
} else {
|
|
||||||
background = pom->next;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// TODO: handle delay
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
TM_DestroyArgs(pom->arguments);
|
||||||
|
pom->arguments = NULL;
|
||||||
}
|
}
|
||||||
if ((!tmp) || (tmp->next==pom)) {
|
if ((!tmp) || (tmp->next==pom)) {
|
||||||
tmp = pom;
|
tmp = pom;
|
||||||
|
@ -176,16 +171,13 @@ void TM_Destroy() {
|
||||||
pom=background;
|
pom=background;
|
||||||
while (pom!=NULL) {
|
while (pom!=NULL) {
|
||||||
if (pom->active) {
|
if (pom->active) {
|
||||||
if (*pom->function) {
|
if (*pom->function) (*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
||||||
(*pom->function)(game, pom, TM_ACTIONSTATE_DESTROY);
|
else {
|
||||||
if (tmp) {
|
// TODO: handle delay
|
||||||
tmp->next = pom->next;
|
|
||||||
} else {
|
|
||||||
background = pom->next;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// TODO: handle delay
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
TM_DestroyArgs(pom->arguments);
|
||||||
|
pom->arguments = NULL;
|
||||||
}
|
}
|
||||||
if ((!tmp) || (tmp->next==pom)) {
|
if ((!tmp) || (tmp->next==pom)) {
|
||||||
tmp = pom;
|
tmp = pom;
|
||||||
|
|
Loading…
Reference in a new issue