// ---------------------------------------------------------------------------------------------- // following functions use function parameters to determine range of frames void EDITOR::toggleInput(int start, int end, int joy, int button, int consecutivenessTag) { if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return; int check_frame = end; if (start > end) { // swap int temp_start = start; start = end; end = temp_start; } if (start < 0) start = end; if (end >= currMovieData.getNumRecords()) return; if (currMovieData.records[check_frame].checkBit(joy, button)) { // clear range for (int i = start; i <= end; ++i) currMovieData.records[i].clearBit(joy, button); greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_UNSET, start, end, 0, NULL, consecutivenessTag)); } else { // set range for (int i = start; i <= end; ++i) currMovieData.records[i].setBit(joy, button); greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_SET, start, end, 0, NULL, consecutivenessTag)); } }
bool EDITOR::handleInputColumnSetUsingPattern(int joy, int button) { if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return false; RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection(); if (current_selection->size() == 0) return false; RowsSelection::iterator current_selection_begin(current_selection->begin()); RowsSelection::iterator current_selection_end(current_selection->end()); int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern; for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++) { // skip lag frames if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(*it) == LAGGED_YES) continue; currMovieData.records[*it].setBitValue(joy, button, patterns[current_pattern][pattern_offset] != 0); pattern_offset++; if (pattern_offset >= (int)patterns[current_pattern].size()) pattern_offset -= patterns[current_pattern].size(); } int first_changes = history.registerChanges(MODTYPE_PATTERN, *current_selection_begin, *current_selection->rbegin(), 0, patternsNames[current_pattern].c_str()); if (first_changes >= 0) { greenzone.invalidateAndUpdatePlayback(first_changes); return true; } else return false; }
bool EDITOR::handleInputColumnSet(int joy, int button) { if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return false; RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection(); if (current_selection->size() == 0) return false; RowsSelection::iterator current_selection_begin(current_selection->begin()); RowsSelection::iterator current_selection_end(current_selection->end()); //inspect the selected frames, if they are all set, then unset all, else set all bool newValue = false; for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++) { if (!(currMovieData.records[*it].checkBit(joy,button))) { newValue = true; break; } } // apply newValue for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++) currMovieData.records[*it].setBitValue(joy,button,newValue); int first_changes; if (newValue) { first_changes = history.registerChanges(MODTYPE_SET, *current_selection_begin, *current_selection->rbegin()); } else { first_changes = history.registerChanges(MODTYPE_UNSET, *current_selection_begin, *current_selection->rbegin()); } if (first_changes >= 0) { greenzone.invalidateAndUpdatePlayback(first_changes); return true; } else return false; }
void EDITOR::setInputUsingPattern(int start, int end, int joy, int button, int consecutivenessTag) { if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return; if (start > end) { // swap int temp_start = start; start = end; end = temp_start; } if (start < 0) start = end; if (end >= currMovieData.getNumRecords()) return; int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern; bool changes_made = false; bool value; for (int i = start; i <= end; ++i) { // skip lag frames if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(i) == LAGGED_YES) continue; value = (patterns[current_pattern][pattern_offset] != 0); if (currMovieData.records[i].checkBit(joy, button) != value) { changes_made = true; currMovieData.records[i].setBitValue(joy, button, value); } pattern_offset++; if (pattern_offset >= (int)patterns[current_pattern].size()) pattern_offset -= patterns[current_pattern].size(); } if (changes_made) greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_PATTERN, start, end, 0, patternsNames[current_pattern].c_str(), consecutivenessTag)); }