X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_game.pas;h=7a70840b33b47db24b85276e7d1d63f77f1f26e1;hp=081d97e892b2af312e668557e532308f8cbfed02;hb=0bae75d8258116d9079c1b7a4b50f334cc50973e;hpb=5ec745243230db4b74820b894755e9f1eab0da4c diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 081d97e..7a70840 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -326,6 +326,7 @@ var gUseChatSounds: Boolean = True; gChatSounds: Array of TChatSound; gSelectWeapon: Array [0..1, WP_FIRST..WP_LAST] of Boolean; // [player, weapon] + gInterReadyCount: Integer = 0; g_dbg_ignore_bounds: Boolean = false; r_smallmap_h: Integer = 0; // 0: left; 1: center; 2: right @@ -578,6 +579,7 @@ var MessageLineLength: Integer = 80; MapList: SSArray = nil; MapIndex: Integer = -1; + InterReadyTime: Integer = -1; MegaWAD: record info: TMegaWADInfo; endpic: String; @@ -978,6 +980,7 @@ begin SetLength(CustomStat.PlayerStat, Length(CustomStat.PlayerStat)+1); with CustomStat.PlayerStat[High(CustomStat.PlayerStat)] do begin + Num := a; Name := gPlayers[a].Name; Frags := gPlayers[a].Frags; Deaths := gPlayers[a].Death; @@ -992,6 +995,8 @@ begin end; g_Game_ExecuteEvent('onmapend'); + if not g_Game_IsClient then g_Player_ResetReady; + gInterReadyCount := 0; // Çàòóõàþùèé ýêðàí: EndingGameCounter := 255; @@ -1590,6 +1595,14 @@ begin if gwin_has_stencil and g_playerLight then g_AddDynLight(plr.GameX+32, plr.GameY+40, 128, 1, 1, 0, 0.6); end; +// HACK: don't have a "key was pressed" function +procedure InterReady(); +begin + if InterReadyTime > gTime then Exit; + InterReadyTime := gTime + 3000; + MC_SEND_CheatRequest(NET_CHEAT_READY); +end; + procedure g_Game_Update(); var Msg: g_gui.TMessage; @@ -1682,7 +1695,7 @@ begin and (not gJustChatted) and (not gConsoleShow) and (not gChatShow) and (g_ActiveWindow = nil) ) - or (g_Game_IsNet and (gInterTime > gInterEndTime)) + or (g_Game_IsNet and ((gInterTime > gInterEndTime) or (gInterReadyCount >= NetClientCount))) ) then begin // Íàæàëè /<Ïðîáåë> èëè ïðîøëî äîñòàòî÷íî âðåìåíè: @@ -1717,6 +1730,22 @@ begin end; Exit; + end + else if g_Game_IsClient and + ( + ( + e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(IK_SPACE) or + 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) + ) + then + begin + // ready / unready + InterReady(); end; if gState = STATE_INTERTEXT then @@ -1731,6 +1760,7 @@ begin // Çàêîí÷èëñÿ óðîâåíü â Ñâîåé èãðå: if gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT] then begin + InterReadyTime := -1; if gLastMap and (gGameSettings.GameMode = GM_COOP) then begin g_Game_ExecuteEvent('onwadend'); @@ -2692,9 +2722,12 @@ begin gg := g; bb := b; end; - e_TextureFontPrintEx(x+8, _y, Name, gStdFont, rr, gg, bb, 1); - e_TextureFontPrintEx(x+w1+8, _y, IntToStr(Frags), gStdFont, rr, gg, bb, 1); - e_TextureFontPrintEx(x+w1+w2+8, _y, IntToStr(Deaths), gStdFont, rr, gg, bb, 1); + if (gPlayers[Num] <> nil) and (gPlayers[Num].FReady) then + e_TextureFontPrintEx(x+16, _y, Name + ' *', gStdFont, rr, gg, bb, 1) + else + e_TextureFontPrintEx(x+16, _y, Name, gStdFont, rr, gg, bb, 1); + e_TextureFontPrintEx(x+w1+16, _y, IntToStr(Frags), gStdFont, rr, gg, bb, 1); + e_TextureFontPrintEx(x+w1+w2+16, _y, IntToStr(Deaths), gStdFont, rr, gg, bb, 1); _y := _y+24; end; @@ -2719,7 +2752,10 @@ begin else r := 255; - e_TextureFontPrintEx(x+8+16+8, _y+4, Name, gStdFont, r, r, r, 1, True); + if (gPlayers[Num] <> nil) and (gPlayers[Num].FReady) then + e_TextureFontPrintEx(x+8+16+8, _y+4, Name + ' *', gStdFont, r, r, r, 1, True) + else + e_TextureFontPrintEx(x+8+16+8, _y+4, Name, gStdFont, r, r, r, 1, True); e_TextureFontPrintEx(x+w1+8+16+8, _y+4, IntToStr(Frags), gStdFont, r, r, r, 1, True); e_TextureFontPrintEx(x+w1+w2+8+16+8, _y+4, IntToStr(Deaths), gStdFont, r, r, r, 1, True); _y := _y+24; @@ -6372,7 +6408,9 @@ begin else if (cmd = 'addbot') or (cmd = 'bot_add') then begin - if Length(P) > 1 then + if Length(P) > 2 then + g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2), StrToIntDef(P[2], 100)) + else if Length(P) > 1 then g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2)) else g_Bot_Add(TEAM_NONE, 2); @@ -6380,10 +6418,14 @@ begin else if cmd = 'bot_addlist' then begin if Length(P) > 1 then + begin if Length(P) = 2 then g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1)) + else if Length(P) = 3 then + g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1), StrToIntDef(P[2], 100)) else g_Bot_AddList(IfThen(P[2] = 'red', TEAM_RED, TEAM_BLUE), P[1], StrToIntDef(P[1], -1)); + end; end else if cmd = 'bot_removeall' then g_Bot_RemoveAll()