X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_game.pas;h=9112b7f9eb91eb0b6e49942a72038f800961d8d6;hb=0ff388bd10878013beb4a2370f4aee6852eaf03e;hp=ca0bea81dcbceb186b04afd137886b03d74542a6;hpb=82fc44046c22d1b60695f3b1f7abfb48f18bea48;p=d2df-sdl.git diff --git a/src/game/g_game.pas b/src/game/g_game.pas index ca0bea8..9112b7f 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -84,6 +84,7 @@ procedure g_Game_Free (freeTextures: Boolean=true); procedure g_Game_LoadData(); procedure g_Game_FreeData(); procedure g_Game_Update(); +procedure g_Game_PreUpdate(); procedure g_Game_Draw(); procedure g_Game_Quit(); procedure g_Game_SetupScreenSize(); @@ -386,7 +387,7 @@ uses e_input, e_log, g_console, g_items, g_map, g_panel, g_playermodel, g_gfx, g_options, Math, g_triggers, g_monsters, e_sound, CONFIG, - g_language, g_net, g_main, + g_language, g_net, g_main, g_phys, ENet, e_msg, g_netmsg, g_netmaster, sfs, wadreader, g_system; @@ -1716,6 +1717,17 @@ begin MC_SEND_CheatRequest(NET_CHEAT_READY); end; +procedure g_Game_PreUpdate(); +begin + // these are in separate PreUpdate functions because they can interact during Update() + // and are synced over the net + // we don't care that much about corpses and gibs + g_Player_PreUpdate(); + g_Monsters_PreUpdate(); + g_Items_PreUpdate(); + g_Weapon_PreUpdate(); +end; + procedure g_Game_Update(); var Msg: g_gui.TMessage; @@ -2162,13 +2174,6 @@ begin end; end; - // these are in separate PreUpdate functions because they can interact during Update() - // we don't care that much about corpses and gibs - g_Player_PreUpdate(); - g_Monsters_PreUpdate(); - g_Items_PreUpdate(); - g_Weapon_PreUpdate(); - // Îáíîâëÿåì âñå îñòàëüíîå: g_Map_Update(); g_Items_Update(); @@ -3630,6 +3635,7 @@ end; procedure DrawPlayer(p: TPlayer); var px, py, a, b, c, d, i, fX, fY: Integer; + camObj: TObj; //R: TRect; begin if (p = nil) or (p.FDummy) then @@ -3647,9 +3653,10 @@ begin glPushMatrix(); - p.Obj.lerp(gLerpFactor, fX, fY); + camObj := p.getCameraObj(); + camObj.lerp(gLerpFactor, fX, fY); px := fX + PLAYER_RECT_CX; - py := fY + PLAYER_RECT_CY+nlerp(p.SlopeOld, p.Obj.slopeUpLeft, gLerpFactor); + py := fY + PLAYER_RECT_CY+nlerp(p.SlopeOld, camObj.slopeUpLeft, gLerpFactor); if (g_dbg_scale = 1.0) and (not g_dbg_ignore_bounds) then begin @@ -3838,6 +3845,9 @@ begin FPSTime := Time; end; + e_SetRendertarget(True); + e_SetViewPort(0, 0, gScreenWidth, gScreenHeight); + if gGameOn or (gState = STATE_FOLD) then begin if (gPlayer1 <> nil) and (gPlayer2 <> nil) then @@ -4168,10 +4178,20 @@ begin if gGameOn then drawProfilers(); + // TODO: draw this after the FBO and remap mouse click coordinates + {$IFDEF ENABLE_HOLMES} g_Holmes_DrawUI(); {$ENDIF} + // blit framebuffer to screen + + e_SetRendertarget(False); + e_SetViewPort(0, 0, gWinSizeX, gWinSizeY); + e_BlitFramebuffer(gWinSizeX, gWinSizeY); + + // draw the overlay stuff on top of it + g_Touch_Draw; end; @@ -6590,6 +6610,7 @@ begin g_Game_Free(); with gGameSettings do begin + Options := gsGameFlags; GameMode := g_Game_TextToMode(gsGameMode); if gSwitchGameMode <> GM_NONE then GameMode := gSwitchGameMode; @@ -6644,6 +6665,7 @@ begin g_Game_Free(); with gGameSettings do begin + Options := gsGameFlags; GameMode := g_Game_TextToMode(gsGameMode); if gSwitchGameMode <> GM_NONE then GameMode := gSwitchGameMode; if GameMode = GM_NONE then GameMode := GM_DM; @@ -7642,8 +7664,7 @@ begin case gAnnouncer of ANNOUNCE_NONE: Exit; - ANNOUNCE_ME, - ANNOUNCE_MEPLUS: + ANNOUNCE_ME: if not g_Game_IsWatchedPlayer(SpawnerUID) then Exit; end; @@ -7978,8 +7999,7 @@ begin // Options: s := Find_Param_Value(pars, '-opt'); if (s = '') then - Opt := GAME_OPTION_ALLOWEXIT or GAME_OPTION_BOTVSPLAYER or - GAME_OPTION_BOTVSMONSTER or GAME_OPTION_DMKEYS + Opt := gsGameFlags else Opt := StrToIntDef(s, 0);