X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_game.pas;h=d8aab5c9eb7b30a89f8152d38561c733f9d54b8b;hb=d92a9e2807dda8a533def35afa801ed975920885;hp=7e1249d6aa474c9e7d4e184c53c7a803991a1fee;hpb=84fa2f88d5d832ed9cc932fd2860d74467e242e1;p=d2df-sdl.git diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 7e1249d..d8aab5c 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -23,7 +23,7 @@ uses MAPDEF, g_basic, g_player, e_graphics, g_res_downloader, g_sound, g_gui, utils, md5, mempool, xprofiler, - g_touch; + g_touch, g_weapons; type TGameSettings = record @@ -325,7 +325,7 @@ var gDelayedEvents: Array of TDelayedEvent; gUseChatSounds: Boolean = True; gChatSounds: Array of TChatSound; - gSelectWeapon: Array [0..1] of Integer = (-1, -1); // [player] + gSelectWeapon: Array [0..1, WP_FIRST..WP_LAST] of Boolean; // [player, weapon] g_dbg_ignore_bounds: Boolean = false; r_smallmap_h: Integer = 0; // 0: left; 1: center; 2: right @@ -373,7 +373,7 @@ uses {$ENDIF} e_texture, g_textures, g_main, g_window, g_menu, e_input, e_log, g_console, g_items, g_map, g_panel, - g_playermodel, g_gfx, g_options, g_weapons, Math, + g_playermodel, g_gfx, g_options, Math, g_triggers, g_monsters, e_sound, CONFIG, g_language, g_net, ENet, e_msg, g_netmsg, g_netmaster, @@ -1504,6 +1504,7 @@ procedure ProcessPlayerControls (plr: TPlayer; p: Integer; var MoveButton: Byte) var time: Word; strafeDir: Byte; + i: Integer; begin if (plr = nil) then exit; if (p = 2) then time := 1000 else time := 1; @@ -1561,10 +1562,16 @@ begin if gPlayerAction[p, ACTION_WEAPPREV] then plr.PressKey(KEY_PREVWEAPON); if gPlayerAction[p, ACTION_ACTIVATE] then plr.PressKey(KEY_OPEN); - if gSelectWeapon[p] >= 0 then + gPlayerAction[p, ACTION_WEAPNEXT] := False; // HACK, remove after readyweaon&pendinweapon implementation + gPlayerAction[p, ACTION_WEAPPREV] := False; // HACK, remove after readyweaon&pendinweapon implementation + + for i := WP_FIRST to WP_LAST do begin - plr.QueueWeaponSwitch(gSelectWeapon[p]); - gSelectWeapon[p] := -1 + if gSelectWeapon[p, i] then + begin + plr.QueueWeaponSwitch(i); // all choices are passed there, and god will take the best + gSelectWeapon[p, i] := False + end end; // HACK: add dynlight here @@ -4642,7 +4649,7 @@ begin ProcessLoading(true); - if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) or + if e_KeyPressed(IK_SPACE) or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) or e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then begin State := 0; @@ -6573,12 +6580,13 @@ begin end else begin // Òàêîé êàðòû íåò, èùåì WAD ôàéë - P[1] := addWadExtension(P[1]); - g_Console_Add(Format(_lc[I_MSG_NO_MAP_FALLBACK], [s, P[1]])); - if FileExists(MapsDir + P[1]) then + pw := findDiskWad(MapsDir + P[1]); + g_Console_Add(Format(_lc[I_MSG_NO_MAP_FALLBACK], [s, 'WAD ' + P[1]])); + if FileExists(pw) then begin // Ïàðàìåòðà êàðòû íåò, ïîýòîìó ñòàâèì ïåðâóþ èç ôàéëà SetLength(P, 3); + P[1] := ExtractRelativePath(MapsDir, pw); P[2] := g_Game_GetFirstMap(MapsDir + P[1]); s := P[1] + ':\' + P[2]; @@ -6802,26 +6810,13 @@ begin begin g_TakeScreenShot() end - else if cmd = 'togglechat' then - begin - g_Console_Chat_Switch(False); - gSkipFirstChar := not g_Console_Interactive() - end - else if cmd = 'toggleteamchat' then - begin - if gGameSettings.GameMode in [GM_TDM, GM_CTF] then - begin - g_Console_Chat_Switch(True); - gSkipFirstChar := not g_Console_Interactive() - end - end else if cmd = 'weapon' then begin if Length(p) = 2 then begin a := WP_FIRST + StrToInt(p[1]) - 1; if (a >= WP_FIRST) and (a <= WP_LAST) then - gSelectWeapon[0] := a + gSelectWeapon[0, a] := True end end else if (cmd = 'p1_weapon') or (cmd = 'p2_weapon') then @@ -6831,7 +6826,7 @@ begin a := WP_FIRST + StrToInt(p[1]) - 1; b := ord(cmd[2]) - ord('1'); if (a >= WP_FIRST) and (a <= WP_LAST) then - gSelectWeapon[b] := a + gSelectWeapon[b, a] := True end end // Êîìàíäû Ñâîåé èãðû: