X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_menu.pas;h=62bf314d33aefda6882165516203bb10862fdf48;hb=16342bee09fa001d05697571124e48a93cd35f2c;hp=bd213148c20374d88faf9ef963fd0605124eac46;hpb=a9b641b6421fe1ab2ae3ffdf6a7fb41c56df1970;p=d2df-sdl.git diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index bd21314..62bf314 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,14 +39,19 @@ var implementation uses - {$INCLUDE ../nogl/noGLuses.inc} - g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map, - g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons, + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + {$IFDEF ENABLE_GIBS} + g_gibs, + {$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, - e_texture, g_language, e_res, - g_net, g_netmsg, g_netmaster, g_items, e_input, g_touch, - utils, wadreader, g_system; + g_language, e_res, + g_net, g_netmsg, g_netmaster, g_items, e_input, + utils, wadreader, g_system, r_render, r_game; type TYNCallback = procedure (yes:Boolean); @@ -108,7 +109,6 @@ procedure ProcApplyOptions(); var menu: TGUIMenu; i: Integer; - ovs: Boolean; begin menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu')); @@ -117,10 +117,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); @@ -141,18 +138,24 @@ 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); + {$IFDEF ENABLE_GIBS} + g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25); + {$ENDIF} g_Corpses_SetMax(TGUIScroll(menu.GetControl('scCorpsesMax')).Value*5); - case TGUISwitch(menu.GetControl('swGibsCount')).ItemIndex of - 0: gGibsCount := 0; - 1: gGibsCount := 8; - 2: gGibsCount := 16; - 3: gGibsCount := 32; - else gGibsCount := 48; - end; + {$IFDEF ENABLE_GIBS} + case TGUISwitch(menu.GetControl('swGibsCount')).ItemIndex of + 0: gGibsCount := 0; + 1: gGibsCount := 8; + 2: gGibsCount := 16; + 3: gGibsCount := 32; + else gGibsCount := 48; + end; + {$ENDIF} gBloodCount := TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex; gFlash := TGUISwitch(menu.GetControl('swScreenFlash')).ItemIndex; @@ -329,7 +332,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; @@ -340,7 +343,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; @@ -535,9 +538,13 @@ 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; + {$IFDEF ENABLE_GIBS} + TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25; + {$ENDIF} TGUIScroll(menu.GetControl('scCorpsesMax')).Value := g_Corpses_GetMax() div 5; TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex := gBloodCount; @@ -553,14 +560,18 @@ begin with TGUISwitch(menu.GetControl('swGibsType')) do if gAdvGibs then ItemIndex := 1 else ItemIndex := 0; - with TGUISwitch(menu.GetControl('swGibsCount')) do - case gGibsCount of - 0: ItemIndex := 0; - 8: ItemIndex := 1; - 16: ItemIndex := 2; - 32: ItemIndex := 3; - else ItemIndex := 4; + {$IFDEF ENABLE_GIBS} + with TGUISwitch(menu.GetControl('swGibsCount')) do + begin + case gGibsCount of + 0: ItemIndex := 0; + 8: ItemIndex := 1; + 16: ItemIndex := 2; + 32: ItemIndex := 3; + else ItemIndex := 4; + end; end; + {$ENDIF} with TGUISwitch(menu.GetControl('swBackGround')) do if gDrawBackGround then ItemIndex := 0 else ItemIndex := 1; @@ -785,7 +796,7 @@ begin slWaitStr := _lc[I_NET_SLIST_WAIT]; - g_Game_Draw; + r_Render_Draw; sys_Repaint; slReturnPressed := True; @@ -958,90 +969,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); @@ -1354,7 +1281,7 @@ end; procedure ProcOptionsPlayersMIMenu(); var s, a: string; - b: TModelInfo; + i: Integer; begin if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2'; @@ -1362,15 +1289,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]; @@ -1391,8 +1317,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; @@ -3532,16 +3457,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;