/****************************************************************************** * GAME_INIT * * * * This function will print the game version and game title. * * It will set the life to MAX_LIFE (7) and reset the stick man. * ******************************************************************************/ void game_init(void) { print_headings(); printstkfgr(MAX_LIFE); show_stat(RESET); lives(MAX_LIFE); }
void Screen_game::draw(string gender, float rotate, bool leftside, bool rightside){ background.draw(Left, Right); timeline(); lives(gender); Left = leftside; Right = rightside; if(Left) rotation = -(rotate*122); if(Right) rotation = rotate*120; if(gender == "boy"){ if(fabs(rotation) > 50.0 || robotFalling){ robotFalling = true; boy_fell(); }else{ boy(); prevRotation = rotation; fallPositionX = 0; fallPositionY = 0; if(new_num_lives <= 0){ background.timer = 0; background.pause = 0; background.init(); } if(num_lives > new_num_lives) num_lives = new_num_lives; } }else{ if(fabs(rotation) > 50.0 || robotFalling){ robotFalling = true; girl_fell(); }else{ girl(); prevRotation = rotation; fallPositionX = 0; fallPositionY = 0; if(new_num_lives <= 0){ background.timer = 0; background.pause = 0; background.init(); } if(num_lives > new_num_lives) num_lives = new_num_lives; } } }
/****************************************************************************** * UPDATE * * * * Update the word with the character input then re print the headings * ******************************************************************************/ void update(char c, int word_size, int index, char *guess_word, int rem_lives) { int i; print_headings(); printstkfgr(rem_lives); show_stat(c); lives(rem_lives); guess_word[index] = c; for (i = 0; i < word_size; i++) printf("%c ", guess_word[i]); printf("\n"); }
/* Options are added to the current settings; call Init() beforehand if * you don't want this. */ void SongOptions::FromString( CString sOptions ) { // Init(); sOptions.MakeLower(); CStringArray asBits; split( sOptions, ",", asBits, true ); for( unsigned i=0; i<asBits.size(); i++ ) { CString& sBit = asBits[i]; TrimLeft(sBit); TrimRight(sBit); Regex mult("^([0-9]+(\\.[0-9]+)?)xmusic$"); vector<CString> matches; if( mult.Compare(sBit, matches) ) { char *p = NULL; m_fMusicRate = strtof( matches[0], &p ); ASSERT( p != matches[0] ); } matches.clear(); Regex lives("^([0-9]+) ?(lives|life)$"); if( lives.Compare(sBit, matches) ) { int ret = sscanf( matches[0], "%i", &m_iBatteryLives ); ASSERT( ret == 1 ); } CStringArray asParts; split( sBit, " ", asParts, true ); bool on = true; if( asParts.size() > 1 ) { sBit = asParts[1]; if( asParts[0] == "no" ) on = false; } if( sBit == "norecover" ) m_DrainType = DRAIN_NO_RECOVER; else if( sBit == "suddendeath" ) m_DrainType = DRAIN_SUDDEN_DEATH; else if( sBit == "power-drop" ) m_DrainType = DRAIN_NO_RECOVER; else if( sBit == "death" ) m_DrainType = DRAIN_SUDDEN_DEATH; else if( sBit == "normal-drain" ) m_DrainType = DRAIN_NORMAL; else if( sBit == "failarcade" || sBit == "failimmediate" ) m_FailType = FAIL_IMMEDIATE; else if( sBit == "failendofsong" ) m_FailType = FAIL_END_OF_SONG; else if( sBit == "failoff" ) m_FailType = FAIL_OFF; else if( sBit == "faildefault" ) { SongOptions so; // TODO: Fix this so that SongOptions don't depend on PrefsManager so.FromString( PREFSMAN->m_sDefaultModifiers ); m_FailType = so.m_FailType; } else if( sBit == "assisttick" ) m_bAssistTick = on; else if( sBit == "autosync" || sBit == "autosyncsong" ) m_AutosyncType = on ? AUTOSYNC_SONG : AUTOSYNC_OFF; else if( sBit == "autosyncmachine" ) m_AutosyncType = on ? AUTOSYNC_MACHINE : AUTOSYNC_OFF; else if( sBit == "savescore" ) m_bSaveScore = on; else if( sBit == "bar" ) m_LifeType = LIFE_BAR; else if( sBit == "battery" ) m_LifeType = LIFE_BATTERY; else if( sBit == "lifetime" ) m_LifeType = LIFE_TIME; } }