//Memory Management GameController game_controller_init() { //ZZZ TODO: Take file input to determine load. GameController self = emalloc(sizeof *self); /* Game objects */ self->bullet_storage = bullet_storage_init(BULLET_LIMIT); if (self->bullet_storage == NULL) { game_controller_free(self); return NULL; } /* Flags */ self->flag_external_state = GAME_STATE; self->is_paused = false; self->flag_test = true; //ZZZ This is used purely for testing. It causes a render on the bottom screen. //ZZZ Create a EnemyController Holder //ZZZ Create a player based on init input //ZZZ Create an powerup_array like bullet holder for our powerups. //ZZZT This is a single enemy that is used for testing. #define EX 370 #define EY 30 #define ERADIUS 15 #define EHEALTH 100 self->enemy = enemy_init(EX, EY, ERADIUS, EHEALTH); //ZZZT self->enemy->y_velocity = 5; //ZZZT //PowerupController powerup_controller; //This reimu player init, needs to be set by some settings file. #define PNAME "REIMU" #define PX 5 #define PY 140 #define PRADIUS 4 #define PLIVES 3 #define PDAMAGE 100 #define PFRATE 10 self->player = player_init(PNAME, PX, PY, PRADIUS, PLIVES, PDAMAGE, PFRATE); return self; }
/*! \brief Initiate fighter structs and initial vars * \author Josh Bolduc * \date Created ???????? * \date Updated * * Pre-combat setup of fighter structures and initial vars. */ static void init_fighters (void) { int index; for (index = 0; index < NUM_FIGHTERS; index++) { deffect[index] = 0; fighter[index].mhp = 0; fighter[index].aux = 0; /* .defend was not initialized; patch supplied by Sam H */ fighter[index].defend = 0; } /* TT: These two are only called once in the game. * Should we move them here? */ hero_init (); enemy_init (); for (index = 0; index < (PSIZE + numens); index++) nspeed[index] = (fighter[index].stats[A_SPD] + 50) / 5; }