MCPcopy Create free account
hub / github.com/JACoders/OpenJK / UI_FeederSelection

Function UI_FeederSelection

code/ui/ui_main.cpp:1880–2051  ·  view source on GitHub ↗

================= UI_FeederSelection ================= */

Source from the content-addressed store, hash-verified

1878=================
1879*/
1880static void UI_FeederSelection(float feederID, int index, itemDef_t *item)
1881{
1882 if (feederID == FEEDER_SAVEGAMES)
1883 {
1884 s_savegame.currentLine = index;
1885 UI_HandleLoadSelection();
1886 }
1887 else if (feederID == FEEDER_MOVES)
1888 {
1889 itemDef_t *item;
1890 menuDef_t *menu;
1891 modelDef_t *modelPtr;
1892 char skin[MAX_QPATH];
1893
1894 menu = Menus_FindByName("datapadMovesMenu");
1895
1896 if (menu)
1897 {
1898 item = (itemDef_s *) Menu_FindItemByName((menuDef_t *) menu, "character");
1899 if (item)
1900 {
1901 modelPtr = (modelDef_t*)item->typeData;
1902 if (modelPtr)
1903 {
1904 if (datapadMoveData[uiInfo.movesTitleIndex][index].anim)
1905 {
1906 ItemParse_model_g2anim_go( item, datapadMoveData[uiInfo.movesTitleIndex][index].anim );
1907 uiInfo.moveAnimTime = DC->g2hilev_SetAnim(&item->ghoul2[0], "model_root", modelPtr->g2anim, qtrue);
1908
1909 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
1910
1911 // Play sound for anim
1912 if (datapadMoveData[uiInfo.movesTitleIndex][index].sound == MDS_FORCE_JUMP)
1913 {
1914 DC->startLocalSound(uiInfo.uiDC.Assets.datapadmoveJumpSound, CHAN_LOCAL );
1915 }
1916 else if (datapadMoveData[uiInfo.movesTitleIndex][index].sound == MDS_ROLL)
1917 {
1918 DC->startLocalSound(uiInfo.uiDC.Assets.datapadmoveRollSound, CHAN_LOCAL );
1919 }
1920 else if (datapadMoveData[uiInfo.movesTitleIndex][index].sound == MDS_SABER)
1921 {
1922 // Randomly choose one sound
1923 int soundI = Q_irand( 1, 6 );
1924 sfxHandle_t *soundPtr;
1925 soundPtr = &uiInfo.uiDC.Assets.datapadmoveSaberSound1;
1926 if (soundI == 2)
1927 {
1928 soundPtr = &uiInfo.uiDC.Assets.datapadmoveSaberSound2;
1929 }
1930 else if (soundI == 3)
1931 {
1932 soundPtr = &uiInfo.uiDC.Assets.datapadmoveSaberSound3;
1933 }
1934 else if (soundI == 4)
1935 {
1936 soundPtr = &uiInfo.uiDC.Assets.datapadmoveSaberSound4;
1937 }

Callers 1

UI_UpdateCharacterFunction · 0.70

Calls 10

UI_HandleLoadSelectionFunction · 0.85
Q_irandFunction · 0.85
Menus_FindByNameFunction · 0.70
Menu_FindItemByNameFunction · 0.70
Item_RunScriptFunction · 0.70
Cvar_SetFunction · 0.50
Com_sprintfFunction · 0.50
Cvar_VariableStringFunction · 0.50

Tested by

no test coverage detected