diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f4486028795f4f80134a47d33b5de80b517f9f53..981082d949b8aa4b5766dc98757319001b108dda 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
gPlayer2: TPlayer = nil;
gPlayerDrawn: TPlayer = nil;
gTime: LongWord;
+ gLerpFactor: Single = 1.0;
gSwitchGameMode: Byte = GM_DM;
gHearPoint1, gHearPoint2: THearPoint;
gSoundEffectsDF: Boolean = False;
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;
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();
procedure DrawPlayer(p: TPlayer);
var
- px, py, a, b, c, d, i: Integer;
+ px, py, a, b, c, d, i, fX, fY: Integer;
+ camObj: TObj;
//R: TRect;
begin
if (p = nil) or (p.FDummy) then
glPushMatrix();
- px := p.GameX + PLAYER_RECT_CX;
- py := p.GameY + PLAYER_RECT_CY+p.Obj.slopeUpLeft;
+ camObj := p.getCameraObj();
+ camObj.lerp(gLerpFactor, fX, fY);
+ px := fX + PLAYER_RECT_CX;
+ 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
p.IncCam := nclamp(p.IncCam, min(0, -120 - i), 0);
end;
- sY := sY - p.IncCam;
+ sY := sY - nlerp(p.IncCamOld, p.IncCam, gLerpFactor);
if (not g_dbg_ignore_bounds) then
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
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;
else if gPlayers[i].Team = TEAM_BLUE then Inc(nb)
end;
- if (n < 2) or ((gGameSettings.GameMode = GM_TDM) and ((nr = 0) or (nb = 0))) then
+ if (n < 1) or ((gGameSettings.GameMode = GM_TDM) and ((nr = 0) or (nb = 0))) then
begin
// wait a second until the fuckers finally decide to join
gLMSRespawn := LMS_RESPAWN_WARMUP;
if g_Game_IsServer then
begin
gGameSettings.WarmupTime := gsWarmupTime;
+ // extend warmup if it's already going
+ if gLMSRespawn = LMS_RESPAWN_WARMUP then
+ begin
+ gLMSRespawnTime := gTime + gsWarmupTime * 1000;
+ if g_Game_IsNet then MH_SEND_GameEvent(NET_EV_LMS_WARMUP, gLMSRespawnTime - gTime);
+ end;
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end;
end;
'r_reset':
begin
- sys_EnableVSync(gVSync);
gRC_Width := Max(1, gRC_Width);
gRC_Height := Max(1, gRC_Height);
gBPP := Max(1, gBPP);
e_LogWriteln('resolution changed')
else
e_LogWriteln('resolution not changed');
+ sys_EnableVSync(gVSync);
+ end;
+ 'r_maxfps':
+ begin
+ if Length(p) = 2 then
+ begin
+ gMaxFPS := StrToIntDef(p[1], gMaxFPS);
+ if gMaxFPS > 0 then
+ gFrameTime := 1000 div gMaxFPS
+ else
+ gFrameTime := 0;
+ end;
+ e_LogWritefln('r_maxfps %d', [gMaxFPS]);
end;
'g_language':
begin