// "The girl is dead."
// "Level completed."
void game_pyjama_party_ask_next(struct gamedata * gamedata)
{
  window = NULL;
  if(gamedata->pyjama_party_girls_passed < gamedata->girls)
    {
      if(gamedata->pyjama_party_control == PARTYCONTROLLER_PLAYER || gamedata->pyjama_party_control == PARTYCONTROLLER_GIRL)
        { /* Ask the player how to continue the party. */
          struct widget * obj;
          struct widget_factory_data wfd[] =
            {
              { WFDT_ON_RELEASE, "on_button_clicked", gppan_on_button_clicked },
              { WFDT_ON_RELEASE, "on_save_clicked",   gppan_on_save_clicked   },
              { WFDT_ON_RELEASE, "on_quit_clicked",   gppan_on_quit_clicked   },
              { WFDT_SIZEOF_,    NULL,                NULL                    }
            };

          if(gamedata->ai != NULL)
            gamedata->ai = ai_free(gamedata->ai);

          window = widget_factory(wfd, NULL, "game_pyjama_party_ask_next");
          widget_center(window);
          widget_set_gamedata_pointer(window, "gamedata", gamedata);
          
          obj = widget_find(window, "gppan_yes");
          widget_set_ulong(obj, "party", PARTYCONTROLLER_PLAYER);

          obj = widget_find(window, "gppan_no");
          widget_set_ulong(obj, "party", PARTYCONTROLLER_GIRL);

          obj = widget_find(window, "gppan_partyrun");
          widget_set_ulong(obj, "party", PARTYCONTROLLER_PARTY);
      
          ui_push_handlers();
          ui_set_navigation_handlers();
          ui_set_handler(UIC_EXIT,   gppan_on_exit);
          ui_set_handler(UIC_CANCEL, gppan_on_exit);
        }
      else
        { /* Party on non-stop until the next level. */
          pyjama_party_next(gamedata);
        }
    }
  else
    { /* All girls has passed the level, next level. */
      pyjama_party_next(gamedata);
    }
}
Ejemplo n.º 2
0
void game_free(game_t *game)
{
	int i;

	printf("Game freeing!\n");

	// Free structures
	if(game->lv != NULL) level_free(game->lv);

	// Free action buffers
	if(game->ab_local != NULL)
		abuf_free(game->ab_local);
	for(i = 0; i < TEAM_MAX; i++)
		if(game->ab_teams[i] != NULL)
			abuf_free(game->ab_teams[i]);

	// Free AIs
	for(i = 0; i < TEAM_MAX; i++)
		if(game->ai_teams[i] != NULL)
			ai_free(game->ai_teams[i]);

	// Free
	free(game);
}
Ejemplo n.º 3
0
void ai_release(aidata_t* ai)
{
    ai_free(ai);
}