MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / EditEffParamColumn

Method EditEffParamColumn

Source/FamiTrackerView.cpp:2514–2579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2512}
2513
2514bool CFamiTrackerView::EditEffParamColumn(stChanNote &Note, int Key, int EffectIndex, bool &bStepDown, bool &bMoveRight, bool &bMoveLeft)
2515{
2516 edit_style_t EditStyle = FTEnv.GetSettings()->General.iEditStyle; // // //
2517 const cursor_column_t Column = m_pPatternEditor->GetColumn(); // // //
2518 int Value = ConvertKeyToHex(Key);
2519
2520 if (!m_bEditEnable)
2521 return false;
2522
2523 if (CheckRepeatKey(Key)) {
2524 Note.Effects[EffectIndex] = m_LastNote.Effects[0];
2525 if (EditStyle != edit_style_t::MPT) // // //
2526 bStepDown = true;
2527 if (m_bEditEnable && Note.Effects[EffectIndex].fx != effect_t::none) // // //
2528 GetParentFrame()->SetMessageText(GetEffectHint(Note, EffectIndex));
2529 return true;
2530 }
2531
2532 if (CheckClearKey(Key)) {
2533 Note.Effects[EffectIndex].param = 0;
2534 if (EditStyle != edit_style_t::MPT)
2535 bStepDown = true;
2536 return true;
2537 }
2538
2539 if (Value == -1 && FTEnv.GetSettings()->General.bHexKeypad) // // //
2540 Value = ConvertKeyExtra(Key);
2541 if (Value == -1)
2542 return false;
2543
2544 unsigned char Mask, Shift;
2545 if (Column == cursor_column_t::EFF1_PARAM1 || Column == cursor_column_t::EFF2_PARAM1 || Column == cursor_column_t::EFF3_PARAM1 || Column == cursor_column_t::EFF4_PARAM1) {
2546 Mask = 0x0F;
2547 Shift = 4;
2548 }
2549 else {
2550 Mask = 0xF0;
2551 Shift = 0;
2552 }
2553
2554 switch (EditStyle) {
2555 case edit_style_t::FT2: // FT2
2556 Note.Effects[EffectIndex].param = (Note.Effects[EffectIndex].param & Mask) | Value << Shift;
2557 bStepDown = true;
2558 break;
2559 case edit_style_t::MPT: // Modplug
2560 Note.Effects[EffectIndex].param = ((Note.Effects[EffectIndex].param & 0x0F) << 4) | Value & 0x0F;
2561 break;
2562 case edit_style_t::IT: // IT
2563 Note.Effects[EffectIndex].param = (Note.Effects[EffectIndex].param & Mask) | Value << Shift;
2564 if (Mask == 0x0F)
2565 bMoveRight = true;
2566 else {
2567 bMoveLeft = true;
2568 bStepDown = true;
2569 }
2570 break;
2571 }

Callers

nothing calls this directly

Calls 4

ConvertKeyToHexFunction · 0.85
ConvertKeyExtraFunction · 0.85
GetSettingsMethod · 0.45
GetColumnMethod · 0.45

Tested by

no test coverage detected