/*--------------------------------------------------------------- Routine : delete_level Purpose : Delete a level (NOT the items in it!) ---------------------------------------------------------------*/ void delete_level( LEVEL *lp) { LEVEL *next; if (lp == NULL) return; next = lp->next; if ( lp != NULL ) FreeMemory(lp); delete_level(next); } /* delete_level */
void CWorldModel::next_level() { //if at the start of the game do not try and destroy the level as none exists and crashes the game if (level !=0) { delete_level(); } level++; //loads the required level from file CFiles::Inst()->load_level(level); //creates all the entities for the level create_entity(); //sets the players health using life entityV[entities[ePlayer]]->set_health(100-life); screen=1;//sets the screen count to 1 boss_attack=false;//stops the boss from moving until the players reaches screen 5 end_cond="GAME OVER";//defult setting CSounds::Inst()->play_background(level,boss_attack);// starts plying the background music }