X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_menu.pas;h=6daf00cdf864e399b541cfa8a4599b1ffac82b0d;hb=23a883f6c44413c380997e61b00a756bda95bc03;hp=265bade66424b2a0412cac54634581691f123a91;hpb=d0936017ccb8a078d1b03f55478af284bb015bbc;p=d2df-sdl.git diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 265bade..6daf00c 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -20,8 +20,6 @@ interface procedure g_Menu_Init(); procedure g_Menu_Free(); procedure g_Menu_Reset(); -procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD); -procedure LoadFont(txtres, fntres: string; var FontID: DWORD); procedure g_Menu_AskLanguage(); procedure g_Menu_Show_SaveMenu(); @@ -33,8 +31,6 @@ procedure g_Menu_Show_EndGameMenu(); procedure g_Menu_Show_QuitGameMenu(); var - gMenuFont: DWORD; - gMenuSmallFont: DWORD; PromptIP: string; PromptPort: Word; TempScale: Integer = -1; @@ -43,13 +39,16 @@ var implementation uses - g_gui, g_textures, r_graphics, g_window, g_game, g_map, - g_base, g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons, + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + g_gui, r_textures, r_graphics, g_game, g_map, + g_base, g_basic, g_console, g_sound, g_player, g_options, g_weapons, e_log, SysUtils, CONFIG, g_playermodel, DateUtils, MAPDEF, Math, g_saveload, g_language, e_res, - g_net, g_netmsg, g_netmaster, g_items, e_input, g_touch, - utils, wadreader, g_system, r_game; + g_net, g_netmsg, g_netmaster, g_items, e_input, + utils, wadreader, g_system, r_render, r_game; type TYNCallback = procedure (yes:Boolean); @@ -107,7 +106,6 @@ procedure ProcApplyOptions(); var menu: TGUIMenu; i: Integer; - ovs: Boolean; begin menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu')); @@ -116,10 +114,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); @@ -140,7 +135,9 @@ begin menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu')); - g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000); + {$IFDEF ENABLE_GFX} + g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000); + {$ENDIF} g_Shells_SetMax(TGUIScroll(menu.GetControl('scShellsMax')).Value*30); g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25); g_Corpses_SetMax(TGUIScroll(menu.GetControl('scCorpsesMax')).Value*5); @@ -328,7 +325,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 +336,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; @@ -534,7 +531,9 @@ begin menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu')); - TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000; + {$IFDEF ENABLE_GFX} + TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000; + {$ENDIF} TGUIScroll(menu.GetControl('scShellsMax')).Value := g_Shells_GetMax() div 30; TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25; TGUIScroll(menu.GetControl('scCorpsesMax')).Value := g_Corpses_GetMax() div 5; @@ -784,7 +783,7 @@ begin slWaitStr := _lc[I_NET_SLIST_WAIT]; - r_Game_Draw; + r_Render_Draw; sys_Repaint; slReturnPressed := True; @@ -957,90 +956,6 @@ begin ProcChangeColor(nil); end; -procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD); -var - cwdt, chgt: Byte; - spc: ShortInt; - ID: DWORD; - wad: TWADFile; - cfgdata: Pointer; - cfglen: Integer; - config: TConfig; -begin - cfglen := 0; - - wad := TWADFile.Create; - if wad.ReadFile(GameWAD) then - wad.GetResource('FONTS/'+cfgres, cfgdata, cfglen); - wad.Free(); - - if cfglen <> 0 then - begin - g_Texture_CreateWADEx('FONT_STD', GameWAD+':FONTS\'+texture); - - config := TConfig.CreateMem(cfgdata, cfglen); - cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255); - chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255); - spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127); - - if g_Texture_Get('FONT_STD', ID) then - e_TextureFontBuild(ID, FontID, cwdt, chgt, spc); - - config.Free(); - end; - - if cfglen <> 0 then FreeMem(cfgdata); -end; - -procedure LoadFont(txtres, fntres: string; var FontID: DWORD); -var - cwdt, chgt: Byte; - spc: ShortInt; - CharID: DWORD; - wad: TWADFile; - cfgdata, fntdata: Pointer; - cfglen, fntlen: Integer; - config: TConfig; - chrwidth: Integer; - a: Byte; -begin - cfglen := 0; - fntlen := 0; - - wad := TWADFile.Create; - if wad.ReadFile(GameWAD) then - begin - wad.GetResource('FONTS/'+txtres, cfgdata, cfglen); - wad.GetResource('FONTS/'+fntres, fntdata, fntlen); - end; - wad.Free(); - - if cfglen <> 0 then - begin - config := TConfig.CreateMem(cfgdata, cfglen); - cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255); - chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255); - - spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127); - FontID := e_CharFont_Create(spc); - - for a := 0 to 255 do - begin - chrwidth := config.ReadInt(IntToStr(a), 'Width', 0); - if chrwidth = 0 then Continue; - - if e_CreateTextureMemEx(fntdata, fntlen, CharID, cwdt*(a mod 16), chgt*(a div 16), - cwdt, chgt) then - e_CharFont_AddChar(FontID, CharID, Chr(a), chrwidth); - end; - - config.Free(); - end; - - if cfglen <> 0 then FreeMem(cfgdata); - if fntlen <> 0 then FreeMem(fntdata); -end; - procedure MenuLoadData(); begin e_WriteLog('Loading menu data...', TMsgType.Notify); @@ -1353,7 +1268,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 +1276,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 +1304,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 +3444,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;