DEADSOFTWARE

models: remove TModelInfo
[d2df-sdl.git] / src / game / g_menu.pas
index c086cb028e0ec05fa93cd00f126a996498d0d306..0f0f2509cb54e7a492867e6afff9f90f021d3d37 100644 (file)
@@ -43,11 +43,11 @@ var
 implementation
 
 uses
-  g_gui, g_textures, r_graphics, g_main, g_window, g_game, g_map,
-  g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
+  g_gui, r_textures, r_graphics, g_game, g_map,
+  g_base, g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
   e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
   MAPDEF, Math, g_saveload,
-  e_texture, g_language, e_res,
+  g_language, e_res,
   g_net, g_netmsg, g_netmaster, g_items, e_input, g_touch,
   utils, wadreader, g_system, r_game;
 
@@ -107,7 +107,6 @@ procedure ProcApplyOptions();
 var
   menu: TGUIMenu;
   i: Integer;
-  ovs: Boolean;
 begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
 
@@ -116,10 +115,7 @@ begin
   else
     gBPP := 32;
 
-  ovs := gVSync;
   gVSync := TGUISwitch(menu.GetControl('swVSync')).ItemIndex = 0;
-  if (ovs <> gVSync) then
-    sys_EnableVSync(gVSync);
 
   gTextureFilter := TGUISwitch(menu.GetControl('swTextureFilter')).ItemIndex = 0;
   glNPOTOverride := not (TGUISwitch(menu.GetControl('swLegacyNPOT')).ItemIndex = 0);
@@ -328,7 +324,7 @@ begin
 
   with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
   begin
-    gPlayer1Settings.Model := Model.Name;
+    gPlayer1Settings.Model := Model.GetName();
     gPlayer1Settings.Color := Model.Color;
   end;
 
@@ -339,7 +335,7 @@ begin
                                   TEAM_RED, TEAM_BLUE);
   with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
   begin
-    gPlayer2Settings.Model := Model.Name;
+    gPlayer2Settings.Model := Model.GetName();
     gPlayer2Settings.Color := Model.Color;
   end;
 
@@ -1353,7 +1349,7 @@ end;
 procedure ProcOptionsPlayersMIMenu();
 var
   s, a: string;
-  b: TModelInfo;
+  i: Integer;
 begin
   if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
 
@@ -1361,15 +1357,14 @@ begin
 
   if a = '' then Exit;
 
-  b := g_PlayerModel_GetInfo(a);
-
+  i := g_PlayerModel_GetIndex(a);
   with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
   begin
-    TGUILabel(GetControl('lbName')).Text := b.Name;
-    TGUILabel(GetControl('lbAuthor')).Text := b.Author;
-    TGUIMemo(GetControl('meComment')).SetText(b.Description);
+    TGUILabel(GetControl('lbName')).Text := PlayerModelsArray[i].Name;
+    TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray[i].Author;
+    TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray[i].Description);
 
-    if b.HaveWeapon then
+    if PlayerModelsArray[i].HaveWeapon then
       TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_YES]
     else
       TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_NO];
@@ -1390,8 +1385,7 @@ begin
   with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')) do
   begin
     NextAnim();
-    Model.GetCurrentAnimation.Loop := True;
-    Model.GetCurrentAnimationMask.Loop := True;
+    Model.AnimState.Loop := True;
   end;
 end;
 
@@ -3531,16 +3525,11 @@ end;
 procedure g_Menu_Init();
 begin
   MenuLoadData();
-  g_GUI_Init();
   CreateAllMenus();
 end;
 
 procedure g_Menu_Free();
 begin
-  g_GUI_Destroy();
-
-  e_WriteLog('Releasing menu data...', TMsgType.Notify);
-
   MenuFreeData();
 end;