diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index ad9330d7cdd293233479985cf73ac3852f1f84b2..7c413aabd2ed8166a05bdaeba151d8aa78d8af3d 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
MAPDEF,
g_basic, g_player, e_graphics, g_res_downloader,
g_sound, g_gui, utils, md5, mempool, xprofiler,
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
type
TGameSettings = record
gDelayedEvents: Array of TDelayedEvent;
gUseChatSounds: Boolean = True;
gChatSounds: Array of TChatSound;
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
g_dbg_ignore_bounds: Boolean = false;
r_smallmap_h: Integer = 0; // 0: left; 1: center; 2: right
{$ENDIF}
e_texture, g_textures, g_main, g_window, g_menu,
e_input, e_log, g_console, g_items, g_map, g_panel,
{$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,
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;
var
time: Word;
strafeDir: Byte;
+ i: Integer;
begin
if (plr = nil) then exit;
if (p = 2) then time := 1000 else time := 1;
begin
if (plr = nil) then exit;
if (p = 2) then time := 1000 else time := 1;
if gPlayerAction[p, ACTION_WEAPPREV] then plr.PressKey(KEY_PREVWEAPON);
if gPlayerAction[p, ACTION_ACTIVATE] then plr.PressKey(KEY_OPEN);
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
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
end;
// HACK: add dynlight here
(
(
e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(IK_SPACE) or
(
(
e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(IK_SPACE) or
- e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN)
+ e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN) or
+ e_KeyPressed(JOY0_ATTACK) or e_KeyPressed(JOY1_ATTACK) or
+ e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
and (g_ActiveWindow = nil)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
and (g_ActiveWindow = nil)
ProcessLoading(true);
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
+ 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;
break;
begin
State := 0;
break;
g_Console_Add(Format(cmd + ' is %d', [Byte(g_Debug_Player)]));
end
g_Console_Add(Format(cmd + ' is %d', [Byte(g_Debug_Player)]));
end
- else if (cmd = 'd_joy') then
- begin
- for a := 1 to 8 do
- g_Console_Add(e_JoystickStateToString(a));
- end
else if (cmd = 'd_mem') then
begin
PrintHeapStats();
else if (cmd = 'd_mem') then
begin
PrintHeapStats();
end else
begin
// Òàêîé êàðòû íåò, èùåì WAD ôàéë
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);
begin
// Ïàðàìåòðà êàðòû íåò, ïîýòîìó ñòàâèì ïåðâóþ èç ôàéëà
SetLength(P, 3);
+ P[1] := ExtractRelativePath(MapsDir, pw);
P[2] := g_Game_GetFirstMap(MapsDir + P[1]);
s := P[1] + ':\' + P[2];
P[2] := g_Game_GetFirstMap(MapsDir + P[1]);
s := P[1] + ':\' + P[2];
begin
a := WP_FIRST + StrToInt(p[1]) - 1;
if (a >= WP_FIRST) and (a <= WP_LAST) 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
end
end
else if (cmd = 'p1_weapon') or (cmd = 'p2_weapon') then
a := WP_FIRST + StrToInt(p[1]) - 1;
b := ord(cmd[2]) - ord('1');
if (a >= WP_FIRST) and (a <= WP_LAST) then
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
// Êîìàíäû Ñâîåé èãðû:
end
end
// Êîìàíäû Ñâîåé èãðû: