~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to src/tron/gMenus.cpp

  • Committer: SwagTron
  • Date: 2019-03-03 20:57:16 UTC
  • Revision ID: swagtron-20190303205716-nk32wtrusb3tum54
As far as I am aware, compiling 2.9 sty+ct+ap was incredibly difficult and impossible without using older versions merged with the latest revision (thanks to Nelg's help). Created a proper win32 folder, a readme file, and made it simple to compile for windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
452
452
static tConfItem<bool> wsp("WHITE_SPARKS",white_sparks);
453
453
 
454
454
extern bool sg_crashExplosion;   // from gExplosion.cpp
455
 
static tConfItem<bool> crexp("EXPLOSION",sg_crashExplosion);
456
 
 
457
 
#ifndef DEDICATED
458
 
// both from ePlayer.cpp
459
 
static tConfItem<bool> se_highlightMyNameConf("HIGHLIGHT_NAME", se_highlightMyName);
460
 
 
461
 
static tConfItem<bool> se_tabCompletionConf("TAB_COMPLETION", se_tabCompletion);
462
 
static tConfItem<bool> se_tabCompletionColors("TAB_COMPLETION_WITH_COLORS", se_tabCompletionWithColors);
463
 
 
464
 
void sg_SpecialMenu()
465
 
{
466
 
    uMenu menu("$special_setup_menu_text");
467
 
 
468
 
    uMenuItemToggle hlm(&menu, "$highlight_name_menu_text", "$highlight_name_menu_help", se_highlightMyName);
469
 
    uMenuItemToggle tcwc(&menu, "$tab_completion_with_colors_menu_text", "$tab_completion_with_colors_menu_help", se_tabCompletionWithColors);
470
 
    uMenuItemToggle tc(&menu, "$tab_completion_menu_text", "$tab_completion_menu_help", se_tabCompletion);
471
 
 
472
 
    uMenuItemToggle hcw(&menu, "$hide_cycles_walls_menu_text", "$hide_cycles_walls_menu_help", sg_HideCyclesWalls);
473
 
    uMenuItemToggle hc(&menu, "$hide_cycles_menu_text", "$hide_cycles_menu_help", sg_HideCycles);
474
 
 
475
 
    menu.Enter();
476
 
}
477
 
 
478
 
void sg_ConfigMenu()
479
 
{
480
 
    uMenu menu("$config_setup_menu_text");
481
 
 
482
 
    uMenuItemFunction sac(&menu, "$config_save_all_text", "$config_save_all_help", &tConfItemBase::WriteAllToFile);
483
 
    uMenuItemFunction lac(&menu, "$config_load_all_text", "$config_load_all_help", &st_LoadConfig);
484
 
 
485
 
    uMenuItemFunction scc(&menu, "$config_save_changed_text", "$config_save_changed_help", &tConfItemBase::WriteChangedToFile);
486
 
 
487
 
    /*
488
 
    uMenuItemFunction suc(&menu, "$config_user_save_text", "$config_user_save_help", &st_SaveConfig);
489
 
    uMenuItemFunction luc(&menu, "$config_user_load_text", "$config_user_load_help", &st_LoadUserConfig);
490
 
    */
491
 
 
492
 
    menu.Enter();
493
 
}
 
455
static tConfItem<bool> crexp("EXPLOSION",sg_crashExplosion);
 
456
 
 
457
#ifndef DEDICATED
 
458
// both from ePlayer.cpp
 
459
static tConfItem<bool> se_highlightMyNameConf("HIGHLIGHT_NAME", se_highlightMyName);
 
460
 
 
461
static tConfItem<bool> se_tabCompletionConf("TAB_COMPLETION", se_tabCompletion);
 
462
static tConfItem<bool> se_tabCompletionColors("TAB_COMPLETION_WITH_COLORS", se_tabCompletionWithColors);
 
463
 
 
464
void sg_SpecialMenu()
 
465
{
 
466
    uMenu menu("$special_setup_menu_text");
 
467
 
 
468
    uMenuItemToggle hlm(&menu, "$highlight_name_menu_text", "$highlight_name_menu_help", se_highlightMyName);
 
469
    uMenuItemToggle tcwc(&menu, "$tab_completion_with_colors_menu_text", "$tab_completion_with_colors_menu_help", se_tabCompletionWithColors);
 
470
    uMenuItemToggle tc(&menu, "$tab_completion_menu_text", "$tab_completion_menu_help", se_tabCompletion);
 
471
 
 
472
    uMenuItemToggle hcw(&menu, "$hide_cycles_walls_menu_text", "$hide_cycles_walls_menu_help", sg_HideCyclesWalls);
 
473
    uMenuItemToggle hc(&menu, "$hide_cycles_menu_text", "$hide_cycles_menu_help", sg_HideCycles);
 
474
 
 
475
    menu.Enter();
 
476
}
 
477
 
 
478
void sg_ConfigMenu()
 
479
{
 
480
    uMenu menu("$config_setup_menu_text");
 
481
 
 
482
    uMenuItemFunction sac(&menu, "$config_save_all_text", "$config_save_all_help", &tConfItemBase::WriteAllToFile);
 
483
    uMenuItemFunction lac(&menu, "$config_load_all_text", "$config_load_all_help", &st_LoadConfig);
 
484
 
 
485
    uMenuItemFunction scc(&menu, "$config_save_changed_text", "$config_save_changed_help", &tConfItemBase::WriteChangedToFile);
 
486
 
 
487
    /*
 
488
    uMenuItemFunction suc(&menu, "$config_user_save_text", "$config_user_save_help", &st_SaveConfig);
 
489
    uMenuItemFunction luc(&menu, "$config_user_load_text", "$config_user_load_help", &st_LoadUserConfig);
 
490
    */
 
491
 
 
492
    menu.Enter();
 
493
}
494
494
 
495
495
//extern bool png_screenshot;           // from rSysdep.cpp
496
496
//static tConfItem<bool> pns("PNG_SCREENSHOT",png_screenshot);
617
617
static tConfItem<bool> showbm("SHOW_BRAKE",subby_ShowBrakeMeter);
618
618
static tConfItem<bool> showrm("SHOW_RUBBER",subby_ShowRubberMeter);
619
619
static tConfItem<bool> showtim("SHOW_TIME",showTime);
620
 
static tConfItem<bool> show24("SHOW_TIME_24",show24hour);
 
620
static tConfItem<bool> show24("SHOW_TIME_24",show24hour);
621
621
static tConfItem<bool> showpos("SHOW_POSITION",showPosition);
622
622
 
623
623
static tConfItem<REAL> scorex("SCORE_LOCX",subby_ScoreLocX);
634
634
 
635
635
static tConfItem<REAL> px("PING_LOCX",subby_PingLocX);
636
636
static tConfItem<REAL> py("PING_LOCY",subby_PingLocY);
637
 
static tConfItem<REAL> ps("PING_SIZE",subby_PingSize);
638
 
 
639
 
static tConfItem<REAL> positionx("POSITION_LOCX",subby_CoordLocX);
640
 
static tConfItem<REAL> positiony("POSITION_LOCY",subby_CoordLoxY);
 
637
static tConfItem<REAL> ps("PING_SIZE",subby_PingSize);
 
638
 
 
639
static tConfItem<REAL> positionx("POSITION_LOCX",subby_CoordLocX);
 
640
static tConfItem<REAL> positiony("POSITION_LOCY",subby_CoordLoxY);
641
641
static tConfItem<REAL> positions("POSITION_SIZE",subby_CoordSize);
642
642
 
643
643
uMenuItemToggle hud3
680
680
(&hud_prefs,"$pref_showhud_text",
681
681
 "$pref_showhud_help",subby_ShowHUD);
682
682
 
683
 
static tConfItem<bool> WRAP("WRAP_MENU",uMenu::wrap);
684
 
 
685
 
static void ConTabCompletition(tString &strString, int &curserPos)
686
 
{
687
 
    tArray<tString> msgsExt = strString.Split(" ");
688
 
    tString newString;
689
 
    int cusPos = 0;
690
 
 
691
 
    for(int i = 0; i < msgsExt.Len(); i++)
692
 
    {
693
 
        tString word = msgsExt[i];
694
 
 
695
 
        cusPos += word.Len() - 1;
696
 
 
697
 
        if (cusPos == curserPos)
698
 
        {
699
 
            tString found_command = tConfItemBase::FindConfigItem(word.Filter());
700
 
            if (found_command != "")
701
 
                word = found_command + " ";
702
 
        }
703
 
 
704
 
        cusPos++;
705
 
 
706
 
        if ((i + 1) == msgsExt.Len())
707
 
            newString << word;
708
 
        else
709
 
            newString << word << " ";
710
 
    }
711
 
 
712
 
    strString = newString;
713
 
    curserPos = newString.Len();
 
683
static tConfItem<bool> WRAP("WRAP_MENU",uMenu::wrap);
 
684
 
 
685
static void ConTabCompletition(tString &strString, int &curserPos)
 
686
{
 
687
    tArray<tString> msgsExt = strString.Split(" ");
 
688
    tString newString;
 
689
    int cusPos = 0;
 
690
 
 
691
    for(int i = 0; i < msgsExt.Len(); i++)
 
692
    {
 
693
        tString word = msgsExt[i];
 
694
 
 
695
        cusPos += word.Len() - 1;
 
696
 
 
697
        if (cusPos == curserPos)
 
698
        {
 
699
            tString found_command = tConfItemBase::FindConfigItem(word.Filter());
 
700
            if (found_command != "")
 
701
                word = found_command + " ";
 
702
        }
 
703
 
 
704
        cusPos++;
 
705
 
 
706
        if ((i + 1) == msgsExt.Len())
 
707
            newString << word;
 
708
        else
 
709
            newString << word << " ";
 
710
    }
 
711
 
 
712
    strString = newString;
 
713
    curserPos = newString.Len();
714
714
}
715
715
 
716
716
class gMemuItemConsole: uMenuItemStringWithHistory{
737
737
 
738
738
            MyMenu()->Exit();
739
739
            return true;
740
 
        }
741
 
        else if (e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_TAB)
742
 
        {
743
 
            if ((*content != "") && se_tabCompletion)
744
 
            {
745
 
                tString strString;
746
 
                strString << *content;
747
 
 
748
 
                ConTabCompletition(strString, cursorPos);
749
 
                *content = strString;
750
 
            }
 
740
        }
 
741
        else if (e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_TAB)
 
742
        {
 
743
            if ((*content != "") && se_tabCompletion)
 
744
            {
 
745
                tString strString;
 
746
                strString << *content;
 
747
 
 
748
                ConTabCompletition(strString, cursorPos);
 
749
                *content = strString;
 
750
            }
751
751
        }
752
752
        else if (e.type==SDL_KEYDOWN &&
753
753
                 uActionGlobal::IsBreakingGlobalBind(e.key.keysym.sym))
1005
1005
     "$player_num_per_team_help",
1006
1006
     p->favoriteNumberOfPlayersPerTeam, 1, 16, 1);
1007
1007
 
1008
 
    //Color Randomization in the player menu
1009
 
    uMenuItemSelection<int> se_cr(&playerMenu,"$player_color_randomization_text","$player_color_randomization_help",p->colorRandomization);
1010
 
    se_cr.NewChoice("$player_color_randomization_none_text",   "$player_color_randomization_none_help",   COLORRANDOMIZATIONOFF);
1011
 
    se_cr.NewChoice("$player_color_randomization_random_text", "$player_color_randomization_random_help", COLORRANDOMIZATIONRANDOM);
1012
 
    se_cr.NewChoice("$player_color_randomization_unique_text", "$player_color_randomization_unique_help", COLORRANDOMIZATIONUNIQUE);
1013
 
 
1014
1008
    ArmageTron_color_menuitem B(&playerMenu,"$player_blue_text",
1015
1009
                                "$player_blue_help",
1016
1010
                                p->rgb,2);
1119
1113
    cam_s.NewChoice("$player_camera_initial_smrt_text","$player_camera_initial_smrt_help",CAMERA_SMART);
1120
1114
    cam_s.NewChoice("$player_camera_initial_ext_text","$player_camera_initial_ext_help",CAMERA_FOLLOW);
1121
1115
    cam_s.NewChoice("$player_camera_initial_free_text","$player_camera_initial_free_help",CAMERA_FREE);
1122
 
 
1123
 
    uMenuItemString tn(&playerMenu,
1124
 
                      "$player_teamname_text",
1125
 
                      "$player_teamname_help",
1126
 
                      p->teamname, 16);
 
1116
 
 
1117
    uMenuItemString tn(&playerMenu,
 
1118
                      "$player_teamname_text",
 
1119
                      "$player_teamname_help",
 
1120
                      p->teamname, 16);
1127
1121
 
1128
1122
    uMenuItemColorLine n(&playerMenu, p->name, 16);
1129
1123